From df252b8786e00f972b77772ae6b7b4ddde4e1da0 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Thu, 31 Jan 2013 00:45:52 +0000 Subject: implement tlmgr platform set git-svn-id: svn://tug.org/texlive/trunk@28995 c570f23f-e606-0410-a88d-b1316a301751 --- Master/tlpkg/TeXLive/TLPDB.pm | 58 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 50 insertions(+), 8 deletions(-) (limited to 'Master/tlpkg') 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 -- 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; -- cgit v1.2.3