diff options
author | Justin Davis <jrcd83@gmail.com> | 2011-09-22 17:20:07 +0200 |
---|---|---|
committer | Justin Davis <jrcd83@gmail.com> | 2011-09-22 17:20:07 +0200 |
commit | 40a410969dc7ad4a7b28bd3a831a1bb60d088eef (patch) | |
tree | 58f07713420a6c935c85436a3d6ba2910af99156 | |
parent | 58fc6f5e57eeeaca6e815bd3cb804cb453e05b0d (diff) | |
download | genpkg-40a410969dc7ad4a7b28bd3a831a1bb60d088eef.tar.gz genpkg-40a410969dc7ad4a7b28bd3a831a1bb60d088eef.tar.xz |
Do not download CPAN dists if it already exists in the CWD.
-rw-r--r-- | Makefile | 7 | ||||
-rwxr-xr-x | bin/metas/perl | 4 | ||||
-rwxr-xr-x | bin/metas/perl.d/perl-dist | 9 |
3 files changed, 12 insertions, 8 deletions
@@ -26,14 +26,11 @@ tweakmeta: $(PKGS)/$(PKG)/PKGMETA fi $(PKGS)/$(PKG)/PKGMETA: prepare - @rm -rf tmp - @mkdir tmp - @cd tmp; \ + @[ -d '$(PKGS)/$(PKG)' ] || mkdir '$(PKGS)/$(PKG)' + @cd '$(PKGS)/$(PKG)'; \ PATH="$$PATH:$(BIN)" METABIN="$(BIN)/metas" \ PKGVAR="$(PKGVAR)" \ $(BIN)/makepkgmeta $(PKG) >PKGMETA - @rm -rf "$(PKGS)/$(PKG)" - @mv tmp "$(PKGS)/$(PKG)" @echo 'Created pkg/$(PKG)/PKGMETA.' prepare: diff --git a/bin/metas/perl b/bin/metas/perl index b601746..c1ca14e 100755 --- a/bin/metas/perl +++ b/bin/metas/perl @@ -44,6 +44,10 @@ sub fetchdist { my ($cpath) = @_; my $file = $cpath; $file =~ s{^.*/}{}; + if (-f $file) { + print STDERR "$file already downloaded.\n"; + return; + } my $mirror = $ENV{'CPANMIRROR'} || 'ftp://cpan.pair.com'; my $url = "${mirror}/authors/id/${cpath}"; diff --git a/bin/metas/perl.d/perl-dist b/bin/metas/perl.d/perl-dist index 87bb9df..c916a95 100755 --- a/bin/metas/perl.d/perl-dist +++ b/bin/metas/perl.d/perl-dist @@ -364,10 +364,13 @@ sub chsrcdir { my ($srcdir, $distfile) = @_; - mkdir $srcdir or die "mkdir $srcdir: $!"; + unless (-d $srcdir) { + mkdir $srcdir or die "mkdir $srcdir: $!"; + } chdir $srcdir or die "chdir $srcdir: $!"; - symlink catfile('..', $distfile), $distfile - or die "symlink $distfile: $!"; + unless (-f $distfile) { + symlink catfile('..', $distfile), $distfile or die "symlink $distfile: $!"; + } return $srcdir; } |