mirror of
https://git.freebsd.org/ports.git
synced 2025-06-09 23:00:30 -04:00
Warn if there are duplicate MD5/SHA256/SIZE statements for a single file
This commit is contained in:
parent
cb2f2cbf28
commit
faaea2b718
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=154391
1 changed files with 33 additions and 3 deletions
|
@ -30,6 +30,9 @@ getopt('d:v',\%opts);
|
||||||
$UP=$opts{d} if (defined $opts{d});
|
$UP=$opts{d} if (defined $opts{d});
|
||||||
$verbose=1 if (defined $opts{v});
|
$verbose=1 if (defined $opts{v});
|
||||||
|
|
||||||
|
my $errors=0;
|
||||||
|
my $checked=0;
|
||||||
|
|
||||||
opendir(DHUP,$UP);
|
opendir(DHUP,$UP);
|
||||||
while (my $c=readdir(DHUP)) {
|
while (my $c=readdir(DHUP)) {
|
||||||
|
|
||||||
|
@ -56,33 +59,56 @@ while (my $c=readdir(DHUP)) {
|
||||||
my %SIZE=();
|
my %SIZE=();
|
||||||
|
|
||||||
foreach my $line (@lines) {
|
foreach my $line (@lines) {
|
||||||
$MD5{$1}=$2 if ($line=~/^MD5 \((.+?)\) = (.+?)$/);
|
if ($line=~/^MD5 \((.+?)\) = (.+?)$/) {
|
||||||
$SHA256{$1}=$2 if ($line=~/^SHA256 \((.+?)\) = (.+?)$/);
|
if (defined $MD5{$1}) {
|
||||||
$SIZE{$1}=$2 if ($line=~/^SIZE \((.+?)\) = (.+?)$/);
|
print "$c/$p - Duplicate MD5 for $1\n";
|
||||||
|
$errors++;
|
||||||
|
}
|
||||||
|
$MD5{$1}=$2;
|
||||||
|
}
|
||||||
|
if ($line=~/^SHA256 \((.+?)\) = (.+?)$/) {
|
||||||
|
if (defined $SHA256{$1}) {
|
||||||
|
print "$c/$p - Duplicate SHA256 for $1\n";
|
||||||
|
$errors++;
|
||||||
|
}
|
||||||
|
$SHA256{$1}=$2;
|
||||||
|
}
|
||||||
|
if ($line=~/^SIZE \((.+?)\) = (.+?)$/) {
|
||||||
|
if (defined $SIZE{$1}) {
|
||||||
|
print "$c/$p - Duplicate SIZE for $1\n";
|
||||||
|
$errors++;
|
||||||
|
}
|
||||||
|
$SIZE{$1}=$2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach my $f (sort(keys(%MD5))) {
|
foreach my $f (sort(keys(%MD5))) {
|
||||||
if (!defined ($SHA256{$f})) {
|
if (!defined ($SHA256{$f})) {
|
||||||
print "$c/$p - Missing SHA256 for $f\n";
|
print "$c/$p - Missing SHA256 for $f\n";
|
||||||
$SHA256{$f}="missing";
|
$SHA256{$f}="missing";
|
||||||
|
$errors++;
|
||||||
}
|
}
|
||||||
if ($MD5{$f} ne "IGNORE") {
|
if ($MD5{$f} ne "IGNORE") {
|
||||||
if (!defined ($SIZE{$f})) {
|
if (!defined ($SIZE{$f})) {
|
||||||
print "$c/$p - Missing SIZE for $f\n";
|
print "$c/$p - Missing SIZE for $f\n";
|
||||||
$SIZE{$f}="missing";
|
$SIZE{$f}="missing";
|
||||||
|
$errors++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$checked++;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach my $f (sort(keys(%SHA256))) {
|
foreach my $f (sort(keys(%SHA256))) {
|
||||||
if (!defined ($MD5{$f})) {
|
if (!defined ($MD5{$f})) {
|
||||||
print "$c/$p - Missing MD5 for $f\n";
|
print "$c/$p - Missing MD5 for $f\n";
|
||||||
$MD5{$f}="missing";
|
$MD5{$f}="missing";
|
||||||
|
$errors++;
|
||||||
}
|
}
|
||||||
if ($SHA256{$f} ne "IGNORE") {
|
if ($SHA256{$f} ne "IGNORE") {
|
||||||
if (!defined ($SIZE{$f})) {
|
if (!defined ($SIZE{$f})) {
|
||||||
print "$c/$p - Missing SIZE for $f\n";
|
print "$c/$p - Missing SIZE for $f\n";
|
||||||
$SIZE{$f}="missing";
|
$SIZE{$f}="missing";
|
||||||
|
$errors++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -91,10 +117,12 @@ while (my $c=readdir(DHUP)) {
|
||||||
if (!defined ($MD5{$f})) {
|
if (!defined ($MD5{$f})) {
|
||||||
print "$c/$p - Missing MD5 for $f\n";
|
print "$c/$p - Missing MD5 for $f\n";
|
||||||
$MD5{$f}="missing";
|
$MD5{$f}="missing";
|
||||||
|
$errors++;
|
||||||
}
|
}
|
||||||
if (!defined ($SHA256{$f})) {
|
if (!defined ($SHA256{$f})) {
|
||||||
print "$c/$p - Missing SHA256 for $f\n";
|
print "$c/$p - Missing SHA256 for $f\n";
|
||||||
$SHA256{$f}="missing";
|
$SHA256{$f}="missing";
|
||||||
|
$errors++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,3 +131,5 @@ while (my $c=readdir(DHUP)) {
|
||||||
closedir(DHUPC);
|
closedir(DHUPC);
|
||||||
}
|
}
|
||||||
closedir(DHUP);
|
closedir(DHUP);
|
||||||
|
|
||||||
|
print "Errors: $errors\nChecked: $checked\n";
|
||||||
|
|
Loading…
Add table
Reference in a new issue