texlive[44076] Master/texmf-dist/scripts/texlive/tlmgr.pl: tlmgr conf

commits+preining at tug.org commits+preining at tug.org
Thu Apr 27 10:51:00 CEST 2017


Revision: 44076
          http://tug.org/svn/texlive?view=revision&revision=44076
Author:   preining
Date:     2017-04-27 10:51:00 +0200 (Thu, 27 Apr 2017)
Log Message:
-----------
tlmgr conf texmf auxtrees [add|remove|show] addition

Modified Paths:
--------------
    trunk/Master/texmf-dist/scripts/texlive/tlmgr.pl

Modified: trunk/Master/texmf-dist/scripts/texlive/tlmgr.pl
===================================================================
--- trunk/Master/texmf-dist/scripts/texlive/tlmgr.pl	2017-04-27 08:31:00 UTC (rev 44075)
+++ trunk/Master/texmf-dist/scripts/texlive/tlmgr.pl	2017-04-27 08:51:00 UTC (rev 44076)
@@ -5513,7 +5513,7 @@
 
   } 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 @@
     } 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 @@
         }
       } 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 @@
       $cf->save;
     }
   }
+  return($ret);
 }
 
 # output various values in same form as texconfig conf.
@@ -7026,6 +7114,7 @@
 =back
 
 =head2 conf [texmf|tlmgr|updmap [--conffile I<file>] [--delete] [I<key> [I<value>]]]
+=head2 conf texmf [--conffile I<file>] auxtrees [show|add|delete] [I<value>]
 
 With only C<conf>, show general configuration information for TeX Live,
 including active configuration files, path settings, and more.  This is
@@ -7045,6 +7134,11 @@
 If I<value> is given in addition, I<key> is set to I<value> in the 
 respective file.  I<No error checking is done!>
 
+For C<texmf> there is a special key C<auxtrees> which allows adding 
+and removing auxilary texmf trees. C<auxtrees show> shows the list
+of additional trees, C<texmf add> I<tree> adds a tree to the list,
+and C<auxtrees remove> I<tree> removes a tree from the list (if present).
+
 In all cases the file used can be explicitly specified via the option
 C<--conffile I<file>>, in case one wants to operate on a different file.
 



More information about the tex-live-commits mailing list