From d2160399e534a2ea9fba2b5af0e7ece4a5a88d54 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 19 Aug 2013 05:20:11 +0000 Subject: tl-merge-tlpdb: cleanup (md5sum file and .xz) after updating the tlpdb git-svn-id: svn://tug.org/texlive/trunk@31470 c570f23f-e606-0410-a88d-b1316a301751 --- Master/tlpkg/libexec/tl-merge-tlpdb | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Master/tlpkg/libexec/tl-merge-tlpdb b/Master/tlpkg/libexec/tl-merge-tlpdb index 75d7c2aef8d..0a52f10425b 100755 --- a/Master/tlpkg/libexec/tl-merge-tlpdb +++ b/Master/tlpkg/libexec/tl-merge-tlpdb @@ -32,14 +32,17 @@ use strict; use TeXLive::TLPDB; use TeXLive::TLPOBJ; use TeXLive::TLUtils qw(win32); +use Digest::MD5; use Getopt::Long qw(:config no_autoabbrev); use Pod::Usage; my $opt_save = 0; my $opt_help = 0; +my $opt_nocleanup = 0; GetOptions( "save" => \$opt_save, + "nocleanup" => \$opt_nocleanup, "help|h|?" => \$opt_help) or pod2usage(1); if ($opt_help) { @@ -84,6 +87,20 @@ for my $p ($sub_tlpdb->list_packages()) { if ($opt_save) { printf STDERR "overwriting main tlpdb ...\n"; $main_tlpdb->save(); + if (!$opt_nocleanup) { + # update the md5sum + my $ctx = Digest::MD5->new; + my $fh; + open $fh, "<$tlnetroot/tlpkg/texlive.tlpdb" or die("Cannot open tlpdb: $!"); + binmode $fh; + $ctx->addfile($fh); + open MDFILE, ">$tlnetroot/tlpkg/texlive.tlpdb.md5" or die ("Cannot open md5sum: $!"); + print MDFILE $ctx->hexdigest . " texlive.tlpdb\n"; + close MDFILE; + close $fh; + # we also have to remove the .xz file + unlink "$tlnetroot/tlpkg/texlive.tlpdb.xz"; + } } else { printf STDERR "writing generated tlpdb to stdout ...\n"; $main_tlpdb->writeout(); @@ -145,6 +162,16 @@ it can be captured and compared with the existing one. If one does not want to take this extra safety step, providing this options overwrites the tlpdb immediately. +=item B<-nocleanup> + +In case of B<-save> being present, by default, the script updates +the C file with the correct value, and also +removes the file C to facilitate easy integration +into a web service. + +Giving the option B<-nocleanup> prevents the script from executing +these steps. + =item B<-help>, B<--help>, B<-h>, B<-?> Display this help and exit. -- cgit v1.2.3