diff options
-rwxr-xr-x | Master/texmf/scripts/texlive/tlmgr.pl | 29 | ||||
-rw-r--r-- | Master/tlpkg/TeXLive/TLPDB.pm | 58 |
2 files changed, 79 insertions, 8 deletions
diff --git a/Master/texmf/scripts/texlive/tlmgr.pl b/Master/texmf/scripts/texlive/tlmgr.pl index 37ddfe81a1f..769b9e4aacc 100755 --- a/Master/texmf/scripts/texlive/tlmgr.pl +++ b/Master/texmf/scripts/texlive/tlmgr.pl @@ -4049,6 +4049,23 @@ sub action_platform { $localtlpdb->setting("available_architectures",@newarchs); $localtlpdb->save; } + } elsif ($what =~ m/^set$/i) { + return if !check_on_writable(); + my $arg = shift @ARGV; + die "Missing argument to platform set" unless defined($arg); + my @already_installed_arch = $localtlpdb->available_architectures; + if ($arg =~ m/^auto$/i) { + info("Setting platform detection to auto mode.\n"); + $localtlpdb->setting('-clear', 'platform'); + $localtlpdb->save; + } else { + if (!TeXLive::TLUtils::member($arg, @already_installed_arch)) { + tlwarn("cannot set platform to a not installed one.\n"); + return; + } + $localtlpdb->setting('platform', $arg); + $localtlpdb->save; + } } else { die "Unknown option for platform: $what"; } @@ -6438,6 +6455,10 @@ those extra settings at present. =head2 platform list|add|remove I<platform>... +=head2 platform set I<platform> + +=head2 platform set auto + C<platform list> lists the TeX Live names of all the platforms (a.k.a. architectures), (C<i386-linux>, ...) available at the package repository. @@ -6449,6 +6470,14 @@ C<platform remove> I<platform>... removes the executables for each given platform I<platform> from the installation, but keeps the currently running platform in any case. +C<platform set> I<platform> switches TeX Live to always use the given +platform instead of auto detection. + +C<platform set auto> switches TeX Live to auto detection mode for platform. + +Platform detection is needed to select the proper C<xz>, C<xzdec> and +C<wget> binaries that are shipped with TeX Live. + C<arch> is a synonym for C<platform>. Options: diff --git a/Master/tlpkg/TeXLive/TLPDB.pm b/Master/tlpkg/TeXLive/TLPDB.pm index 25cfb74b605..912aacfc8a4 100644 --- a/Master/tlpkg/TeXLive/TLPDB.pm +++ b/Master/tlpkg/TeXLive/TLPDB.pm @@ -69,6 +69,7 @@ C<TeXLive::TLPDB> -- A database of TeX Live Packages $tlpdb->add_default_options(); $tlpdb->settings; $tlpdb->setting($key, [$value]); + $tlpdb->setting([-clear], $key, [$value]); $tlpdb->sizes_of_packages($opt_src, $opt_doc, $ref_arch_list [, @packs ]); $tlpdb->install_package($pkg, $dest_tlpdb); $tlpdb->remove_package($pkg, %options); @@ -1874,17 +1875,53 @@ sub _set_value_pkg { $self->add_tlpobj($pkg); } -sub _option_value { +sub _clear_option { my $self = shift; - $self->_value_pkg('00texlive.installation', 'opt_', @_); + $self->_clear_pkg('00texlive.installation', 'opt_', @_); } -sub _setting_value { +sub _clear_setting { my $self = shift; - $self->_value_pkg('00texlive.installation', 'setting_', @_); + $self->_clear_pkg('00texlive.installation', 'setting_', @_); } -sub _value_pkg { +sub _clear_pkg { + my ($self,$pkgname,$pre,$key) = @_; + my $k = "$pre$key"; + my $pkg; + if ($self->is_virtual) { + $pkg = $self->{'tlpdbs'}{'main'}->get_package($pkgname); + } else { + $pkg = $self->{'tlps'}{$pkgname}; + } + my @newdeps; + if (!defined($pkg)) { + return; + } else { + foreach my $d ($pkg->depends) { + if ($d =~ m!^$k:!) { + # do nothing, we drop the value + } else { + push @newdeps, $d; + } + } + } + $pkg->depends(@newdeps); + $self->add_tlpobj($pkg); +} + + +sub _get_option_value { + my $self = shift; + $self->_get_value_pkg('00texlive.installation', 'opt_', @_); +} + +sub _get_setting_value { + my $self = shift; + $self->_get_value_pkg('00texlive.installation', 'setting_', @_); +} + +sub _get_value_pkg { my ($self,$pkg,$pre,$key) = @_; my $k = "$pre$key"; my $tlp; @@ -1910,7 +1947,7 @@ sub option_pkg { my $pkg = shift; my $key = shift; if (@_) { $self->_set_value_pkg($pkg, "opt_", $key, shift); } - my $ret = $self->_value_pkg($pkg, "opt_", $key); + my $ret = $self->_get_value_pkg($pkg, "opt_", $key); # special case for location == __MASTER__ if (defined($ret) && $ret eq "__MASTER__" && $key eq "location") { return $self->root; @@ -1921,7 +1958,7 @@ sub option { my $self = shift; my $key = shift; if (@_) { $self->_set_option_value($key, shift); } - my $ret = $self->_option_value($key); + my $ret = $self->_get_option_value($key); # special case for location == __MASTER__ if (defined($ret) && $ret eq "__MASTER__" && $key eq "location") { return $self->root; @@ -1956,6 +1993,11 @@ sub setting_pkg { sub setting { my $self = shift; my $key = shift; + if ($key eq "-clear") { + my $realkey = shift; + $self->_clear_setting($realkey); + return; + } if (@_) { if ($TLPDBSettings{$key}->[0] eq "l") { $self->_set_setting_value($key, "@_"); @@ -1963,7 +2005,7 @@ sub setting { $self->_set_setting_value($key, shift); } } - my $ret = $self->_setting_value($key); + my $ret = $self->_get_setting_value($key); # check the types of the settings, and if it is a "l" return a list if ($TLPDBSettings{$key}->[0] eq "l") { my @ret; |