IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 11, 2023, 11:00:58 AM (3 years ago)
Author:
eugene
Message:

fix little issues

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/eam/rawfix.20230221/src/check_md5s_dateobs.pl

    r42444 r42447  
    5959
    6060    # if these do not match, complain and move on
     61    # we are allowed to have more MD5s than instances: some instances
     62    # may have been culled during this process (but the MD5s stay behind)
    6163    my $N1 = @md5data;
    6264    my $N2 = @instdata;
    63     if ($N1 != $N2) {
    64         print STDOUT "inconsistent number of lines in $md5match : $N1 vs $N2\n";
     65    if ($N1 < $N2) {
     66        print STDOUT "not enough MD5s $md5match : $N1 vs $N2\n";
    6567        $Nfail ++;
    6668        next;
    6769    }
    6870
     71    # set up an empty hash for the instance names:
     72    my %instfound = ();
     73    foreach my $line (@instdata) {
     74        chomp $line;
     75        my @words = split (/\s+/,$line);
     76        my $inst   = $words[0];
     77        $instfound{$inst} = 0;
     78    }
     79
    6980    # check for mismatched MD5sums
     81    # we are not checking that all instances in the inst file are in the MD5 file
    7082    foreach my $line (@md5data) {
    7183
     
    8092        my $md5tru = $words[2];
    8193        my $md5obs = $words[3];
     94
     95        unless (defined $instfound{$inst}) { print "skip md5 for removed instance $inst\n"; next; }
     96        $instfound{$inst} = 1;
    8297
    8398        if ($md5tru ne $md5obs) {
     
    88103            if ($DEBUG > 2) { print STDOUT "$inst $state $md5tru = $md5obs\n"; }
    89104        }
     105    }
     106
     107    my @instfoundKEYS = keys %instfound;
     108    foreach my $inst (@instfoundKEYS) {
     109        unless ($instfound{$inst}) { die "missing MD5 for instance $inst\n"; }
    90110    }
    91111}
Note: See TracChangeset for help on using the changeset viewer.