diff options
author | Norbert Preining <preining@logic.at> | 2021-05-09 02:23:44 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2021-05-09 02:23:44 +0000 |
commit | d408beb505856c02bbae6121e29e4cb285077719 (patch) | |
tree | 43c532258b957b4428591fc42174725cc4e384b8 /Master/texmf-dist/scripts/texlive/tlmgr.pl | |
parent | e7adfdd20cff7ca275e1383386000088243c1cf9 (diff) |
fmtutil and tlmgr improvements
fmtutil.pl
- if run as mktexfmt and TEXMFSYSVAR is writable, use
it instead of TEXMFVAR (actual code in TLUtils.pm).
- add --dry-run | -n option
it is not guaranteed to be 100% dry-run, though
- add --status-file=FILE where the status of each
format creating is written to
- warn on running fmtutil in user mode the first time
(similar to updmap)
- warn on shadowing formats
- documentation fixes
tlmgr.pl
- use fmtutil --status-file and report back failed
format rebuilds
- regeneration all formats now only exists existing
formats (use --refresh with fmtutil)
- report when commands are logged to the respective
log file
- documentation fixes
TLUtils.pm
- update setup_sys_user_mode for the fmtutil/mktexfmt
changes mentioned above
- documentation fixes
git-svn-id: svn://tug.org/texlive/trunk@59143 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/texlive/tlmgr.pl')
-rwxr-xr-x | Master/texmf-dist/scripts/texlive/tlmgr.pl | 75 |
1 files changed, 66 insertions, 9 deletions
diff --git a/Master/texmf-dist/scripts/texlive/tlmgr.pl b/Master/texmf-dist/scripts/texlive/tlmgr.pl index f57d5ec348e..a468d7e05a3 100755 --- a/Master/texmf-dist/scripts/texlive/tlmgr.pl +++ b/Master/texmf-dist/scripts/texlive/tlmgr.pl @@ -24,6 +24,7 @@ our $Master; our $loadmediasrcerror; our $packagelogfile; our $packagelogged; +our $commandslogged; our $commandlogfile; our $tlmgr_config_file; our $pinfile; @@ -632,6 +633,7 @@ for the full story.\n"; # package related actions (install, remove, update) to # the package-log file TEXMFSYSVAR/web2c/tlmgr.log $packagelogged = 0; # how many msgs we logged + $commandslogged = 0; chomp (my $texmfsysvar = `kpsewhich -var-value=TEXMFSYSVAR`); $packagelogfile = $opts{"package-logfile"}; if ($opts{"usermode"}) { @@ -699,9 +701,15 @@ for the full story.\n"; my $ret = execute_action($action, @ARGV); # close the special log file - if ($packagelogfile && !$::gui_mode) { - info("$prg: package log updated: $packagelogfile\n") if $packagelogged; - close(PACKAGELOG); + if (!$::gui_mode) { + if ($packagelogfile) { + info("$prg: package log updated: $packagelogfile\n") if $packagelogged; + close(PACKAGELOG); + } + if ($commandlogfile) { + info("$prg: command log updated: $commandlogfile\n") if $commandslogged; + close(COMMANDLOG); + } } # F_ERROR stops processing immediately, and prevents postactions from @@ -828,6 +836,7 @@ sub do_cmd_and_check { # and show it to the user before the possibly long delay. info("running $cmd ...\n"); logcommand("running $cmd"); + logpackage("command: $cmd"); my ($out, $ret); if ($opts{"dry-run"}) { $ret = $F_OK; @@ -867,12 +876,15 @@ sub handle_execute_actions { my $errors = 0; my $sysmode = ($opts{"usermode"} ? "-user" : "-sys"); - my $invoke_fmtutil = "fmtutil$sysmode $common_fmtutil_args"; + my $fmtutil_cmd = "fmtutil$sysmode"; + my $status_file = TeXLive::TLUtils::tl_tmpfile(); + my $fmtutil_args = "$common_fmtutil_args --status-file=$status_file"; + # if create_formats is false (NOT the default) we add --refresh so that # only existing formats are recreated if (!$localtlpdb->option("create_formats")) { - $invoke_fmtutil .= " --refresh"; + $fmtutil_args .= " --refresh"; debug("refreshing only existing formats per user option (create_formats=0)\n"); } @@ -973,7 +985,9 @@ sub handle_execute_actions { for my $e (keys %updated_engines) { debug ("updating formats based on $e\n"); $errors += do_cmd_and_check - ("$invoke_fmtutil --no-error-if-no-format --byengine $e"); + ("$fmtutil_cmd --byengine $e --no-error-if-no-format $fmtutil_args"); + read_and_report_fmtutil_status_file($status_file); + unlink($status_file); } # now rebuild all other formats for my $f (keys %do_enable) { @@ -981,7 +995,9 @@ sub handle_execute_actions { # ignore disabled formats next if !$::execute_actions{'enable'}{'formats'}{$f}{'mode'}; debug ("(re)creating format dump $f\n"); - $errors += do_cmd_and_check ("$invoke_fmtutil --byfmt $f"); + $errors += do_cmd_and_check ("$fmtutil_cmd --byfmt $f $fmtutil_args"); + read_and_report_fmtutil_status_file($status_file); + unlink($status_file); $done_formats{$f} = 1; } } @@ -1000,7 +1016,9 @@ sub handle_execute_actions { $lang = "$TEXMFSYSVAR/tex/generic/config/$lang"; } if (!$::regenerate_all_formats) { - $errors += do_cmd_and_check ("$invoke_fmtutil --byhyphen \"$lang\""); + $errors += do_cmd_and_check ("$fmtutil_cmd --byhyphen \"$lang\" $fmtutil_args"); + read_and_report_fmtutil_status_file($status_file); + unlink($status_file); } } } @@ -1010,7 +1028,9 @@ sub handle_execute_actions { if ($::regenerate_all_formats) { info("Regenerating existing formats, this may take some time ..."); # --refresh might already be in $invoke_fmtutil, but we don't care - $errors += do_cmd_and_check("$invoke_fmtutil --refresh --all"); + $errors += do_cmd_and_check("$fmtutil_cmd --refresh --all $fmtutil_args"); + read_and_report_fmtutil_status_file($status_file); + unlink($status_file); info("done\n"); $::regenerate_all_formats = 0; } @@ -1028,6 +1048,42 @@ sub handle_execute_actions { } } +sub read_and_report_fmtutil_status_file { + my $status_file = shift; + my $fh; + if (!open($fh, '<', $status_file)) { + printf STDERR "Cannot read status file $status_file, strange!\n"; + return; + } + chomp(my @lines = <$fh>); + close $fh; + my @failed; + my @success; + for my $l (@lines) { + my ($status, $fmt, $eng, $what, $whatargs) = split(' ', $l, 5); + if ($status eq "DISABLED") { + # ignore for now + } elsif ($status eq "NOTSELECTED") { + # ignore for now + } elsif ($status eq "FAILURE") { + push @failed, "${fmt}.fmt/$eng"; + } elsif ($status eq "SUCCESS") { + push @success, "${fmt}.fmt/$eng"; + } elsif ($status eq "NOTAVAIL") { + # ignore for now + } elsif ($status eq "UNKNOWN") { + # ignore for now + } else { + # ignore for now + } + } + logpackage(" OK: @success") if (@success); + logpackage(" ERROR: @failed") if (@failed); + logcommand(" OK: @success") if (@success); + logcommand(" ERROR: @failed") if (@failed); + info(" OK: @success\n") if (@success); + info(" ERROR: @failed\n") if (@failed); +} # GET_MIRROR # @@ -7543,6 +7599,7 @@ sub logpackage { } sub logcommand { if ($commandlogfile) { + $commandslogged++; my $tim = localtime(); print COMMANDLOG "[$tim] @_\n"; } |