From 78d2430cdf857b32451192dcb5a577ec82f0c066 Mon Sep 17 00:00:00 2001 From: Justin Davis Date: Tue, 16 Aug 2011 11:45:10 -0400 Subject: Let's avoid creating a symlink to itself... --- bin/macros/perl-dist | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'bin') diff --git a/bin/macros/perl-dist b/bin/macros/perl-dist index 82d298b..3dd2263 100755 --- a/bin/macros/perl-dist +++ b/bin/macros/perl-dist @@ -334,9 +334,7 @@ sub main my $file = basename($distpath); my $info = distinfo($file); - $dir = catdir($dir, 'src'); - prepsrcdir($dir, $file); - chdir $dir or die "chdir $dir: $!"; + chsrcdir(catdir($dir, 'src'), $file); $dir = extractdist($file); my $meta = loadmeta($dir); @@ -366,18 +364,18 @@ sub main printjam(\%pbvars); } -sub prepsrcdir +# Create the src/ directory and tarball symlink. Then chdir into it. + +sub chsrcdir { my ($srcdir, $distfile) = @_; - unless (-d $srcdir) { - mkdir $srcdir or die "mkdir $srcdir: $!"; - } - - symlink $distfile, catfile($srcdir, $distfile) + mkdir $srcdir or die "mkdir $srcdir: $!"; + chdir $srcdir or die "chdir $srcdir: $!"; + symlink catfile('..', $distfile), $distfile or die "symlink $distfile: $!"; - return; + return $srcdir; } sub envvar -- cgit v1.2.3-24-g4f1b