From 3d6fbb767ecd4e1b0e8359a533e4d9bad9fbe1a6 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Thu, 22 Apr 2021 00:55:07 +0000 Subject: Revert accidently committed changes git-svn-id: svn://tug.org/texlive/trunk@58961 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/scripts/texlive/fmtutil.pl | 117 +++------------------------ Master/texmf-dist/scripts/texlive/tlmgr.pl | 77 +++--------------- Master/tlpkg/TeXLive/TLUtils.pm | 19 ----- 3 files changed, 23 insertions(+), 190 deletions(-) diff --git a/Master/texmf-dist/scripts/texlive/fmtutil.pl b/Master/texmf-dist/scripts/texlive/fmtutil.pl index 3882fc2a87e..2823ee3b487 100755 --- a/Master/texmf-dist/scripts/texlive/fmtutil.pl +++ b/Master/texmf-dist/scripts/texlive/fmtutil.pl @@ -60,11 +60,6 @@ my $sep = (win32() ? ';' : ':'); my @deferred_stderr; my @deferred_stdout; -my $first_time_creation_in_usermode = 0; - -my $DRYRUN = ""; -my $STATUS_FH; - (our $prg = basename($0)) =~ s/\.pl$//; # make sure that the main binary path is available at the front @@ -121,7 +116,6 @@ our @cmdline_options = ( # in same order as help message "sys", "user", "cnffile=s@", - "dry-run=n", "fmtdir=s", "no-engine-subdir", "no-error-if-no-engine=s", @@ -129,7 +123,6 @@ our @cmdline_options = ( # in same order as help message "nohash", "recorder", "refresh", - "status-file=s", "strict!", "quiet|silent|q", "catcfg", @@ -163,10 +156,9 @@ sub main { # (and nothing else), since kpathsea can only deal with one. $mktexfmtMode = 1; - # we default to user mode here, in particular because **if** TEXMFSYSVAR - # is writable we will use it to save format dumps created by mktexfmt - # If root is running mktexfmt, then most probably the formats will end - # up in TEXMFSYSVAR which is fine. + # TODO TODO + # which mode are we running in? + # what happens if root runs mktexfmt? $opts{'user'} = 1; GetOptions ( "help" => \$opts{'help'}, "version" => \$opts{'version'} ) @@ -222,13 +214,6 @@ sub main { } } } - - $DRYRUN = "echo " if ($opts{'dry-run'}); - - if ($opts{'status-file'}) { - open $STATUS_FH, '>>', $opts{'status-file'} - || printf STDERR "Cannot open status-file: $opts{'status-file'}\nWill not write status information!\n"; - } # these two functions should go to TLUtils (for use in updmap) ($texmfconfig, $texmfvar) = @@ -267,7 +252,7 @@ sub main { touch($bakFile); touch($changes_config_file); } - system("$DRYRUN$editor", $changes_config_file); + system($editor, $changes_config_file); $changed = files_are_different($bakFile, $changes_config_file); } elsif ($opts{'showhyphen'}) { @@ -326,10 +311,6 @@ sub main { return 1; } - if ($STATUS_FH) { - close($STATUS_FH) || print STDERR "Cannot close fh for $opts{'status-file'}.\n"; - } - unless ($opts{'nohash'}) { # TODO should only do this if built something, e.g., not --listcfg print_info("updating ls-R files\n"); @@ -347,12 +328,6 @@ sub dump_data { print Data::Dumper::Dumper($alldata); } -# -sub log_to_status { - if ($STATUS_FH) { - print $STATUS_FH "@_\n"; - } -} # callback_build_formats - (re)builds the formats as selected, # returns exit status or dies. Exit status is always zero unless @@ -443,28 +418,13 @@ sub callback_build_formats { next if ($swi eq "format!=engine" && $fmt eq $eng); $total++; my $val = select_and_rebuild_format($fmt, $eng, $what, $whatarg); - if ($val == $FMT_DISABLED) { - log_to_status("DISABLED", $fmt, $eng, $what, $whatarg); - $disabled++; - } elsif ($val == $FMT_NOTSELECTED) { - log_to_status("NOTSELECTED", $fmt, $eng, $what, $whatarg); - $nobuild++; - } elsif ($val == $FMT_FAILURE) { - log_to_status("FAILURE", $fmt, $eng, $what, $whatarg); - $err++; - push (@err, "$eng/$fmt"); - } elsif ($val == $FMT_SUCCESS) { - log_to_status("SUCCESS", $fmt, $eng, $what, $whatarg); - $suc++; - } elsif ($val == $FMT_NOTAVAIL) { - log_to_status("NOTAVAIL", $fmt, $eng, $what, $whatarg); - $notavail++; - } - else { - log_to_status("UNKNOWN", $fmt, $eng, $what, $whatarg); - print_error("callback_build_format (round 1): unknown return " - . "from select_and_rebuild.\n"); - } + if ($val == $FMT_DISABLED) { $disabled++; } + elsif ($val == $FMT_NOTSELECTED) { $nobuild++; } + elsif ($val == $FMT_FAILURE) { $err++; push (@err, "$eng/$fmt"); } + elsif ($val == $FMT_SUCCESS) { $suc++; } + elsif ($val == $FMT_NOTAVAIL) { $notavail++; } + else { print_error("callback_build_format (round 1): unknown return " + . "from select_and_rebuild.\n"); } } } } @@ -495,35 +455,7 @@ sub callback_build_formats { # try to remove the tmpdir with all files TeXLive::TLUtils::rmtree($tmpdir); } - # - # In case of user mode and formats rebuilt, warn that these formats - # will shadow future updates. Can be suppressed with --quiet which - # does not show print_info output - if ($opts{'user'} && $suc && $first_time_creation_in_usermode) { - print_info(" -************************************************************* -* * -* WARNING: you are switching to fmtutil's per-user formats. * -* Please read the following explanations. * -* * -************************************************************* - -You have run fmtutil-user (as opposed to fmtutil-sys) for the first time; this -has created format files which are local to your personal account. - -Any changes in system formats will *not* be automatically reflected in -your files; furthermore, running fmtutil-sys will no longer have any -effect for you. As a consequence, you have to rerun fmtutil-user yourself -after any change in the system directories. - -See http://tug.org/texlive/scripts-sys-user.html for details. - -If you want to undo this, remove the files mentioned above. - -(Run $prg --help for full documentation of fmtutil.) -"); - } - # return + # return return $opts{"strict"} ? $err : 0; } @@ -587,28 +519,12 @@ sub select_and_rebuild_format { } } if ($doit) { - check_and_warn_on_user_format($fmt,$eng); return rebuild_one_format($fmt,$eng,$kpsefmt,$destdir,$fmtfile,$logfile); } else { return $FMT_NOTSELECTED; } } -sub check_and_warn_on_user_format { - my ($fmt, $eng) = @_; - # do nothing if we are updating files in $TEXMFVAR - return if ($opts{'fmtdir'} eq $TEXMFVAR); - my $saved_fmtdir = $opts{'fmtdir'}; - $opts{'fmtdir'} = "$TEXMFVAR/web2c"; - my ($kpsefmt, $destdir, $fmtfile, $logfile) = compute_format_destination($fmt, $eng); - if (-r "$destdir/$fmtfile") { - print_deferred_warning("you have a shadowing format dump in TEXMFVAR for $fmt/$eng!!!\n"); - } - $opts{'fmtdir'} = $saved_fmtdir; -} - - - # compute_format_destination # takes fmt/eng and returns the locations where format and log files # should be saved, that is, a list: (dump file full path, log file full path) @@ -763,7 +679,7 @@ sub rebuild_one_format { # in mktexfmtMode we must redirect *all* output to stderr $cmdline .= " >&2" if $mktexfmtMode; $cmdline .= " <$nul"; - my $retval = system("$DRYRUN$cmdline"); + my $retval = system($cmdline); # report error if it failed. if ($retval != 0) { @@ -832,13 +748,8 @@ sub rebuild_one_format { } my $destfile = "$destdir/$fmtfile"; - # set flag to warn that new user format was installed - # we check whether the next command **would** create a new file, - # and if it succeeded, we set the actual flag. - my $possibly_warn = ($opts{'user'} && ! -r $destfile); if (File::Copy::copy($fmtfile, $destfile )) { print_info("$destfile installed.\n"); - $first_time_creation_in_usermode = $possibly_warn; # # original fmtutil.sh did some magic trick for mplib-luatex.mem # @@ -1429,7 +1340,6 @@ Options: --cnffile FILE read FILE instead of fmtutil.cnf (can be given multiple times, in which case all the files are used) - --dry-run | -n don't actually build formts --fmtdir DIR write formats under DIR instead of TEXMF[SYS]VAR --no-engine-subdir don't use engine-specific subdir of the fmtdir --no-error-if-no-format exit successfully if no format is selected @@ -1440,7 +1350,6 @@ Options: --nohash don't update ls-R files --recorder pass the -recorder option and save .fls files --refresh recreate only existing format files - --status-file FILE append status information about built formats to FILE --quiet be silent --catcfg (does nothing, exists for compatibility) --dolinks (does nothing, exists for compatibility) diff --git a/Master/texmf-dist/scripts/texlive/tlmgr.pl b/Master/texmf-dist/scripts/texlive/tlmgr.pl index 55350a58316..78221b0616d 100755 --- a/Master/texmf-dist/scripts/texlive/tlmgr.pl +++ b/Master/texmf-dist/scripts/texlive/tlmgr.pl @@ -24,7 +24,6 @@ our $Master; our $loadmediasrcerror; our $packagelogfile; our $packagelogged; -our $commandslogged; our $commandlogfile; our $tlmgr_config_file; our $pinfile; @@ -633,7 +632,6 @@ 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"}) { @@ -701,15 +699,9 @@ for the full story.\n"; my $ret = execute_action($action, @ARGV); # close the special log file - 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); - } + if ($packagelogfile && !$::gui_mode) { + info("$prg: package log updated: $packagelogfile\n") if $packagelogged; + close(PACKAGELOG); } # F_ERROR stops processing immediately, and prevents postactions from @@ -836,7 +828,6 @@ 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; @@ -876,15 +867,12 @@ sub handle_execute_actions { my $errors = 0; my $sysmode = ($opts{"usermode"} ? "-user" : "-sys"); - my $fmtutil_cmd = "fmtutil$sysmode"; - my $status_file = TeXLive::TLUtils::tl_tmpfile(); - my $fmtutil_args = "$common_fmtutil_args --status-file=$status_file"; - + my $invoke_fmtutil = "fmtutil$sysmode $common_fmtutil_args"; # of create_formats is unset (NOT the default) we add --refresh so that # only existing formats are recreated if (!$localtlpdb->option("create_formats")) { - $fmtutil_args .= " --refresh"; + $invoke_fmtutil .= " --refresh"; debug("only existing formats will be refreshed per user option (create_formats=0)\n"); } @@ -985,9 +973,7 @@ sub handle_execute_actions { for my $e (keys %updated_engines) { debug ("updating formats based on $e\n"); $errors += do_cmd_and_check - ("$fmtutil_cmd --byengine $e --no-error-if-no-format $fmtutil_args"); - read_and_report_fmtutil_status_file($status_file); - unlink($status_file); + ("$invoke_fmtutil --no-error-if-no-format --byengine $e"); } # now rebuild all other formats for my $f (keys %do_enable) { @@ -995,9 +981,7 @@ 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 ("$fmtutil_cmd --byfmt $f $fmtutil_args"); - read_and_report_fmtutil_status_file($status_file); - unlink($status_file); + $errors += do_cmd_and_check ("$invoke_fmtutil --byfmt $f"); $done_formats{$f} = 1; } } @@ -1016,9 +1000,7 @@ sub handle_execute_actions { $lang = "$TEXMFSYSVAR/tex/generic/config/$lang"; } if (!$::regenerate_all_formats) { - $errors += do_cmd_and_check ("$fmtutil_cmd --byhyphen \"$lang\" $fmtutil_args"); - read_and_report_fmtutil_status_file($status_file); - unlink($status_file); + $errors += do_cmd_and_check ("$invoke_fmtutil --byhyphen \"$lang\""); } } } @@ -1027,10 +1009,8 @@ sub handle_execute_actions { # so we just refresh formats instead of generating all that have not been there if ($::regenerate_all_formats) { info("Regenerating available formats, this may take some time ..."); - # --refresh might already be in $fmtutil_args, but we don't care - $errors += do_cmd_and_check("$fmtutil_cmd --all --refresh $fmtutil_args"); - read_and_report_fmtutil_status_file($status_file); - unlink($status_file); + # --refresh might already be in $invoke_fmtutil, but we don't care + $errors += do_cmd_and_check("$invoke_fmtutil --refresh --all"); info("done\n"); $::regenerate_all_formats = 0; } @@ -1048,42 +1028,6 @@ 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 # @@ -7566,7 +7510,6 @@ sub logpackage { } sub logcommand { if ($commandlogfile) { - $commandslogged++; my $tim = localtime(); print COMMANDLOG "[$tim] @_\n"; } diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm index 4769fb35256..786c35813cc 100644 --- a/Master/tlpkg/TeXLive/TLUtils.pm +++ b/Master/tlpkg/TeXLive/TLUtils.pm @@ -4582,25 +4582,6 @@ sub setup_sys_user_mode { } elsif ($optsref->{'user'}) { $texmfconfig = $TEXMFCONFIG; $texmfvar = $TEXMFVAR; - # mktexfmt is often run accidentally by a user with missing formats - # and the resulting format dumps are put into TEXMFVAR, which is - # one of the most common source of problems. - # Only for mktexfmt (but not for fmtutil, which would need to be called - # explicitely with fmtutil -user) we check whether TEXMFSYSVAR is writable - # and if yes, create formats there. - if ($prg eq "mktexfmt") { - my $switchit = 0; - if (-d "$TEXMFSYSVAR/web2c") { - $switchit = 1 if (-w "$TEXMFSYSVAR/web2c"); - } elsif (-d $TEXMFSYSVAR && -w $TEXMFSYSVAR) { - $switchit = 1; - } - if ($switchit) { - # inform about switch, but not for mktexfmt which expects output to be only the format - $prg eq "mktexfmt" || info("$prg: using TEXMFSYSVAR instead of TEXMFVAR since it is writable!\n"); - $texmfvar = $TEXMFSYSVAR; - } - } } else { print STDERR "" . "$prg [ERROR]: Either -sys or -user mode is required.\n" . -- cgit v1.2.3