From f5a1ebeb10595819710f0b07ca874f1f8236ea2b Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 16 May 2016 23:14:44 +0000 Subject: tl-fix-container-infos: update for "checksum" instead of md5. setup_checksum_method. only update needed packages, instead of all. run on pretest area. tl-update-containers: setup_checksum_method. Original report at http://tug.org/pipermail/tex-live/2016-May/038508.html. 40+ packages were missing checksums, not just the new updmap-map. git-svn-id: svn://tug.org/texlive/trunk@41209 c570f23f-e606-0410-a88d-b1316a301751 --- Master/tlpkg/bin/tl-fix-container-infos | 77 +++++++++++++++++++++------------ Master/tlpkg/bin/tl-update-containers | 55 +++++++++++++---------- 2 files changed, 81 insertions(+), 51 deletions(-) (limited to 'Master') diff --git a/Master/tlpkg/bin/tl-fix-container-infos b/Master/tlpkg/bin/tl-fix-container-infos index f5c80de6915..e09c9dac173 100755 --- a/Master/tlpkg/bin/tl-fix-container-infos +++ b/Master/tlpkg/bin/tl-fix-container-infos @@ -23,6 +23,7 @@ use Pod::Usage; use File::Path; our ($mydir, $vc_id); +my $opt_dry_run = 0; my $opt_location = "."; my $opt_nosetup = 0; my $opt_version = 0; @@ -30,6 +31,7 @@ my $opt_help = 0; TeXLive::TLUtils::process_logging_options(); GetOptions( + "dry-run|n" => \$opt_dry_run, "location=s" => \$opt_location, "no-setup" => \$opt_nosetup, "version" => \$opt_version, @@ -46,13 +48,16 @@ sub main { # check that we have a target db. if (! -r "$opt_location/tlpkg/texlive.tlpdb") { - die "$0: Cannot load tlpdb from output directory $opt_location" + die "no file $opt_location/tlpkg/texlive.tlpdb"; } # get source db, same hierarchy from which we are being run. my $tlpdb = TeXLive::TLPDB->new("root" => $opt_location); - die "cannot find tlpdb in $opt_location" unless defined($tlpdb); - my @packs = $tlpdb->list_packages; + die "cannot load tlpdb from root=$opt_location" unless defined($tlpdb); + + if (! TeXLive::TLCrypto::setup_checksum_method()) { + die "TLCrypto::setup_checksum_method() failed"; + } # get configuration of package splitting my $srcsplit = $tlpdb->config_src_container; @@ -80,48 +85,60 @@ sub main { } # get list of packages. - PACKS: for my $pkg (sort $tlpdb->list_packages) { + for my $pkg (sort $tlpdb->list_packages) { next if $pkg =~ /00texlive/; my $obj = $tlpdb->get_package ($pkg); die "no package $pkg in master $Master, goodbye" if ! $obj; - #debug("updating $pkg containers ...\n"); - info("updating $pkg containers ...\n"); - $obj = do_containers($obj, $srcsplit, $docsplit); - # replace with the new one where md5sum and size is changed - $tlpdb->add_tlpobj($obj); + debug("doing $pkg containers ...\n"); + my $newobj = do_containers($obj, $srcsplit, $docsplit); + # replace with the new one with checksum and size changed, if needed + $tlpdb->add_tlpobj($newobj || $obj); } - $tlpdb->save; - system("xz --force -k -z $opt_location/tlpkg/texlive.tlpdb"); - + if (! $opt_dry_run) { + $tlpdb->save; + xsystem("xz --force -k -z $opt_location/tlpkg/texlive.tlpdb"); + } + return 0; } - + sub do_containers { my ($obj, $dosrc, $dodoc) = @_; + my $name = $obj->name; + my $csize = $obj->containersize; + my $csum = $obj->containerchecksum; + return undef if $csize && $csum; + info ("updating $name ($csize, no checksum)\n"); + my $fbase = "$opt_location/archive/" . $obj->name; - my ($a, $b) = do_size_md ("${fbase}.tar.xz"); + my ($a, $b) = do_size_checksum ("${fbase}.tar.xz"); $obj->containersize($a); - $obj->containermd5($b); + $obj->containerchecksum($b); + # + # if no main checksum, almost certainly need to update src/doc too. if ($dosrc && $obj->srcfiles) { - ($a, $b) = do_size_md ("${fbase}.source.tar.xz"); + ($a, $b) = do_size_checksum ("${fbase}.source.tar.xz"); $obj->srccontainersize($a); - $obj->srccontainermd5($b); + $obj->srccontainerchecksum($b); } + # if ($dodoc && $obj->docfiles) { - ($a, $b) = do_size_md ("${fbase}.doc.tar.xz"); + ($a, $b) = do_size_checksum ("${fbase}.doc.tar.xz"); $obj->doccontainersize($a); - $obj->doccontainermd5($b); + $obj->doccontainerchecksum($b); } - return($obj); + return $obj; } -sub do_size_md { +# computation of size/checksum values. +# +sub do_size_checksum{ my $f = shift; my $size = (stat $f)[7]; - my $md = TeXLive::TLCrypto::tlmd5($f); + my $md = TeXLive::TLCrypto::tlchecksum($f); return($size, $md); } @@ -129,7 +146,7 @@ __END__ =head1 NAME -tl-fix-container-infos - updates/adds size and md5 info for the containers +tl-fix-container-infos - updates or adds size and checksum for containers =head1 SYNOPSIS @@ -139,10 +156,15 @@ tl-fix-container-infos [I