diff options
Diffstat (limited to 'Master/tlpkg')
-rwxr-xr-x | Master/tlpkg/bin/tl-fix-container-infos | 77 | ||||
-rwxr-xr-x | Master/tlpkg/bin/tl-update-containers | 55 |
2 files changed, 81 insertions, 51 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 diff --git a/Master/tlpkg/bin/tl-update-containers b/Master/tlpkg/bin/tl-update-containers index cb993da04f6..0bab6ba2d17 100755 --- a/Master/tlpkg/bin/tl-update-containers +++ b/Master/tlpkg/bin/tl-update-containers @@ -30,27 +30,27 @@ my @critical_pkg_list = qw/texlive\.infra tlperl\.win32/; our ($mydir, $vc_id); my $opt_all = 0; +my $opt_dry = 0; +my $opt_gpgcmd = ""; my $opt_location = "."; +my $opt_master; my $opt_nosetup = 0; my $opt_recreate = 0; my $opt_relative = 1; my $opt_version = 0; my $opt_help = 0; -my $opt_dry = 0; -my $opt_gpgcmd = ""; -my $opt_master; TeXLive::TLUtils::process_logging_options(); GetOptions( "all|a" => \$opt_all, - "dry-run" => \$opt_dry, + "dry-run|n" => \$opt_dry, + "gpgcmd=s" => \$opt_gpgcmd, "location=s" => \$opt_location, + "master=s" => \$opt_master, "no-setup" => \$opt_nosetup, "recreate" => \$opt_recreate, "relative!" => \$opt_relative, "version" => \$opt_version, - "master=s" => \$opt_master, - "gpgcmd=s" => \$opt_gpgcmd, "help|?" => \$opt_help) or pod2usage(1); pod2usage("-exitstatus" => 0, "-verbose" => 2) if $opt_help; @@ -59,8 +59,7 @@ if ($opt_version) { print "$vc_id\n"; exit 0; } exit (&main()); -sub main -{ +sub main { # check that we have a target db. if (! $opt_recreate && ! -r "$opt_location/tlpkg/texlive.tlpdb") { die "$0: Cannot load tlpdb from output directory $opt_location;\n" @@ -80,12 +79,16 @@ sub main $opt_gpgcmd = "$script_master/tlpkg/bin/tl-sign-file"; } + if (! TeXLive::TLCrypto::setup_checksum_method()) { + die "TLCrypto::setup_checksum_method() failed"; + } + # get configuration of package splitting my $srcsplit = $tlpdb->config_src_container; my $docsplit = $tlpdb->config_doc_container; my $format = $tlpdb->config_container_format; my $type = "xz"; - if ($format eq "xz" || $format eq "zip") { + if ($format eq "xz") { $type = $format; } else { tlwarn("$0: unknown container format $format in 00texlive.config; ", @@ -168,7 +171,7 @@ sub main } if ($oldrev == $newrev) { - debug("$pkg up to date\n"); + ddebug("$pkg up to date\n"); # check for the existence of all containers in case they go missing if (($tlp->runfiles && ! -r "$opt_containerdir/$pkg.tar.$type") || ($srcsplit && $tlp->srcfiles @@ -269,13 +272,13 @@ sub main last; } } - my $do_relative = 0; - debug("pkg=$pkg deps_on_arch=$deps_on_arch, ctt=", defined($ctt)?$ctt:"(undefined)", "\n"); - $do_relative = $opt_relative && # user option + my $do_relative = $opt_relative && # user option ($deps_on_arch?0:1) && # no $pkg.ARCH dep (defined($ctt)?1:0) && # see above (($ctt eq $TeXLive::TLConfig::RelocTree) ? 1 : 0); # only for texmf-dist + debug("pkg=$pkg, do_relative=$do_relative, deps_on_arch=$deps_on_arch, " + . "ctt=", defined($ctt) ? $ctt : "(undefined)", "\n"); if ($srcsplit) { if (!$opt_dry) { my $objsrc = $obj->srcfiles_package; @@ -436,6 +439,16 @@ tl-update-containers [I<option>]... =over 4 +=item B<-all|-a> + +Include packages deemed critical in the update, currently +C<texlive.infra>. (That is, C<tlmgr> itself needs +testing before updating, so we don't do it by default.) + +=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 @@ -445,17 +458,6 @@ of containers to be compared against; default is C<./archive>. The directory from which containers should be updated. -=item B<-recreate> - -Forces rebuild of all containers, including creation of the output -C<texlive.tlpdb> if need be. - -=item B<-all|-a> - -Include packages deemed critical in the update, currently -C<texlive.infra>. (That is, C<tlmgr> itself needs -testing before updating, so we don't do it by default.) - =item B<-no-relative> Do not create any relocatable packages. @@ -465,6 +467,11 @@ Do not create any relocatable packages. Do not try to use the TL version of our basic programs such as I<xz> and I<tar>, but instead looks for them in the current path. +=item B<-recreate> + +Forces rebuild of all containers, including creation of the output +C<texlive.tlpdb> if need be. + =item B<--help> Display this documentation and exit. |