summaryrefslogtreecommitdiffstats
path: root/bin/macros/perl-dist
diff options
context:
space:
mode:
authorJustin Davis <jrcd83@gmail.com>2011-08-16 17:38:09 +0200
committerJustin Davis <jrcd83@gmail.com>2011-08-16 17:38:09 +0200
commit99211786100275e502299f58e822c0b5a64300f0 (patch)
tree9334d327e31807f7ecd8555259dcf1c4c24e4372 /bin/macros/perl-dist
parentd6c783b734e2b4520dd75682ff5bd51c390c546d (diff)
downloadgenpkg-99211786100275e502299f58e822c0b5a64300f0.tar.gz
genpkg-99211786100275e502299f58e822c0b5a64300f0.tar.xz
Mimick makepkg's symlinking of tarball to avoid downloading twice.
Diffstat (limited to 'bin/macros/perl-dist')
-rwxr-xr-xbin/macros/perl-dist18
1 files changed, 17 insertions, 1 deletions
diff --git a/bin/macros/perl-dist b/bin/macros/perl-dist
index c822093..82d298b 100755
--- a/bin/macros/perl-dist
+++ b/bin/macros/perl-dist
@@ -286,7 +286,7 @@ sub _distofmod
package main;
use File::Basename qw(basename dirname);
-use File::Spec::Functions qw(catfile);
+use File::Spec::Functions qw(catfile catdir);
use File::Find qw(find);
use JSON::XS qw(decode_json); # parse META.{json,yml} files
@@ -334,6 +334,8 @@ sub main
my $file = basename($distpath);
my $info = distinfo($file);
+ $dir = catdir($dir, 'src');
+ prepsrcdir($dir, $file);
chdir $dir or die "chdir $dir: $!";
$dir = extractdist($file);
@@ -364,6 +366,20 @@ sub main
printjam(\%pbvars);
}
+sub prepsrcdir
+{
+ my ($srcdir, $distfile) = @_;
+
+ unless (-d $srcdir) {
+ mkdir $srcdir or die "mkdir $srcdir: $!";
+ }
+
+ symlink $distfile, catfile($srcdir, $distfile)
+ or die "symlink $distfile: $!";
+
+ return;
+}
+
sub envvar
{
my ($name) = @_;