texlive[58953] Master/texmf-dist/scripts/texlive/fmtutil.pl: fmtutil:

commits+preining at tug.org commits+preining at tug.org
Thu Apr 22 02:45:12 CEST 2021


Revision: 58953
          http://tug.org/svn/texlive?view=revision&revision=58953
Author:   preining
Date:     2021-04-22 02:45:12 +0200 (Thu, 22 Apr 2021)
Log Message:
-----------
fmtutil: support --status-file

Modified Paths:
--------------
    trunk/Master/texmf-dist/scripts/texlive/fmtutil.pl

Modified: trunk/Master/texmf-dist/scripts/texlive/fmtutil.pl
===================================================================
--- trunk/Master/texmf-dist/scripts/texlive/fmtutil.pl	2021-04-22 00:45:05 UTC (rev 58952)
+++ trunk/Master/texmf-dist/scripts/texlive/fmtutil.pl	2021-04-22 00:45:12 UTC (rev 58953)
@@ -61,6 +61,7 @@
 my @deferred_stdout;
 
 my $DRYRUN = "";
+my $STATUS_FH;
 
 (our $prg = basename($0)) =~ s/\.pl$//;
 
@@ -126,6 +127,7 @@
   "nohash",
   "recorder",
   "refresh",
+  "status-file=s",
   "strict!",
   "quiet|silent|q",
   "catcfg",
@@ -219,6 +221,11 @@
   }
 
   $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) = 
@@ -316,6 +323,10 @@
     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");
@@ -333,6 +344,12 @@
   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
@@ -423,13 +440,28 @@
         next if ($swi eq "format!=engine" && $fmt eq $eng);
         $total++;
         my $val = select_and_rebuild_format($fmt, $eng, $what, $whatarg);
-        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"); }
+        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");
+        }
       }
     }
   }
@@ -1356,6 +1388,7 @@
   --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)



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