texlive[53225] Master: tlmgr.pl (check_texmfdbs): make silent if no

commits+karl at tug.org commits+karl at tug.org
Tue Dec 24 20:19:03 CET 2019


Revision: 53225
          http://tug.org/svn/texlive?view=revision&revision=53225
Author:   karl
Date:     2019-12-24 20:19:02 +0100 (Tue, 24 Dec 2019)
Log Message:
-----------
tlmgr.pl (check_texmfdbs): make silent if no problems; don't worry if a
  directory in TEXMFDBS does not exist; accept only the exact check item
  names except for leading/trailing whitespace; document.
(main): report the contents of the $::tldownload_server hash, not just
  its address.

TLUtils.pm (debug_hash_str): new fn, split from debug_hash. @EXPORT it.
(setup_system_one): ddebug the "trying" msg to reduce -v verbosity.

Modified Paths:
--------------
    trunk/Master/texmf-dist/scripts/texlive/tlmgr.pl
    trunk/Master/tlpkg/TeXLive/TLUtils.pm

Modified: trunk/Master/texmf-dist/scripts/texlive/tlmgr.pl
===================================================================
--- trunk/Master/texmf-dist/scripts/texlive/tlmgr.pl	2019-12-24 17:17:26 UTC (rev 53224)
+++ trunk/Master/texmf-dist/scripts/texlive/tlmgr.pl	2019-12-24 19:19:02 UTC (rev 53225)
@@ -676,7 +676,10 @@
   if (!defined($::tldownload_server)) {
     debug("tlmgr:main: ::tldownload_server not defined\n");
   } else {
-    debug("tlmgr:main: ::tldownload_server defined: $::tldownload_server\n");
+    if ($::opt_verbosity >= 1) {
+      debug(debug_hash_str("$prg:main: ::tldownload_server hash:",
+                            $::tldownload_server));
+    }
   }
 
   my $ret = execute_action($action, @ARGV);
@@ -5343,31 +5346,34 @@
   my $svn = defined($opts{"use-svn"}) ? $opts{"use-svn"} : 0;
   my $what = shift @ARGV;
   $what || ($what = "all");
+  $what =~ s/^ *//;
+  $what =~ s/ *$//;
   init_local_db();
   my $ret = 0;
-  if ($what =~ m/^all/i) {
+  if ($what =~ m/^all$/i) {
     my $tltree = init_tltree($svn);
     print "Running check files:\n";        $ret |= check_files($tltree);
     print "Running check depends:\n";      $ret |= check_depends();
     print "Running check executes:\n";     $ret |= check_executes();
     print "Running check runfiles:\n";     $ret |= check_runfiles();
-    print "Running check texmfdb paths\n"; $ret |= check_texmfdbs();
-  } elsif ($what =~ m/^files/i) {
+    print "Running check texmfdbs\n";      $ret |= check_texmfdbs();
+  } elsif ($what =~ m/^files$/i) {
     my $tltree = init_tltree($svn);
     $ret |= check_files($tltree);
-  } elsif ($what =~ m/^collections/i) {
-    tlwarn("$prg: the \"collections\" check is replaced by the \"depends\" check.\n");
+  } elsif ($what =~ m/^collections$/i) {
+    tlwarn("$prg: \"collections\" check has been replaced by \"depends\".\n");
     $ret |= check_depends();
-  } elsif ($what =~ m/^depends/i) {
+  } elsif ($what =~ m/^depends$/i) {
     $ret |= check_depends();
-  } elsif ($what =~ m/^runfiles/i) {
+  } elsif ($what =~ m/^runfiles$/i) {
     $ret |= check_runfiles();
-  } elsif ($what =~ m/^executes/i) {
+  } elsif ($what =~ m/^executes$/i) {
     $ret |= check_executes();
-  } elsif ($what =~ m/^texmfdbs/i) {
+  } elsif ($what =~ m/^texmfdbs$/i) {
     $ret |= check_texmfdbs();
   } else {
-    print "No idea how to check that: $what\n";
+    tlwarn("$prg: No idea how to check: $what\n");
+    $ret = 1;
   }
   if ($ret) {
     return ($F_ERROR);
@@ -5403,7 +5409,7 @@
     push @missing, $_ if (! -r "$Master/$_");
     my @foo = @{$filetopacks{$_}};
     if ($#foo < 0) {
-      warn "that shouldn't happen: $_\n";
+      warn "that shouldn't happen #foo < 0: $_";
     } elsif ($#foo > 0) {
       push @multiple, $_;
     }
@@ -5606,7 +5612,7 @@
         chomp($foo);
         push @{$langcodes{$foo}}, $pkg;
       } else {
-        warn "$pkg: unmatched execute: $e\n";
+        tlwarn("$prg: unmatched execute in $pkg: $e\n");
       }
     }
   }
