diff options
author | Norbert Preining <preining@logic.at> | 2016-04-14 06:55:54 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2016-04-14 06:55:54 +0000 |
commit | 2abaa407a905ec07fcb9eece96f7b7765622157b (patch) | |
tree | 66531d776893bff20f920636c3fc26f8eaff7f38 | |
parent | c085268dbffac7fb6e70e507c938e7c01bd8557d (diff) |
update check consistency script to work with new checksums
git-svn-id: svn://tug.org/texlive/trunk@40498 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-x | Master/tlpkg/bin/check-tlnet-consistency | 53 |
1 files changed, 30 insertions, 23 deletions
diff --git a/Master/tlpkg/bin/check-tlnet-consistency b/Master/tlpkg/bin/check-tlnet-consistency index aed59e1e138..5e83a991daf 100755 --- a/Master/tlpkg/bin/check-tlnet-consistency +++ b/Master/tlpkg/bin/check-tlnet-consistency @@ -1,5 +1,5 @@ #!/usr/bin/env perl -# Copyright 2008, 2009 Norbert Preining +# Copyright 2008-2016 Norbert Preining # This file is licensed under the GNU General Public License version 2 # or any later version. # @@ -64,7 +64,7 @@ sub main { } # get our db, same hierarchy from which we are being run. - my $tlpdb = TeXLive::TLPDB->new("root" => $opt_location); + my $tlpdb = TeXLive::TLPDB->new("root" => $opt_location, 'verify' => 1); die "Cannot init tlpdb from $opt_location ..." unless defined($tlpdb); my $tempbase = "$opt_location/temp"; if (! -d $tempbase) { @@ -81,6 +81,7 @@ sub main { my %filedifferrors; foreach my $pkg ($tlpdb->list_packages()) { next if ($pkg =~ m/^00texlive/); + debug("working on $pkg\n"); my $cont = "$opt_location/archive/$pkg.tar.xz"; my $srccont = "$opt_location/archive/$pkg.source.tar.xz"; my $doccont = "$opt_location/archive/$pkg.doc.tar.xz"; @@ -93,6 +94,7 @@ sub main { system("cat $cont | $::progs{xzdec} | $::progs{tar} -C \"$temp\" -xf - tlpkg/tlpobj"); } if (! -r "$temp/tlpkg/tlpobj/$pkg.tlpobj") { + debug("ERROR: no tlpobj\n"); push @notlpobj, $pkg; } else { my $tartlpobj = TeXLive::TLPOBJ->new; @@ -103,6 +105,7 @@ sub main { system("cat $srccont | $::progs{xzdec} | $::progs{tar} -C \"$temp\" -xf - tlpkg/tlpobj"); if (! -r "$temp/tlpkg/tlpobj/$pkg.source.tlpobj") { push @missingsrccontainer, $pkg; + debug("ERROR: missing src container\n"); } else { my $srctlpobj = TeXLive::TLPOBJ->new; $srctlpobj->from_file("$temp/tlpkg/tlpobj/$pkg.source.tlpobj"); @@ -114,6 +117,7 @@ sub main { system("cat $doccont | $::progs{xzdec} | $::progs{tar} -C \"$temp\" -xf - tlpkg/tlpobj"); if (! -r "$temp/tlpkg/tlpobj/$pkg.doc.tlpobj") { push @missingdoccontainer, $pkg; + debug("ERROR: missing doc container\n"); } else { my $doctlpobj = TeXLive::TLPOBJ->new; $doctlpobj->from_file("$temp/tlpkg/tlpobj/$pkg.doc.tlpobj"); @@ -130,22 +134,25 @@ sub main { my @b = $tartlpobj->all_files; my @ret = compare_lists(\@a, \@b); push @{$filedifferrors{$pkg}}, @ret if @ret; - # check the file sizes and md5sums - my $c = check_size_md($cont, $tlpdbtlpobj->containersize, - $tlpdbtlpobj->containermd5); - push @sizeerror, "$pkg (" . ($c == 1 ? "size" : "md5") . ")" + # check the file sizes and checksums + my $c = check_size_checksum($cont, $tlpdbtlpobj->containersize, + $tlpdbtlpobj->containerchecksum); + push @sizeerror, "$pkg (" . ($c == 1 ? "size" : "checksum") . ")" if ($c > 0); + debug("ERROR: size/checksum error main\n") if ($c > 0); if ($dodoc) { - my $c = check_size_md($doccont, $tlpdbtlpobj->doccontainersize, - $tlpdbtlpobj->doccontainermd5); - push @sizeerror, "$pkg.doc (" . ($c == 1 ? "size" : "md5") . ")" + my $c = check_size_checksum($doccont, $tlpdbtlpobj->doccontainersize, + $tlpdbtlpobj->doccontainerchecksum); + push @sizeerror, "$pkg.doc (" . ($c == 1 ? "size" : "checksum") . ")" if ($c > 0); + debug("ERROR: size/checksum error doc\n") if ($c > 0); } if ($dosrc) { - my $c = check_size_md($srccont, $tlpdbtlpobj->srccontainersize, - $tlpdbtlpobj->srccontainermd5); - push @sizeerror, "$pkg.source (" . ($c == 1 ? "size" : "md5") . ")" + my $c = check_size_checksum($srccont, $tlpdbtlpobj->srccontainersize, + $tlpdbtlpobj->srccontainerchecksum); + push @sizeerror, "$pkg.source (" . ($c == 1 ? "size" : "checksum") . ")" if ($c > 0); + debug("ERROR: size/checksum error src\n") if ($c > 0); } # check the actually included files are correct # TODO TODO TODO @@ -190,7 +197,7 @@ sub main { } } if (@sizeerror) { - print "packages with wrong container size/md5s:\n"; + print "packages with wrong container size/checksums:\n"; for my $p (@sizeerror) { print "$p\n"; } @@ -219,30 +226,30 @@ sub compare_lists { return(@ret); } -sub check_size_md { - my ($cont, $size, $md) = @_; +sub check_size_checksum { + my ($cont, $size, $checksum) = @_; my $sizeerror = 0; - my $mderror = 0; + my $checksumerror = 0; if ($size > -1) { my $s = (stat $cont)[7]; if ($s == $size) { - if ($md) { - if (TeXLive::TLUtils::tlmd5($cont) ne $md) { - $mderror = 1; + if ($checksum) { + if (TeXLive::TLUtils::tlchecksum($cont) ne $checksum) { + $checksumerror = 1; } } } else { $sizeerror = 1; } } else { - if ($md) { - if (tlmd5($cont) ne $md) { - $mderror = 1; + if ($checksum) { + if (tlchecksum($cont) ne $checksum) { + $checksumerror = 1; } } } return 1 if $sizeerror; - return 2 if $mderror; + return 2 if $checksumerror; return 0; } |