diff options
-rwxr-xr-x | Master/texmf/scripts/texlive/tlmgr.pl | 40 | ||||
-rw-r--r-- | Master/tlpkg/TeXLive/TLPDB.pm | 22 |
2 files changed, 57 insertions, 5 deletions
diff --git a/Master/texmf/scripts/texlive/tlmgr.pl b/Master/texmf/scripts/texlive/tlmgr.pl index 50306395e49..e4dca67dea4 100755 --- a/Master/texmf/scripts/texlive/tlmgr.pl +++ b/Master/texmf/scripts/texlive/tlmgr.pl @@ -4211,15 +4211,45 @@ END_NO_INTERNET } die($loadmediasrcerror . $location) unless defined($tlmediasrc); $tlmediatlpdb = $tlmediasrc->tlpdb; - # if the release from the remote TLPDB does not agree with the - # TLConfig::ReleaseYear in the first 4 places break out here. + # we allow a range of years to be specified by the remote tlpdb + # for which it might work. + # the lower limit is TLPDB->config_release + # the upper limit is TLPDB->config_maxrelease + # if the later is not present only the year in config_release is accepted + # checks are done on the first 4 digits only # Why only the first four places: some optional network distributions # might use # release/2009-foobar + # If it should work for 2009 and 2010, please use + # release/2009-foobar + # maxrelease/2010-foobar my $texlive_release = $tlmediatlpdb->config_release; - if (!defined($texlive_release) || - $texlive_release !~ m/^$TeXLive::TLConfig::ReleaseYear/) { - die "The release version of the installation source and the installation media\ndo not agree: source: $texlive_release, media: $TeXLive::TLConfig::ReleaseYear\nPlease fix your location $location"; + my $texlive_maxrelease = $tlmediatlpdb->config_maxrelease; + if (!defined($texlive_release)) { + tldie "The installation repository does not specify a release year for which it was prepared, bailing out.\n"; + } + # still here, so we have $texlive_release defined + my $texlive_release_year =~ s/^(....).*$/$1/; + if ($texlive_release_year !~ m/^[1-9][0-9][0-9][0-9]$/) { + tldie "The installation repository does not specify a release year: $texlive_release, bailing out.\n"; + } + # so $texlive_release_year is numeric, good + if (defined($texlive_maxrelease)) { + # we specify a range of years! + my $texlive_maxrelease_year =~ s/^(....).*$/$1/; + if ($texlive_maxrelease_year !~ m/^[1-9][0-9][0-9][0-9]$/) { + tldie "The installation repository does not specify a valid maximal release year: $texlive_maxrelease, bailing out.\n"; + } + # ok, all numeric and fine, check for range + if ($TeXLive::TLConfig::ReleaseYear < $texlive_release_year || + $TeXLive::TLConfig::ReleaseYear > $texlive_maxrelease_year) { + tldie "The supported release range as specified by the repository ($texlive_release_year - $texlive_maxrelease_year)\ndoes not match the release version of the installation ($TeXLive::TLConfig::ReleaseYear), bailing out.\n"; + } + } else { + # $texlive_maxrelease not defined, so only one year is valid + if ($texlive_release_year != $TeXLive::TLConfig::ReleaseYear) { + tldie "The supported release as specified by the repository ($texlive_release_year)\ndoes not match the release version of the installation ($TeXLive::TLConfig::ReleaseYear), bailing out.\n"; + } } # check for being frozen diff --git a/Master/tlpkg/TeXLive/TLPDB.pm b/Master/tlpkg/TeXLive/TLPDB.pm index 5d3066bc8b3..27f3835b646 100644 --- a/Master/tlpkg/TeXLive/TLPDB.pm +++ b/Master/tlpkg/TeXLive/TLPDB.pm @@ -58,6 +58,7 @@ C<TeXLive::TLPDB> -- A database of TeX Live Packages $tlpdb->config_doc_container; $tlpdb->config_container_format; $tlpdb->config_release; + $tlpdb->config_maxrelease; $tlpdb->config_revision; $tlpdb->options; $tlpdb->option($key, [$value]); @@ -940,6 +941,27 @@ sub config_release { =pod +=item C<< $tlpdb->config_maxrelease >> + +Returns the currently allowed maximal release. See Options below. + +=cut + +sub config_maxrelease { + my $self = shift; + if (defined($self->{'tlps'}{'00texlive.config'})) { + foreach my $d ($self->{'tlps'}{'00texlive.config'}->depends) { + if ($d =~ m!^maxrelease/(.*)$!) { + return "$1"; + } + } + } + return; +} + + +=pod + =item C<< $tlpdb->config_revision >> Returns the currently set revision. See Options below. |