From 9a7bf691299063f68cde150ae981f28b12b156ae Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Thu, 27 Apr 2017 08:51:00 +0000 Subject: tlmgr conf texmf auxtrees [add|remove|show] addition git-svn-id: svn://tug.org/texlive/trunk@44076 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/scripts/texlive/tlmgr.pl | 102 +++++++++++++++++++++++++++-- 1 file changed, 98 insertions(+), 4 deletions(-) (limited to 'Master/texmf-dist/scripts') diff --git a/Master/texmf-dist/scripts/texlive/tlmgr.pl b/Master/texmf-dist/scripts/texlive/tlmgr.pl index 042348e8438..dca8716a0c8 100755 --- a/Master/texmf-dist/scripts/texlive/tlmgr.pl +++ b/Master/texmf-dist/scripts/texlive/tlmgr.pl @@ -5513,7 +5513,7 @@ sub action_conf { } elsif ($arg !~ /^(tlmgr|texmf|updmap)$/) { warn "$prg: unknown conf arg: $arg (try tlmgr or texmf or updmap)\n"; - $ret = $F_ERROR; + return($F_ERROR); } else { my ($fn,$cf); @@ -5533,7 +5533,7 @@ sub action_conf { } else { die "Should not happen, conf arg=$arg"; } - my ($key,$val) = @ARGV; + my ($key,$val,$str) = @ARGV; if (!defined($key)) { # show all settings if ($cf) { @@ -5543,10 +5543,97 @@ sub action_conf { } } else { info("$arg config file $fn not present\n"); - $ret = $F_WARNING; + return($F_WARNING); } } else { - if (!defined($val)) { + if ($key eq "auxtrees") { + if ($arg eq "texmf") { + my $tmfa = 'TEXMFAUXTREES'; + my $tv = $cf->value($tmfa); + if ($val eq "show") { + if (defined($tv)) { + $tv =~ s/^\s*{//; + $tv =~ s/}\s*$//; + $tv =~ s/,$//; + my @foo = split(',', $tv); + print "List of auxiliary texmf trees:\n" if (@foo); + for my $f (@foo) { + print " $f\n"; + } + return($F_OK); + } else { + print "No auxilary texmf trees defined.\n"; + return($F_OK); + } + } elsif ($val eq "add") { + if (defined($str)) { + if (defined($tv)) { + $tv =~ s/^\s*{//; + $tv =~ s/}\s*$//; + $tv =~ s/,$//; + my @foo = split(',', $tv); + my @new; + my $already = 0; + for my $f (@foo) { + if ($f eq $str) { + print "Already registered auxtree: $str\n"; + return ($F_WARNING); + } else { + push @new, $f; + } + } + push @new, $str; + $cf->value($tmfa, '{' . join(',', @new) . ',}'); + } else { + $cf->value($tmfa, '{' . $str . ',}'); + } + } else { + warning("argument missing for auxtrees add\n"); + return($F_ERROR); + } + } elsif ($val eq "remove") { + if (defined($str)) { + if (defined($tv)) { + $tv =~ s/^\s*{//; + $tv =~ s/}\s*$//; + $tv =~ s/,$//; + my @foo = split(',', $tv); + my @new; + my $removed = 0; + for my $f (@foo) { + if ($f ne $str) { + push @new, $f; + } else { + $removed = 1; + } + } + if ($removed) { + if ($#new >= 0) { + $cf->value($tmfa, '{' . join(',', @new) . ',}'); + } else { + $cf->delete_key($tmfa); + } + } else { + print ("argument `$str' not defined as auxilary texmf tree\n"); + return($F_WARNING); + } + } else { + print "No auxilary texmf trees defined, nothing removed\n"; + return($F_WARNING); + } + } else { + warning("argument missing for auxtrees remove\n"); + return($F_ERROR); + } + } else { + warning("unknown operation on auxtrees: $val\n"); + return($F_ERROR); + } + } else { + warning("auxtrees not suitable for $arg\n"); + return($F_ERROR); + } + } elsif (!defined($val)) { if (defined($opts{'delete'})) { if (defined($cf->value($key))) { info("removing setting $arg $key value: " . $cf->value($key) . "from $fn\n"); @@ -5586,6 +5673,7 @@ sub action_conf { $cf->save; } } + return($ret); } # output various values in same form as texconfig conf. @@ -7026,6 +7114,7 @@ checking the TL development repository. =back =head2 conf [texmf|tlmgr|updmap [--conffile I] [--delete] [I [I]]] +=head2 conf texmf [--conffile I] auxtrees [show|add|delete] [I] With only C, show general configuration information for TeX Live, including active configuration files, path settings, and more. This is @@ -7045,6 +7134,11 @@ out). If I is given in addition, I is set to I in the respective file. I +For C there is a special key C which allows adding +and removing auxilary texmf trees. C shows the list +of additional trees, C I adds a tree to the list, +and C I removes a tree from the list (if present). + In all cases the file used can be explicitly specified via the option C<--conffile I>, in case one wants to operate on a different file. -- cgit v1.2.3