texlive[57093] Master/texmf-dist/scripts/texlive/tlmgr.pl: tlmgr:

commits+preining at tug.org commits+preining at tug.org
Tue Dec 8 15:41:33 CET 2020


Revision: 57093
          http://tug.org/svn/texlive?view=revision&revision=57093
Author:   preining
Date:     2020-12-08 15:41:33 +0100 (Tue, 08 Dec 2020)
Log Message:
-----------
tlmgr: clean up cached tlpdb files for the main databases

When the CTAN mirror is used, on every invocation the user might be
connected to a new mirror, thus accumulating cached tlpdbs for each
mirror URL. This doesn't make sense. Change the behaviour for the *main*
tlpdb only by:
- save the tlpdb cache under texlive.tlpdb.main.$HASH
- remove all but the current after saving a new cached main tlpdb

Modified Paths:
--------------
    trunk/Master/texmf-dist/scripts/texlive/tlmgr.pl

Modified: trunk/Master/texmf-dist/scripts/texlive/tlmgr.pl
===================================================================
--- trunk/Master/texmf-dist/scripts/texlive/tlmgr.pl	2020-12-08 00:55:09 UTC (rev 57092)
+++ trunk/Master/texmf-dist/scripts/texlive/tlmgr.pl	2020-12-08 14:41:33 UTC (rev 57093)
@@ -7065,7 +7065,9 @@
     # first check that the saved tlpdb is present at all
     my $loc_digest = TeXLive::TLCrypto::tl_short_digest($location);
     my $loc_copy_of_remote_tlpdb =
-      "$Master/$InfraLocation/texlive.tlpdb.$loc_digest";
+      ($is_main ? 
+        "$Master/$InfraLocation/texlive.tlpdb.main.$loc_digest" :
+        "$Master/$InfraLocation/texlive.tlpdb.$loc_digest");
     ddebug("loc_digest = $loc_digest\n");
     ddebug("loc_copy = $loc_copy_of_remote_tlpdb\n");
     if (-r $loc_copy_of_remote_tlpdb) {
@@ -7229,7 +7231,9 @@
   if (!$local_copy_tlpdb_used && $location =~ m;^(https?|ftp)://;) {
     my $loc_digest = TeXLive::TLCrypto::tl_short_digest($location);
     my $loc_copy_of_remote_tlpdb =
-      "$Master/$InfraLocation/texlive.tlpdb.$loc_digest";
+      ($is_main ? 
+        "$Master/$InfraLocation/texlive.tlpdb.main.$loc_digest" :
+        "$Master/$InfraLocation/texlive.tlpdb.$loc_digest");
     my $tlfh;
     if (!open($tlfh, ">:unix", $loc_copy_of_remote_tlpdb)) {
       # that should be only a debug statement, since a user without
@@ -7240,6 +7244,14 @@
       &debug("writing out tlpdb to $loc_copy_of_remote_tlpdb\n");
       $remotetlpdb->writeout($tlfh);
       close($tlfh);
+      # Remove all other copies of main databases in case different mirrors
+      # are used $Master/$InfraLocation/texlive.tlpdb.main.$loc_digest
+      if ($is_main) {
+        for my $fn (<"$Master/$InfraLocation/texlive.tlpdb.main.*">) {
+          next if ($fn eq $loc_copy_of_remote_tlpdb);
+          unlink($fn);
+        }
+      }
     }
   }
 



More information about the tex-live-commits mailing list.