don't die if the input files are missing (the non-US file will be missing when top-level NONUS variable is unset); die if the output file is empty, however

This commit is contained in:
Josip Rodin 2003-07-24 12:22:36 +00:00
parent 7b5a0156d2
commit 6fa4fa5933
1 changed files with 16 additions and 12 deletions

View File

@ -17,7 +17,7 @@ my %md5 ;
my $BDIR = shift @ARGV ;
foreach my $sumsfile ($BDIR . "/indices/md5sums", $BDIR . "/indices-non-US/md5sums") {
open(MD5SUMS, $sumsfile) || die "Couldn't open file: $sumsfile" ;
if (open(MD5SUMS, $sumsfile)) {
while (<MD5SUMS>) {
chomp;
next if /Packages/ ;
@ -28,6 +28,9 @@ foreach my $sumsfile ($BDIR . "/indices/md5sums", $BDIR . "/indices-non-US/md5su
$md5{$name} = $sum ;
}
close(MD5SUMS);
} else {
warn "Couldn't open file: $sumsfile";
}
}
#foreach my $f (keys(%md5)) {
@ -40,7 +43,7 @@ foreach my $dir (<$BDIR/CD*>) {
-o -path '*dists/frozen*' \\
-o -path '*dists/unstable*' \\) -prune \\
-o -type f ! -path '\./md5sum*' -print|" ) || die ;
open(MD5OUT, ">md5sum.txt") || die "Couldn't open file for writing: md5sums.txt, in $dir" ;
open(MD5OUT, ">md5sum.txt") || die "Couldn't open file for writing: md5sum.txt, in $dir" ;
while(<FILES>) {
chomp;
s(^\./)() ;
@ -62,4 +65,5 @@ foreach my $dir (<$BDIR/CD*>) {
}
}
close(MD5OUT);
die "$dir/md5sum.txt is empty!\n" unless (-s "md5sum.txt");
}