diff options
author | Norbert Preining <preining@logic.at> | 2020-06-01 00:32:00 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2020-06-01 00:32:00 +0000 |
commit | 3de00a3962f4261d9c2646c5fbda892494337f36 (patch) | |
tree | bc8b161a078a3c9cbfa6170b6e2f9a6a1849dc0a /Master/texmf-dist | |
parent | 75e1f59ef4104f863e1791bc358a4667258594b7 (diff) |
tlmgr: log command output to separate file
git-svn-id: svn://tug.org/texlive/trunk@55369 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rwxr-xr-x | Master/texmf-dist/scripts/texlive/tlmgr.pl | 47 |
1 files changed, 37 insertions, 10 deletions
diff --git a/Master/texmf-dist/scripts/texlive/tlmgr.pl b/Master/texmf-dist/scripts/texlive/tlmgr.pl index 20cf640a562..b71a4810506 100755 --- a/Master/texmf-dist/scripts/texlive/tlmgr.pl +++ b/Master/texmf-dist/scripts/texlive/tlmgr.pl @@ -25,6 +25,7 @@ our $ismain; our $loadmediasrcerror; our $packagelogfile; our $packagelogged; +our $commandlogfile; our $tlmgr_config_file; our $pinfile; our $action; # for the pod2usage -sections call @@ -358,6 +359,7 @@ my %globaloptions = ( "machine-readable" => 1, "no-execute-actions" => 1, "package-logfile" => "=s", + "command-logfile" => "=s", "persistent-downloads" => "!", "pause" => 1, "pin-file" => "=s", @@ -653,6 +655,22 @@ for the full story.\n"; debug("appending to package log file: $packagelogfile\n"); } + # output of executed commands are put into -command-logfile + $commandlogfile = $opts{"command-logfile"}; + if ($opts{"usermode"}) { + $commandlogfile ||= "$::maintree/web2c/tlmgr-commands.log"; + } else { + $commandlogfile ||= "$texmfsysvar/web2c/tlmgr-commands.log"; + } + # Try to open the packagelog file, but do NOT die when that does not work + if (!open(COMMANDLOG, ">>$commandlogfile")) { + debug("Cannot open command log file for appending: $commandlogfile\n"); + debug("Will not log output of executed commands for this run\n"); + $commandlogfile = ""; + } else { + debug("appending to command log file: $commandlogfile\n"); + } + $loadmediasrcerror = "Cannot load TeX Live database from "; # load the config file and set the config options @@ -815,7 +833,7 @@ sub do_cmd_and_check { # tlmgr front ends (MacOSX's TeX Live Utility) can read it # and show it to the user before the possibly long delay. info("running $cmd ...\n"); - logpackage("running $cmd"); + logcommand("running $cmd"); my ($out, $ret); if ($opts{"dry-run"}) { $ret = $F_OK; @@ -829,22 +847,17 @@ sub do_cmd_and_check { } else { ($out, $ret) = TeXLive::TLUtils::run_cmd("$cmd 2>&1"); } - # Although it is quite verbose to report all the output from every - # fmtutil (especially) run, it's the only way to know what's normal - # when something fails. Prefix each line to make them easy to see - # (and filter out/in). - (my $prefixed_out = $out) =~ s/^/(cmd)/gm; - $prefixed_out =~ s/\n+$//; # trailing newlines don't seem interesting - my $outmsg = "output:\n$prefixed_out\n--end of output of $cmd.\n"; + $out =~ s/\n+$//; # trailing newlines don't seem interesting + my $outmsg = "output:\n$out\n--end of output of $cmd.\n"; if ($ret == $F_OK) { info("done running $cmd.\n"); - logpackage("success, $outmsg"); + logcommand("success, $outmsg"); ddebug("$cmd $outmsg"); return ($F_OK); } else { info("\n"); tlwarn("$prg: $cmd failed (status $ret), output:\n$out\n"); - logpackage("error, status: $ret, $outmsg"); + logcommand("error, status: $ret, $outmsg"); return ($F_ERROR); } } @@ -7457,6 +7470,13 @@ sub logpackage { print PACKAGELOG "[$tim] @_\n"; } } +sub logcommand { + if ($commandlogfile) { + my $tim = localtime(); + print COMMANDLOG "[$tim] @_\n"; + } +} + # resolve relative paths from tlpdb wrt tlroot sub norm_tlpdb_path { @@ -7805,6 +7825,13 @@ S<Japanese (ja)>, S<Dutch (nl)>, S<Polish (pl)>, S<Brazilian Portuguese tlshell shares its message catalog with tlmgr. +=item B<--command-logfile> I<file> + +C<tlmgr> logs the output of all programs invoked (mktexlr, mtxrun, fmtutil, +updmap) to a separate log file, by default +C<TEXMFSYSVAR/web2c/tlmgr-commands.log>. This option allows you to specify a +different file for the log. + =item B<--debug-translation> In GUI mode, this switch tells C<tlmgr> to report any untranslated (or |