Skip to content

Commit c559b38

Browse files
committed
install_modules: always copy the module into TEMPDIR, support tarballs
1 parent 5fb77a2 commit c559b38

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

lib/Perl/Dist/APPerl.pm

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,8 +1119,22 @@ sub Build {
11191119
local $ENV{PERL5LIB} = $perllib;
11201120
local $ENV{PERL_LOCAL_LIB_ROOT} = '';
11211121
foreach my $module (@{$itemconfig->{install_modules}}) {
1122-
print "cd $startdir/$module\n";
1123-
chdir("$startdir/$module") or die "Failed to enter module dir";
1122+
my $modulepath = "$startdir/$module";
1123+
if(-d $modulepath) {
1124+
_copy_recursive($modulepath, $TEMPDIR);
1125+
$modulepath = "$TEMPDIR/".basename($modulepath);
1126+
}
1127+
elsif( -f _) {
1128+
_command_or_die('tar', 'xvf', $modulepath, '-C', $TEMPDIR);
1129+
$modulepath = "$TEMPDIR/".basename($modulepath);
1130+
$modulepath =~ s/\.tar.*$//;
1131+
}
1132+
else {
1133+
die "Module must be a directory or tarball";
1134+
}
1135+
1136+
print "cd $modulepath\n";
1137+
chdir($modulepath) or die "Failed to enter module dir";
11241138
# Module::Build (including installing Module::Build)
11251139
# Beware, Module::Build has no support for relinking the Perl binary like EU::MM - https://rt.cpan.org/Public/Bug/Display.html?id=47282
11261140
if(-f 'Build.PL') {

0 commit comments

Comments
 (0)