From e1d7bc6930d3ce837f09bab60a9dcf1e891814db Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Sun, 12 Nov 2023 00:30:53 +0000 Subject: tlmgr: check for out-of-sync remote tlpdb In case the remote tlpdb is older than the last seen/used one, bail out. This can happen when mirrors are not in sync, and the CTAN multiplexer is used. This can lead to forcibly removed packages: - the multiplexer returned different servers in the two calls - the second mirror was still not synced and showed the db from before the new packages were introduced - tlmgr checks for "auto-removal" by looking at the collections and their respective dependencies (== packages), and if one package is available in the local version of the collection, but not in the remote one, then it will be tagged as auto-removal We use texlive-scripts to determine an approximation of last seen remote revision, since texlive-scripts is updated practically every day. Alternative approaches are documented in the code. git-svn-id: svn://tug.org/texlive/trunk@68818 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/scripts/texlive/tlmgr.pl | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/Master/texmf-dist/scripts/texlive/tlmgr.pl b/Master/texmf-dist/scripts/texlive/tlmgr.pl index db5753c0efa..4d8c49349f2 100755 --- a/Master/texmf-dist/scripts/texlive/tlmgr.pl +++ b/Master/texmf-dist/scripts/texlive/tlmgr.pl @@ -7340,6 +7340,32 @@ and the repository are not compatible: } } + # check for remote main db being *older* than what we have seen before + # The check we employ is heuristic: texlive-scripts is updated practically + # every day. We compare the locally installed texlive-scripts with the + # remove revision, and if that does not line up, we error out. + # Alternative approaches + # - loop over all installed packages and take the maximum of the found revisions + # - on every update, save the last seen remote main revision into 00texlive.installation + # + if ($is_main) { + my $remote_revision = $remotetlpdb->config_revision; + my $tlp = $localtlpdb->get_package("texlive-scripts"); + my $local_revision; + if (!defined($tlp)) { + info("texlive-scripts not found, not doing revision consistency check\n"); + $local_revision = 0; + } else { + $local_revision = $tlp->revision; + } + if ($local_revision > $remote_revision) { + info("fail load $location\n") if ($::machinereadable); + return(undef, "Remote database (rev $remote_revision) seems to be older than local (rev $local_revision), please use different mirror or wait a bit.") + } else { + debug("Remote database revision $remote_revision, texlive-scripts local revision $local_revision\n"); + } + } + # check for being frozen if ($remotetlpdb->config_frozen) { my $frozen_msg = <