diff options
author | Karl Berry <karl@freefriends.org> | 2019-12-24 19:19:02 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-12-24 19:19:02 +0000 |
commit | 5dd4013570b01bb232984f7f32b4dc557cf47f33 (patch) | |
tree | 297805721e458b8272a143207c4e2bfb8004da76 /Master | |
parent | 83898f5f87b203c77dc6093cbc951400955dd261 (diff) |
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.
git-svn-id: svn://tug.org/texlive/trunk@53225 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rwxr-xr-x | Master/texmf-dist/scripts/texlive/tlmgr.pl | 97 | ||||
-rw-r--r-- | Master/tlpkg/TeXLive/TLUtils.pm | 27 |
2 files changed, 81 insertions, 43 deletions
diff --git a/Master/texmf-dist/scripts/texlive/tlmgr.pl b/Master/texmf-dist/scripts/texlive/tlmgr.pl index 0e1d3de88eb..71fa918d38d 100755 --- a/Master/texmf-dist/scripts/texlive/tlmgr.pl +++ b/Master/texmf-dist/scripts/texlive/tlmgr.pl @@ -676,7 +676,10 @@ for the full story.\n"; 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 @@ sub action_check { 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 @@ sub check_files { 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 @@ sub check_executes { 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 @@ sub check_executes { 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 @@ sub check_executes { 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 @@ sub check_depends { 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 @@ sub check_texmfdbs { 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 @@ performed are written to the terminal. 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,10 +7957,33 @@ instead since former versions for C<tlmgr> called it that way. 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 @@ -7967,7 +7994,7 @@ Options: =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 diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm index 61dcff6afef..1c33a0d04ef 100644 --- a/Master/tlpkg/TeXLive/TLUtils.pm +++ b/Master/tlpkg/TeXLive/TLUtils.pm @@ -89,6 +89,7 @@ C<TeXLive::TLUtils> - utilities used in TeX Live infrastructure 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 @@ BEGIN { &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_one { 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 @@ sub tldie { } } -=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,7 +3499,11 @@ sub debug_hash { $str .= join (",", @items); $str .= "}"; - warn "$str\n"; + return "$str\n"; +} + +sub debug_hash { + warn &debug_hash_str(@_); } =item C<backtrace()> |