summaryrefslogtreecommitdiff
path: root/Master/tlpkg/bin/tl-fix-container-infos
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-05-16 23:14:44 +0000
committerKarl Berry <karl@freefriends.org>2016-05-16 23:14:44 +0000
commitf5a1ebeb10595819710f0b07ca874f1f8236ea2b (patch)
tree1f1ac417c7a381a94bafb87107d2ba393c8523ba /Master/tlpkg/bin/tl-fix-container-infos
parent86289db1c13c60df7ae77e18b9196139cfefa316 (diff)
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
Diffstat (limited to 'Master/tlpkg/bin/tl-fix-container-infos')
-rwxr-xr-xMaster/tlpkg/bin/tl-fix-container-infos77
1 files changed, 50 insertions, 27 deletions
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<option>]...
=over 4
+=item B<-dry-run|-n>
+
+Don't write anything.
+
=item B<-location> I</container/dir>
-The directory of containers to be updated, usually with a previous set
-of containers to be compared against; default is C<.>.
+The directory of containers to be updated, requiring
+I</container/dir>C</tlpkg/texlive.tlpdb>, usually with a previous set of
+containers to be compared against; default is C<.>.
=item B<-no-setup>
@@ -169,8 +191,9 @@ pseudo-package C<00texlive.config>. See L<TeXLive::TLPDB>.
=head1 DESCRIPTION
-This program adds (or updates) {,src,doc}container{size,md5} entries for
-all packages found in the location given by C<--location> (default C<.>).
+This program adds or updates {,src,doc}container{size,checksum}
+directive entries for packages found in the TL location. Only packages
+without a previous C<containerchecksum> entry are updated.
=head1 AUTHORS AND COPYRIGHT