From c753516575863215c90ca130213c60ac59580beb Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Fri, 26 Mar 2021 09:25:41 +0900 Subject: fmtutil: make --refresh an option usable with other format selection commands --- Master/texmf-dist/scripts/texlive/fmtutil.pl | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/Master/texmf-dist/scripts/texlive/fmtutil.pl b/Master/texmf-dist/scripts/texlive/fmtutil.pl index b1cc847e81e..2823ee3b487 100755 --- a/Master/texmf-dist/scripts/texlive/fmtutil.pl +++ b/Master/texmf-dist/scripts/texlive/fmtutil.pl @@ -3,7 +3,7 @@ # fmtutil - utility to maintain format files. # (Maintained in TeX Live:Master/texmf-dist/scripts/texlive.) # -# Copyright 2014-2020 Norbert Preining +# Copyright 2014-2021 Norbert Preining # This file is licensed under the GNU General Public License version 2 # or any later version. # @@ -103,7 +103,6 @@ our %opts = ( quiet => 0 , strict => 1 ); my @cmdline_cmds = ( # in same order as help message "all", "missing", - "refresh", "byengine=s", "byfmt=s", "byhyphen=s", @@ -123,6 +122,7 @@ our @cmdline_options = ( # in same order as help message "no-error-if-no-format", "nohash", "recorder", + "refresh", "strict!", "quiet|silent|q", "catcfg", @@ -202,8 +202,16 @@ sub main { . "Try $prg --help if you need it.\n"); return 1; } elsif (@cmds == 0) { - print_error("no command specified; try $prg --help if you need it.\n"); - return 1; + if ($opts{'refresh'}) { + # backward compatibility: till 2021 we had --refresh as a command + # but now we allow combining it with --byfmt etc + # In case that --refresh was given without any other command, we + # treat it as --all --refresh as it was the case till the change. + $opts{'all'} = 1; + } else { + print_error("no command specified; try $prg --help if you need it.\n"); + return 1; + } } } @@ -288,9 +296,6 @@ sub main { } elsif ($opts{'byhyphen'}) { return callback_build_formats('byhyphen', $opts{'byhyphen'}); - } elsif ($opts{'refresh'}) { - return callback_build_formats('refresh'); - } elsif ($opts{'missing'}) { return callback_build_formats('missing'); @@ -473,6 +478,12 @@ sub select_and_rebuild_format { $doit = 1 if ($what eq 'missing' && ! -r "$destdir/$fmtfile"); $doit = 1 if ($what eq 'byengine' && $eng eq $whatarg); $doit = 1 if ($what eq 'byfmt' && $fmt eq $whatarg); + # + # Deal with the --refresh option + # 2021 changed behavior that --refresh can be used with all other format + # selection cmd line args. + $doit = 0 if ($opts{'refresh'} && ! -r "$destdir/$fmtfile"); + # # TODO # original fmtutil.sh was stricter about existence of the hyphen file # not sure how we proceed here; let's implicitly ignore. @@ -1338,6 +1349,7 @@ Options: --no-strict exit successfully even if a format fails to build --nohash don't update ls-R files --recorder pass the -recorder option and save .fls files + --refresh recreate only existing format files --quiet be silent --catcfg (does nothing, exists for compatibility) --dolinks (does nothing, exists for compatibility) @@ -1347,7 +1359,6 @@ Options: Commands: --all recreate all format files --missing create all missing format files - --refresh recreate only existing format files --byengine ENGINE (re)create formats built with ENGINE --byfmt FORMAT (re)create format FORMAT --byhyphen HYPHENFILE (re)create formats that depend on HYPHENFILE -- cgit v1.2.3