diff options
author | Justin Davis <jrcd83@gmail.com> | 2013-04-11 22:59:33 +0200 |
---|---|---|
committer | Justin Davis <jrcd83@gmail.com> | 2013-04-11 22:59:33 +0200 |
commit | 6d8daba2b1f377b59a3ffa0a55b6429703eb9672 (patch) | |
tree | d856674d13b6932d522ddd60060b3afdcdcfde3e | |
parent | ea8184012874f11d4ef9eed6e7fcc8cd5a1bf848 (diff) | |
download | genpkg-6d8daba2b1f377b59a3ffa0a55b6429703eb9672.tar.gz genpkg-6d8daba2b1f377b59a3ffa0a55b6429703eb9672.tar.xz |
Better error reporting if sync with CPAN fails.
-rwxr-xr-x | preps/perl | 5 | ||||
-rwxr-xr-x | preps/perl.d/fetchcpan | 11 |
2 files changed, 12 insertions, 4 deletions
@@ -25,12 +25,11 @@ sub matchdist or err('PKGVAR env variable is unset'); if(!-f "$var/cpan.dists" || -M "$var/cpan.dists" > 1) { - print STDERR "$PROG: Refreshing local CPAN data... "; + print STDERR "$PROG: Refreshing local CPAN data.\n"; my $cwd = getcwd(); chdir $var or die "chdir: $!"; system 'fetchcpan'; - die "FAILED\n" unless($? == 0); - print STDERR "OK\n"; + exit 1 unless($? == 0); chdir $cwd or die "chdir: $!"; } diff --git a/preps/perl.d/fetchcpan b/preps/perl.d/fetchcpan index b9ddeaa..dff7873 100755 --- a/preps/perl.d/fetchcpan +++ b/preps/perl.d/fetchcpan @@ -3,7 +3,7 @@ mirror=${CPANMIRROR:-ftp://cpan.pair.com} path=/modules/02packages.details.txt.gz -curl --silent "$mirror$path" | gzip -dc | awk ' +curl --silent "$mirror$path" | zcat 2>/dev/null | awk ' NR < 10 { next } { file = a[split($3, a, "/")] @@ -29,6 +29,8 @@ NR < 10 { next } } END { + if(NR == 0) exit(1) + for (dist in dists) { ver = dists[dist] print dist, ver, paths[dist] | "sort > cpan.dists" @@ -58,3 +60,10 @@ function decver (vs) } ' + +if [ $? -ne 0 ]; then + echo "fetchcpan: failed to download package list from CPAN" 1>&2 + exit 1 +fi + +exit 0 |