texlive[58961] Master: Revert accidently committed changes

commits+preining at tug.org commits+preining at tug.org
Thu Apr 22 02:55:07 CEST 2021


Revision: 58961
          http://tug.org/svn/texlive?view=revision&revision=58961
Author:   preining
Date:     2021-04-22 02:55:07 +0200 (Thu, 22 Apr 2021)
Log Message:
-----------
Revert accidently committed changes

Modified Paths:
--------------
    trunk/Master/texmf-dist/scripts/texlive/fmtutil.pl
    trunk/Master/texmf-dist/scripts/texlive/tlmgr.pl
    trunk/Master/tlpkg/TeXLive/TLUtils.pm

Modified: trunk/Master/texmf-dist/scripts/texlive/fmtutil.pl
===================================================================
--- trunk/Master/texmf-dist/scripts/texlive/fmtutil.pl	2021-04-22 00:52:00 UTC (rev 58960)
+++ trunk/Master/texmf-dist/scripts/texlive/fmtutil.pl	2021-04-22 00:55:07 UTC (rev 58961)
@@ -60,11 +60,6 @@
 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 @@
   "sys",
   "user",
   "cnffile=s@", 
-  "dry-run=n",
   "fmtdir=s",
   "no-engine-subdir",
   "no-error-if-no-engine=s",
@@ -129,7 +123,6 @@
   "nohash",
   "recorder",
   "refresh",
-  "status-file=s",
   "strict!",
   "quiet|silent|q",
   "catcfg",
@@ -163,10 +156,9 @@
     # (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 @@
       }
     }
   }
-
-  $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 @@
       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 @@
     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 @@
   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 @@
         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 @@
     # 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,7 +519,6 @@
     }
   }
   if ($doit) {
-    check_and_warn_on_user_format($fmt,$eng);
     return rebuild_one_format($fmt,$eng,$kpsefmt,$destdir,$fmtfile,$logfile);
   } else {
     return $FMT_NOTSELECTED;
@@ -594,21 +525,6 @@
   }
 }
 
-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 @@
     # 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 @@
   }
 
   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 @@
   --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 @@
   --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)

Modified: trunk/Master/texmf-dist/scripts/texlive/tlmgr.pl
===================================================================
--- trunk/Master/texmf-dist/scripts/texlive/tlmgr.pl	2021-04-22 00:52:00 UTC (rev 58960)
+++ trunk/Master/texmf-dist/scripts/texlive/tlmgr.pl	2021-04-22 00:55:07 UTC (rev 58961)
@@ -24,7 +24,6 @@
 our $loadmediasrcerror;
 our $packagelogfile;
 our $packagelogged;
-our $commandslogged;
 our $commandlogfile;
 our $tlmgr_config_file;
 our $pinfile;
@@ -633,7 +632,6 @@
   # 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 @@
   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 @@
   # 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 @@
   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 @@
       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 @@
         # 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 @@
           $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 @@
     # 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 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 logcommand {
   if ($commandlogfile) {
-    $commandslogged++;
     my $tim = localtime();
     print COMMANDLOG "[$tim] @_\n";
   }

Modified: trunk/Master/tlpkg/TeXLive/TLUtils.pm
===================================================================
--- trunk/Master/tlpkg/TeXLive/TLUtils.pm	2021-04-22 00:52:00 UTC (rev 58960)
+++ trunk/Master/tlpkg/TeXLive/TLUtils.pm	2021-04-22 00:55:07 UTC (rev 58961)
@@ -4582,25 +4582,6 @@
   } 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" .



More information about the tex-live-commits mailing list.