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

commits+preining at tug.org commits+preining at tug.org
Tue Jan 7 00:55:32 CET 2020


Revision: 53340
          http://tug.org/svn/texlive?view=revision&revision=53340
Author:   preining
Date:     2020-01-07 00:55:32 +0100 (Tue, 07 Jan 2020)
Log Message:
-----------
fmtutil --cnffile: search via kpsewhich on dir-less files

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	2020-01-06 21:55:57 UTC (rev 53339)
+++ trunk/Master/texmf-dist/scripts/texlive/fmtutil.pl	2020-01-06 23:55:32 UTC (rev 53340)
@@ -3,7 +3,7 @@
 # fmtutil - utility to maintain format files.
 # (Maintained in TeX Live:Master/texmf-dist/scripts/texlive.)
 # 
-# Copyright 2014-2018 Norbert Preining
+# Copyright 2014-2020 Norbert Preining
 # This file is licensed under the GNU General Public License version 2
 # or any later version.
 #
@@ -1040,7 +1040,18 @@
     my @tmp;
     for my $f (@{$opts{'cnffile'}}) {
       if (! -f $f) {
-        die "$prg: Config file \"$f\" not found";
+        # if $f is a pure file name, that is dirname $f == ".",
+        # then try to find it via kpsewhich
+        if (dirname($f) eq ".") {
+          chomp(my $kpfile = `kpsewhich $f`);
+          if ($kpfile ne "") {
+            $f = $kpfile;
+          } else {
+            die "$prg: Config file \"$f\" cannot be found via kpsewhich";
+          }
+        } else {
+          die "$prg: Config file \"$f\" not found";
+        }
       }
       push @tmp, (win32() ? lc($f) : $f);
     }
@@ -1363,7 +1374,9 @@
   If --cnffile is specified on the command line (possibly multiple
   times), its value(s) are used.  Otherwise, fmtutil reads all the
   fmtutil.cnf files found by running \`kpsewhich -all fmtutil.cnf', in the
-  order returned by kpsewhich.
+  order returned by kpsewhich. Files passed in via --cnffile are
+  first tried to be loaded directly, and if not found and the file names
+  don't contain directory parts, are searched via kpsewhich.
 
   In any case, if multiple fmtutil.cnf files are found, all the format
   definitions found in all the fmtutil.cnf files are merged.



More information about the tex-live-commits mailing list