diff options
author | Norbert Preining <preining@logic.at> | 2020-12-08 14:41:33 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2020-12-08 14:41:33 +0000 |
commit | ed5ab9626fff6ae2b04f14688deebae5aa7d9d29 (patch) | |
tree | 0e86a312dab4cd8fb5a5020a508140519735ea04 | |
parent | 6ee78d430e09775f4258500f1c6dd350985fdb87 (diff) |
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
git-svn-id: svn://tug.org/texlive/trunk@57093 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-x | Master/texmf-dist/scripts/texlive/tlmgr.pl | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/Master/texmf-dist/scripts/texlive/tlmgr.pl b/Master/texmf-dist/scripts/texlive/tlmgr.pl index 7ec02aee354..657754827fd 100755 --- a/Master/texmf-dist/scripts/texlive/tlmgr.pl +++ b/Master/texmf-dist/scripts/texlive/tlmgr.pl @@ -7065,7 +7065,9 @@ sub setup_one_remotetlpdb { # 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 @@ FROZEN 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 @@ FROZEN &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); + } + } } } |