summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustin Davis <jrcd83@gmail.com>2011-09-22 17:20:07 +0200
committerJustin Davis <jrcd83@gmail.com>2011-09-22 17:20:07 +0200
commit40a410969dc7ad4a7b28bd3a831a1bb60d088eef (patch)
tree58f07713420a6c935c85436a3d6ba2910af99156
parent58fc6f5e57eeeaca6e815bd3cb804cb453e05b0d (diff)
downloadgenpkg-40a410969dc7ad4a7b28bd3a831a1bb60d088eef.tar.gz
genpkg-40a410969dc7ad4a7b28bd3a831a1bb60d088eef.tar.xz
Do not download CPAN dists if it already exists in the CWD.
-rw-r--r--Makefile7
-rwxr-xr-xbin/metas/perl4
-rwxr-xr-xbin/metas/perl.d/perl-dist9
3 files changed, 12 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index 1f996f1..0d9684c 100644
--- a/Makefile
+++ b/Makefile
@@ -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;
}