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 +++------------------------ 1 file changed, 13 insertions(+), 104 deletions(-) (limited to 'Master/texmf-dist/scripts/texlive/fmtutil.pl') 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) -- cgit v1.2.3