summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2013-08-19 05:20:11 +0000
committerNorbert Preining <preining@logic.at>2013-08-19 05:20:11 +0000
commitd2160399e534a2ea9fba2b5af0e7ece4a5a88d54 (patch)
treecb00dbc98ce09e3e907cf3220ecd75944c2d7ea1
parent09498a403f10f5aa0d16fba75f24a428c4daf393 (diff)
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
-rwxr-xr-xMaster/tlpkg/libexec/tl-merge-tlpdb27
1 files changed, 27 insertions, 0 deletions
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<texlive.tlpdb.md5> file with the correct value, and also
+removes the file C<texlive.tlpdb.xz> 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.