@@ -5614,7 +5620,7 @@
   foreach my $mf (keys %maps) {
     my @pkgsfound = @{$maps{$mf}};
     if ($#pkgsfound > 0) {
-      tlwarn ("$prg: map file $mf is referenced in the executes of @pkgsfound\n");
+      tlwarn("$prg: map file $mf is referenced in the executes of @pkgsfound\n");
     } else {
       # less then 1 occurrences is not possible, so we have only one
       # package that contains the reference to that map file
@@ -5632,7 +5638,7 @@
         foreach my $k (keys %mapfn) {
           my @bla = @{$mapfn{$k}};
           if ($#bla > 0) {
-            tlwarn ("$prg: map file $mf occurs multiple times (in pkgs: @bla)!\n");
+            tlwarn("$prg: map file $mf occurs multiple times (in pkgs: @bla)!\n");
           }
         }
       } else {
@@ -5900,9 +5906,10 @@
   return $ret;
 }
 
+# check texmfdbs -- that !! paths have an ls-R and are in TEXMFDBS,
+# and that trees with an ls-R specify !!.
+#
 sub check_texmfdbs {
-
-#!/usr/bin/perl
   my $texmfdbs = `kpsewhich -var-value TEXMFDBS`;
   my @tfmdbs = glob $texmfdbs;
   my $tfms = `kpsewhich -var-value TEXMF`;
@@ -5910,33 +5917,33 @@
   my %tfmdbs;
   my $ret = 0;
 
-  print "Checking TEXMFDBS\n";
+  debug("Checking TEXMFDBS\n");
   for my $p (@tfmdbs) {
-    print "-> $p\n";
+    debug(" $p\n");
     if ($p !~ m/^!!/) {
-      printf "Warn: entry $p in TEXMFDBS does not have leading !!\n";
+      tlwarn("$prg: item $p in TEXMFDBS does not have leading !!\n");
       $ret++;
     }
     $p =~ s/^!!//;
     $tfmdbs{$p} = 1;
-    if (! -r "$p/ls-R") {
-      printf "Warn: entry $p does not have an associated ls-R\n";
+    if (-d $p && ! -r "$p/ls-R") {
+      tlwarn("$prg: item $p in TEXMFDBS does not have an associated ls-R file\n");
       $ret++;
     }
   }
 
-  print "Checking TEXMF\n";
+  debug("Checking TEXMF\n");
   for my $p (@tfms) {
-    print "-> $p\n";
+    debug(" $p\n");
     my $pnobang = $p;
     $pnobang =~ s/^!!//;
     if (! $tfmdbs{$pnobang}) {
       if ($p =~ m/^!!/) {
-        printf "Warn: tree $p in TEXMF is not in TEXMFDBS but has !!\n";
+        tlwarn("$prg: tree $p in TEXMF not in TEXMFDBS, but has !!\n");
         $ret++;
       }
       if (-r "$pnobang/ls-R") {
-        printf "Warn: tree $p in TEXMF is not in TEXMFDBS but has ls-R file\n";
+        tlwarn("$prg: tree $p in TEXMF not in TEXMFDBS, but has ls-R file\n");
         $ret++;
       }
     }
@@ -7928,17 +7935,14 @@
 Shows the available candidate repositories for package I<pkg>.
 See L<MULTIPLE REPOSITORIES> below.
 
-=head2 check [I<option>...] [files|depends|executes|runfiles|all]
+=head2 check [I<option>...] [depends|executes|files|runfiles|texmfdbs|all]
 
-Executes one (or all) check(s) on the consistency of the installation.
+Execute one (or all) check(s) of the consistency of the installation.
+If no problems are found, there will be no output. (To get a view of
+what is being done, run C<tlmgr -v check>.)
 
 =over 4
 
-=item B<files>
-
-Checks that all files listed in the local TLPDB (C<texlive.tlpdb>) are
-actually present, and lists those missing.
-
 =item B<depends>
 
 Lists those packages which occur as dependencies in an installed collection,
@@ -7953,13 +7957,36 @@
 Check that the files referred to by C<execute> directives in the TeX
 Live Database are present.
 
+=item B<files>
+
+Checks that all files listed in the local TLPDB (C<texlive.tlpdb>) are
+actually present, and lists those missing.
+
 =item B<runfiles>
 
 List those filenames that are occurring more than one time in the
-runfiles sections.
+runfiles sections, except for known duplicates.
 
+=item B<texmfdbs>
+
+Checks related to the C<ls-R> files. If you have defined new trees, or
+changed the C<TEXMF> or C<TEXMFDBS> variables, it can't hurt to run
+this. It checks that:
+
+=over 8
+
+=item - all items in C<TEXMFDBS> have the C<!!> prefix.
+
+=item - all items in C<TEXMFBDS> have an C<ls-R> file (if they exist at all).
+
+=item - all items in C<TEXMF> with C<!!> are listed in C<TEXMFDBS>.
+
+=item - all items in C<TEXMF> with an C<ls-R> file are listed in C<TEXMFDBS>.
+
 =back
 
+=back
+
 Options:
 
 =over 4
@@ -7967,7 +7994,7 @@
 =item B<--use-svn>
 
 Use the output of C<svn status> instead of listing the files; for
-checking the TL development repository.
+checking the TL development repository. (This is run nightly.)
 
 =back
 

Modified: trunk/Master/tlpkg/TeXLive/TLUtils.pm
===================================================================
--- trunk/Master/tlpkg/TeXLive/TLUtils.pm	2019-12-24 17:17:26 UTC (rev 53224)
+++ trunk/Master/tlpkg/TeXLive/TLUtils.pm	2019-12-24 19:19:02 UTC (rev 53225)
@@ -89,6 +89,7 @@
   TeXLive::TLUtils::log($str1, ...);     # only to log file
   TeXLive::TLUtils::tlwarn($str1, ...);  # warn on stderr and log
   TeXLive::TLUtils::tldie($str1, ...);   # tlwarn and die
+  TeXLive::TLUtils::debug_hash_str($label, HASH); # stringified HASH
   TeXLive::TLUtils::debug_hash($label, HASH);   # warn stringified HASH
   TeXLive::TLUtils::backtrace();                # return call stack as string
   TeXLive::TLUtils::process_logging_options($texdir); # handle -q -v* -logfile
@@ -216,7 +217,8 @@
     &SshURIRegex
   );
   @EXPORT = qw(setup_programs download_file process_logging_options
-               tldie tlwarn info log debug ddebug dddebug debug_hash
+               tldie tlwarn info log debug ddebug dddebug debug
+               debug_hash_str debug_hash
                win32 xchdir xsystem run_cmd system_pipe sort_archs);
 }
 
@@ -2563,10 +2565,10 @@
 sub setup_system_one {
   my ($p, $arg) = @_;
   my $nulldev = nulldev();
-  debug("trying to set up system $p, arg $arg\n");
+  ddebug("trying to set up system $p, arg $arg\n");
   my $ret = system("$p $arg >$nulldev 2>&1");
   if ($ret == 0) {
-    debug("program $p found in the path\n");
+    debug("program $p found in path\n");
     $::progs{$p} = $p;
     return(1);
   } else {
@@ -3469,14 +3471,19 @@
   }
 }
 
-=item C<debug_hash ($label, HASH)>
+=item C<debug_hash_str($label, HASH)>
 
-Write LABEL followed by HASH elements, all on one line, to stderr.
-If HASH is a reference, it is followed.
+Return LABEL followed by HASH elements, followed by a newline, as a
+single string. If HASH is a reference, it is followed (but no recursive
+derefencing).
 
+=item C<debug_hash($label, HASH)>
+
+Write the result of C<debug_hash_str> to stderr.
+
 =cut
 
-sub debug_hash {
+sub debug_hash_str {
   my ($label) = shift;
   my (%hash) = (ref $_[0] && $_[0] =~ /.*HASH.*/) ? %{$_[0]} : @_;
 
@@ -3492,9 +3499,13 @@
   $str .= join (",", @items);
   $str .= "}";
 
-  warn "$str\n";
+  return "$str\n";
 }
 
+sub debug_hash {
+  warn &debug_hash_str(@_);
+}
+
 =item C<backtrace()>
 
 Return call(er) stack, as a string.



More information about the tex-live-commits mailing list