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

commits+preining at tug.org commits+preining at tug.org
Thu May 4 09:21:24 CEST 2017


Revision: 44186
          http://tug.org/svn/texlive?view=revision&revision=44186
Author:   preining
Date:     2017-05-04 09:21:23 +0200 (Thu, 04 May 2017)
Log Message:
-----------
tlmgr conf texmf auxtrees => tlmgr conf auxtrees

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-05-04 00:06:52 UTC (rev 44185)
+++ trunk/Master/texmf-dist/scripts/texlive/tlmgr.pl	2017-05-04 07:21:23 UTC (rev 44186)
@@ -5519,8 +5519,8 @@
   if (!defined($arg)) {
     texconfig_conf_mimic();
 
-  } elsif ($arg !~ /^(tlmgr|texmf|updmap)$/) {
-    warn "$prg: unknown conf arg: $arg (try tlmgr or texmf or updmap)\n";
+  } elsif ($arg !~ /^(tlmgr|texmf|updmap|auxtrees)$/) {
+    warn "$prg: unknown conf arg: $arg (try tlmgr or texmf or updmap or auxtrees)\n";
     return($F_ERROR);
 
   } else {
@@ -5532,7 +5532,7 @@
       chomp (my $TEXMFCONFIG = `kpsewhich -var-value=TEXMFCONFIG`);
       $fn || ( $fn = "$TEXMFCONFIG/tlmgr/config" ) ;
       $cf = TeXLive::TLConfFile->new($fn, "#", "=");
-    } elsif ($arg eq "texmf") {
+    } elsif ($arg eq "texmf" || $arg eq "auxtrees") {
       $fn || ( $fn = "$Master/texmf.cnf" ) ;
       $cf = TeXLive::TLConfFile->new($fn, "[%#]", "=");
     } elsif ($arg eq "updmap") {
@@ -5541,9 +5541,13 @@
     } else {
       die "Should not happen, conf arg=$arg";
     }
-    my ($key,$val,$str) = @ARGV;
+    my ($key,$val) = @ARGV;
+    # make sure that in case of tlmgr conf auxtrees (without anything else)
+    # we add the "show" argument which makes it easier to do stuff.
+    $key = "show" if ($arg eq "auxtrees" && !defined($key));
+
     if (!defined($key)) {
-      # show all settings
+      # show all settings (not auxtrees case!)
       if ($cf) {
         info("$arg configuration values (from $fn):\n");
         for my $k ($cf->keys) {
@@ -5554,92 +5558,87 @@
         return($F_WARNING);
       }
     } else {
-      if ($key eq "auxtrees") {
-        if ($arg eq "texmf") {
-          my $tmfa = 'TEXMFAUXTREES';
-          my $tv = $cf->value($tmfa);
-          if (!$val || $val eq "show") {
+      if ($arg eq "auxtrees") {
+        my $tmfa = 'TEXMFAUXTREES';
+        my $tv = $cf->value($tmfa);
+        if (!$key || $key 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 "$prg: no auxiliary texmf trees defined.\n";
+            return($F_OK);
+          }
+        } elsif ($key eq "add") {
+          if (defined($val)) {
             if (defined($tv)) {
               $tv =~ s/^\s*//;
               $tv =~ s/\s*$//;
               $tv =~ s/,$//;
               my @foo = split(',', $tv);
-              print "List of auxiliary texmf trees:\n" if (@foo);
+              my @new;
+              my $already = 0;
               for my $f (@foo) {
-                print "  $f\n";
+                if ($f eq $val) {
+                  tlwarn("$prg: already registered auxtree: $val\n");
+                  return ($F_WARNING);
+                } else {
+                  push @new, $f;
+                }
               }
-              return($F_OK);
+              push @new, $val;
+              $cf->value($tmfa, join(',', @new) . ',');
             } else {
-              print "$prg: no auxiliary texmf trees defined.\n";
-              return($F_OK);
+              $cf->value($tmfa, $val . ',');
             }
-          } 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) {
-                    tlwarn("$prg: already registered auxtree: $str\n");
-                    return ($F_WARNING);
-                  } else {
-                    push @new, $f;
-                  }
+          } else {
+            tlwarn("$prg: missing argument for auxtrees add\n");
+            return($F_ERROR);
+          }
+        } elsif ($key eq "remove") {
+          if (defined($val)) {
+            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 $val) {
+                  push @new, $f;
+                } else {
+                  $removed = 1;
                 }
-                push @new, $str;
-                $cf->value($tmfa, join(',', @new) . ',');
-              } else {
-                $cf->value($tmfa, $str . ',');
               }
-            } else {
-              tlwarn("$prg: missing argument 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);
-                  }
+              if ($removed) {
+                if ($#new >= 0) {
+                  $cf->value($tmfa, join(',', @new) . ',');
                 } else {
-                  tlwarn("$prg: not defined as auxiliary texmf tree: $str\n");
-                  return($F_WARNING);
+                  $cf->delete_key($tmfa);
                 }
               } else {
-                tlwarn("$prg: no auxiliary texmf trees defined, "
-                       . "so nothing removed\n");
+                tlwarn("$prg: not defined as auxiliary texmf tree: $val\n");
                 return($F_WARNING);
               }
             } else {
-              tlwarn("$prg: missing argument for auxtrees remove\n");
-              return($F_ERROR);
+              tlwarn("$prg: no auxiliary texmf trees defined, "
+                     . "so nothing removed\n");
+              return($F_WARNING);
             }
           } else {
-            tlwarn("$prg: unknown auxtrees operation: $val\n");
+            tlwarn("$prg: missing argument for auxtrees remove\n");
             return($F_ERROR);
           }
         } else {
-          tlwarn("$prg: auxtrees not suitable for $arg\n");
+          tlwarn("$prg: unknown auxtrees operation: $key\n");
           return($F_ERROR);
         }
       } elsif (!defined($val)) {
@@ -7134,7 +7133,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>]
+=head2 conf auxtrees [--conffile I<file>] [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
@@ -7159,16 +7158,16 @@
   
   tlmgr conf texmf shell_escape 0
 
-For C<texmf>, an additional subcommand C<auxtrees> allows adding and
+The sub-command C<auxtrees> allows adding and
 removing arbitrary additional texmf trees, completely under user
-control.  C<texmf auxtrees show> shows the list of additional trees,
-C<texmf auxtrees add> I<tree> adds a tree to the list, and C<texmf
-auxtrees remove> I<tree> removes a tree from the list (if present). The
+control.  C<auxtrees show> shows the list of additional trees,
+C<auxtrees add> I<tree> adds a tree to the list, and 
+C<auxtrees remove> I<tree> removes a tree from the list (if present). The
 trees should not contain an C<ls-R> file. This works by manipulating the
 Kpathsea variable C<TEXMFAUXTREES>, in C<ROOT/texmf.cnf>.  Example:
 
-  tlmgr conf texmf auxtrees add /quick/test/tree
-  tlmgr conf texmf auxtrees remove /quick/test/tree
+  tlmgr conf auxtrees add /quick/test/tree
+  tlmgr conf auxtrees remove /quick/test/tree
 
 In all cases the configuration file can be explicitly specified via the
 option C<--conffile> I<file>, if desired.



More information about the tex-live-commits mailing list