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:
parent
7b5a0156d2
commit
6fa4fa5933
|
@ -17,17 +17,20 @@ my %md5 ;
|
||||||
my $BDIR = shift @ARGV ;
|
my $BDIR = shift @ARGV ;
|
||||||
|
|
||||||
foreach my $sumsfile ($BDIR . "/indices/md5sums", $BDIR . "/indices-non-US/md5sums") {
|
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>) {
|
while (<MD5SUMS>) {
|
||||||
chomp;
|
chomp;
|
||||||
next if /Packages/ ;
|
next if /Packages/ ;
|
||||||
next if /Sources/ ;
|
next if /Sources/ ;
|
||||||
next if /Release/ ;
|
next if /Release/ ;
|
||||||
my ( $sum, $name ) = split(' ') ;
|
my ( $sum, $name ) = split(' ') ;
|
||||||
# printf "[%s] [%s]\n", $sum, $name ;
|
# printf "[%s] [%s]\n", $sum, $name ;
|
||||||
$md5{$name} = $sum ;
|
$md5{$name} = $sum ;
|
||||||
|
}
|
||||||
|
close(MD5SUMS);
|
||||||
|
} else {
|
||||||
|
warn "Couldn't open file: $sumsfile";
|
||||||
}
|
}
|
||||||
close(MD5SUMS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#foreach my $f (keys(%md5)) {
|
#foreach my $f (keys(%md5)) {
|
||||||
|
@ -40,7 +43,7 @@ foreach my $dir (<$BDIR/CD*>) {
|
||||||
-o -path '*dists/frozen*' \\
|
-o -path '*dists/frozen*' \\
|
||||||
-o -path '*dists/unstable*' \\) -prune \\
|
-o -path '*dists/unstable*' \\) -prune \\
|
||||||
-o -type f ! -path '\./md5sum*' -print|" ) || die ;
|
-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>) {
|
while(<FILES>) {
|
||||||
chomp;
|
chomp;
|
||||||
s(^\./)() ;
|
s(^\./)() ;
|
||||||
|
@ -61,5 +64,6 @@ foreach my $dir (<$BDIR/CD*>) {
|
||||||
printf MD5OUT "%s ./%s\n", $md5{$_}, $_;
|
printf MD5OUT "%s ./%s\n", $md5{$_}, $_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
close(MD5OUT) ;
|
close(MD5OUT);
|
||||||
|
die "$dir/md5sum.txt is empty!\n" unless (-s "md5sum.txt");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue