From 2b4be1f23b20f9deb5c681e6fa65ad4fe9d782dc Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Wed, 5 May 2021 23:25:14 +0900 Subject: fmtutil.pl: wording fixes and mktexfmt --help/version support By Karl Berry. --- Master/texmf-dist/scripts/texlive/fmtutil.pl | 118 +++++++++++++-------------- 1 file changed, 57 insertions(+), 61 deletions(-) (limited to 'Master') diff --git a/Master/texmf-dist/scripts/texlive/fmtutil.pl b/Master/texmf-dist/scripts/texlive/fmtutil.pl index 3882fc2a87e..03785755c3a 100755 --- a/Master/texmf-dist/scripts/texlive/fmtutil.pl +++ b/Master/texmf-dist/scripts/texlive/fmtutil.pl @@ -94,11 +94,12 @@ if (win32()) { } # -# these need to be our since they are used from the -# functions in TLUtils.pm +# these need to be "our" variables since they are used from the +# functions in TLUtils.pm. our $texmfconfig = $TEXMFCONFIG; our $texmfvar = $TEXMFVAR; our $alldata; + # command line options with defaults # 20160623 - switch to turn on strict mode our %opts = ( quiet => 0 , strict => 1 ); @@ -169,8 +170,16 @@ sub main { # up in TEXMFSYSVAR which is fine. $opts{'user'} = 1; + my @save_argv = @ARGV; GetOptions ( "help" => \$opts{'help'}, "version" => \$opts{'version'} ) - || die "$prg: Unknown option in mktexfmt command line arguments.\n"; + || die "$prg: Unknown option in mktexfmt command line: @save_argv\n"; + + help() if $opts{'help'}; + if ($opts{'version'}) { + print version(); + exit 0; # no final print_info + } + if ($ARGV[0]) { if ($ARGV[0] =~ m/^(.*)\.(fmt|mem|base?)$/) { $opts{'byfmt'} = $1; @@ -230,10 +239,9 @@ sub main { || 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) = - TeXLive::TLUtils::setup_sys_user_mode($prg, \%opts, - $TEXMFCONFIG, $TEXMFSYSCONFIG, $TEXMFVAR, $TEXMFSYSVAR); + ($texmfconfig, $texmfvar) + = TeXLive::TLUtils::setup_sys_user_mode($prg, \%opts, + $TEXMFCONFIG, $TEXMFSYSCONFIG, $TEXMFVAR, $TEXMFSYSVAR); determine_config_files("fmtutil.cnf"); my $changes_config_file = $alldata->{'changes_config'}; @@ -504,23 +512,25 @@ sub callback_build_formats { ************************************************************* * * * WARNING: you are switching to fmtutil's per-user formats. * -* Please read the following explanations. * +* Please read the following warnings! * * * ************************************************************* -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. +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. +From now on, 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. -See http://tug.org/texlive/scripts-sys-user.html for details. +As a consequence, you yourself have to rerun fmtutil-user after any +change in the system directories. For example, when one of the LaTeX or +other format source files changes, which happens frequently. +See https://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.) +Run $prg --help for full documentation of fmtutil. "); } # return @@ -1179,30 +1189,14 @@ sub determine_config_files { } } # - # user mode (no -sys): - # ==================== - # TEXMFCONFIG $HOME/.texliveYYYY/texmf-config/web2c/$fn - # TEXMFVAR $HOME/.texliveYYYY/texmf-var/web2c/$fn - # TEXMFHOME $HOME/texmf/web2c/$fn - # TEXMFSYSCONFIG $TEXLIVE/YYYY/texmf-config/web2c/$fn - # TEXMFSYSVAR $TEXLIVE/YYYY/texmf-var/web2c/$fn - # TEXMFLOCAL $TEXLIVE/texmf-local/web2c/$fn - # TEXMFDIST $TEXLIVE/YYYY/texmf-dist/web2c/$fn - # - # root mode (--sys): - # ================== - # TEXMFSYSCONFIG $TEXLIVE/YYYY/texmf-config/web2c/$fn - # TEXMFSYSVAR $TEXLIVE/YYYY/texmf-var/web2c/$fn - # TEXMFLOCAL $TEXLIVE/texmf-local/web2c/$fn - # TEXMFDIST $TEXLIVE/YYYY/texmf-dist/web2c/$fn - # - @{$opts{'cnffile'}} = @used_files; + # See help message for list of locations. + @{$opts{'cnffile'}} = @used_files; # # determine the config file that we will use for changes # if in the list of used files contains either one from - # TEXMFHOME or TEXMFCONFIG (which is TEXMFSYSCONFIG in the -sys case) + # TEXMFHOME or TEXMFCONFIG (TEXMFSYSCONFIG in the -sys case) # then use the *top* file (which will be either one of the two), - # if none of the two exists, create a file in TEXMFCONFIG and use it + # if neither of the two exists, create a file in TEXMFCONFIG and use it. my $use_top = 0; for my $f (@used_files) { if ($f =~ m!(\Q$TEXMFHOME\E|\Q$texmfconfig\E)/web2c/$fn!) { @@ -1410,16 +1404,16 @@ Usage: $prg [-user|-sys] [OPTION] ... [COMMAND] Rebuild and manage TeX fmts and Metafont bases, collectively called "formats" here. (MetaPost no longer uses the past-equivalent "mems".) +If not operating in mktexfmt mode, exactly one command must be given, +filename suffixes should generally not be specified, no non-option +arguments are allowed, and multiple formats can be generated. + If the command name ends in mktexfmt, only one format can be created. The only options supported are --help and --version, and the command line must be either a format name, with extension, or a plain name that is passed as the argument to --byfmt (see below). The full name of the generated file (if any) is written to stdout, and nothing else. -If not operating in mktexfmt mode, exactly one command must be given, -extensions should generally not be specified, no non-option arguments -are allowed, and multiple formats can be generated, as follows. - By default, the return status is zero if all formats requested are successfully built, else nonzero. @@ -1429,12 +1423,12 @@ 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 + --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 + --no-error-if-no-format exit successfully if no format is selected --no-error-if-no-engine=ENGINE1,ENGINE2,... - exit successfully even if a required engine + exit successfully even if a required ENGINE is missing, if it is included in the list. --no-strict exit successfully even if a format fails to build --nohash don't update ls-R files @@ -1453,8 +1447,8 @@ Commands: --byengine ENGINE (re)create formats built with ENGINE --byfmt FORMAT (re)create format FORMAT --byhyphen HYPHENFILE (re)create formats that depend on HYPHENFILE - --enablefmt FORMAT[/ENGINE] enable FORMAT, as built with ENGINE - --disablefmt FORMAT[/ENGINE] disable FORMAT, as built with ENGINE + --enablefmt FORMAT[/ENGINE] enable FORMAT, as built with ENGINE + --disablefmt FORMAT[/ENGINE] disable FORMAT, as built with ENGINE If multiple formats have the same name and different engines, /ENGINE specifier is required. --listcfg list (enabled and disabled) configurations, @@ -1468,7 +1462,7 @@ Explanation of trees and files normally used: 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. Files passed in via --cnffile are + order returned by kpsewhich. Files specified 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. @@ -1502,26 +1496,28 @@ Explanation of trees and files normally used: Where formats are written: By default, format files are (re)written in TEXMFSYSVAR/ENGINE by - fmtutil-sys, and TEXMFVAR/ENGINE by fmtutil, where /ENGINE is a - subdirectory named for the engine used, such as "pdftex". + fmtutil-sys, and TEXMFVAR/ENGINE by fmtutil-user, where /ENGINE is a + subdirectory named for the engine used, such as "pdftex". For + mktexfmt, TEXMFSYSVAR is used if it is writable, else TEXMFVAR. If the --fmtdir=DIR option is specified, DIR is used instead of TEXMF[SYS]VAR, but the /ENGINE subdir is still used by default. - In any case, if the --no-engine-subdir option is specified, the - /ENGINE subdir is omitted. + If the --no-engine-subdir option is specified, the /ENGINE subdir is + omitted in all cases. Where configuration changes are saved: If config files are given on the command line, then the first one given will be used to save any changes from --enable or --disable. + If the config files are taken from kpsewhich output, then the - algorithm is more complex: + algorithm is more complicated: - 1) If \$TEXMFCONFIG/web2c/fmtutil.cnf or \$TEXMFHOME/web2c/fmtutil.cnf - appears in the list of used files, then the one listed first by - kpsewhich --all (equivalently, the one returned by kpsewhich - fmtutil.cnf), is used. + 1) If \$TEXMFCONFIG/web2c/fmtutil.cnf or + \$TEXMFHOME/web2c/fmtutil.cnf appears in the list of used files, + then the one listed first by kpsewhich --all (equivalently, the one + returned by "kpsewhich fmtutil.cnf"), is used. 2) If neither of the above two are present and changes are made, a new config file is created in \$TEXMFCONFIG/web2c/fmtutil.cnf. @@ -1551,16 +1547,16 @@ Disabling formats: #! luajitlatex luajittex language.dat,language.dat.lua lualatex.ini (As it happens, the luajittex-related formats are precisely why the --no-error-if-no-engine option exists, since luajittex cannot be - compiled on all platforms.) + compiled on all platforms. So this is not needed.) fmtutil-user (fmtutil -user) vs. fmtutil-sys (fmtutil -sys): - When fmtutil-sys is run or the command line option -sys is used, - TEXMFSYSCONFIG and TEXMFSYSVAR are used instead of TEXMFCONFIG and - TEXMFVAR, respectively. This is the primary difference between + When fmtutil-sys is run or the command line option -sys is used, + TEXMFSYSCONFIG and TEXMFSYSVAR are used instead of TEXMFCONFIG and + TEXMFVAR, respectively. This is the primary difference between fmtutil-sys and fmtutil-user. - See http://tug.org/texlive/scripts-sys-user.html for details. + See https://tug.org/texlive/scripts-sys-user.html for details. Other locations may be used if you give them on the command line, or these trees don't exist, or you are not using the original TeX Live. @@ -1573,7 +1569,7 @@ Supporting development binaries binaries. Report bugs to: tex-live\@tug.org -TeX Live home page: +TeX Live home page: EOF ; print &version(); -- cgit v1.2.3