diff options
author | Norbert Preining <preining@logic.at> | 2017-04-15 00:12:46 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2017-04-15 00:12:46 +0000 |
commit | 15b38c41d0da13e4c1b229c405487df790df5601 (patch) | |
tree | e48fedee5d5e4f36ad92c32c70a6f317ef92952d /Master | |
parent | e4b714027f49e10d08fd341825ebaa8c5bd8458c (diff) |
user/sys mode for fmtutil and updmap
add cmd line options -user
require either -user or -sys
move check/setup function to TLUtils.pm, reuse in both
adjust documentation
git-svn-id: svn://tug.org/texlive/trunk@43793 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rwxr-xr-x | Master/texmf-dist/scripts/texlive/fmtutil.pl | 58 | ||||
-rwxr-xr-x | Master/texmf-dist/scripts/texlive/updmap.pl | 54 | ||||
-rw-r--r-- | Master/tlpkg/TeXLive/TLConfig.pm | 8 | ||||
-rw-r--r-- | Master/tlpkg/TeXLive/TLUtils.pm | 52 |
4 files changed, 105 insertions, 67 deletions
diff --git a/Master/texmf-dist/scripts/texlive/fmtutil.pl b/Master/texmf-dist/scripts/texlive/fmtutil.pl index 8677466d416..eccba92e2c7 100755 --- a/Master/texmf-dist/scripts/texlive/fmtutil.pl +++ b/Master/texmf-dist/scripts/texlive/fmtutil.pl @@ -112,6 +112,7 @@ my @cmdline_cmds = ( # in same order as help message our @cmdline_options = ( # in same order as help message "sys", + "user", "cnffile=s@", "fmtdir=s", "no-engine-subdir", @@ -151,6 +152,12 @@ sub main { # first generated filename after successful generation to stdout then # (and nothing else), since kpathsea can only deal with one. $mktexfmtMode = 1; + + # TODO TODO + # which mode are we running in? + # what happens if root runs mktexfmt? + $opts{'user'} = 1; + GetOptions ( "help" => \$opts{'help'}, "version" => \$opts{'version'} ) or die "Unknown option in mktexfmt command line arguments\n"; if ($ARGV[0]) { @@ -198,7 +205,10 @@ sub main { } # these two functions should go to TLUtils (for use in updmap) - check_hidden_sysmode(); + ($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'}; # we do changes always in the used config file with the highest priority @@ -964,32 +974,6 @@ sub read_fmtutil_file { # and also be reused in updmap.pl!!! -sub check_hidden_sysmode { - # - # check if we are in *hidden* sys mode, in which case we switch - # to sys mode - # Nowdays we use -sys switch instead of simply overriding TEXMFVAR - # and TEXMFCONFIG - # This is used to warn users when they run updmap in usermode the first time. - # But it might happen that this script is called via another wrapper that - # sets TEXMFCONFIG and TEXMFVAR, and does not pass on the -sys option. - # for this case we check whether the SYS and non-SYS variants agree, - # and if, then switch to sys mode (with a warning) - if (($TEXMFSYSCONFIG eq $TEXMFCONFIG) && ($TEXMFSYSVAR eq $TEXMFVAR)) { - if (!$opts{'sys'}) { - print_warning("hidden sys mode found, switching to sys mode.\n"); - $opts{'sys'} = 1; - } - } - - if ($opts{'sys'}) { - # we are running as updmap-sys, make sure that the right tree is used - $texmfconfig = $TEXMFSYSCONFIG; - $texmfvar = $TEXMFSYSVAR; - } -} - - # sets global $alldata->{'changes_config'} to the config file to be # changed if requested. # @@ -1264,9 +1248,10 @@ sub version { sub help { my $usage = <<"EOF"; -Usage: $prg [OPTION] ... [COMMAND] - or: $prg-sys [OPTION] ... [COMMAND] - or: mktexfmt FORMAT.fmt|BASE.base|FMTNAME.EXT +Usage: $prg [-user|-sys] [OPTION] ... [COMMAND] + or: $prg-sys [OPTION] ... [COMMAND] + or: $prg-user [OPTION] ... [COMMAND] + or: mktexfmt FORMAT.fmt|BASE.base|FMTNAME.EXT Rebuild and manage TeX fmts and Metafont bases, collectively called "formats" here. (MetaPost no longer uses the past-equivalent "mems".) @@ -1285,7 +1270,8 @@ By default, the return status is zero if all formats requested are successfully built, else nonzero. Options: - --sys use TEXMFSYS{VAR,CONFIG} instead of TEXMF{VAR,CONFIG} + --sys use TEXMFSYS{VAR,CONFIG} + --user use TEXMF{VAR,CONFIG} --cnffile FILE read FILE instead of fmtutil.cnf (can be given multiple times, in which case all the files are used) @@ -1341,7 +1327,7 @@ Explanation of trees and files normally used: TEXMFLOCAL \$TEXLIVE/texmf-local/web2c/fmtutil.cnf TEXMFDIST \$TEXLIVE/YYYY/texmf-dist/web2c/fmtutil.cnf - For fmtutil: + For fmtutil-user: TEXMFCONFIG \$HOME/.texliveYYYY/texmf-config/web2c/fmtutil.cnf TEXMFVAR \$HOME/.texliveYYYY/texmf-var/web2c/fmtutil.cnf TEXMFHOME \$HOME/texmf/web2c/fmtutil.cnf @@ -1409,12 +1395,14 @@ Disabling formats: --no-error-if-no-engine option exists, since luajittex cannot be compiled on all platforms.) -fmtutil vs. fmtutil-sys (fmtutil --sys): +fmtutil-user (fmtutil -user) vs. fmtutil-sys (fmtutil -sys): - When fmtutil-sys is run or the command line option --sys is used, + 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. + fmtutil-sys and fmtutil-user. + + See $TeXLive::TLConfig::SYSUSERURL 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. diff --git a/Master/texmf-dist/scripts/texlive/updmap.pl b/Master/texmf-dist/scripts/texlive/updmap.pl index be20d810d59..cc3b14a8533 100755 --- a/Master/texmf-dist/scripts/texlive/updmap.pl +++ b/Master/texmf-dist/scripts/texlive/updmap.pl @@ -73,6 +73,7 @@ my $updLSR; my @cmdline_options = ( "sys", + "user", "listfiles", "cnffile=s@", "copy", @@ -172,27 +173,9 @@ sub main { exit (0); } - # check if we are in *hidden* sys mode, in which case we switch - # to sys mode - # Nowdays we use -sys switch instead of simply overriding TEXMFVAR - # and TEXMFCONFIG - # This is used to warn users when they run updmap in usermode the first time. - # But it might happen that this script is called via another wrapper that - # sets TEXMFCONFIG and TEXMFVAR, and does not pass on the -sys option. - # for this case we check whether the SYS and non-SYS variants agree, - # and if, then switch to sys mode (with a warning) - if (($TEXMFSYSCONFIG eq $TEXMFCONFIG) && ($TEXMFSYSVAR eq $TEXMFVAR)) { - if (!$opts{'sys'}) { - print_warning("hidden sys mode found, switching to sys mode.\n"); - $opts{'sys'} = 1; - } - } - - if ($opts{'sys'}) { - # we are running as updmap-sys, make sure that the right tree is used - $texmfconfig = $TEXMFSYSCONFIG; - $texmfvar = $TEXMFSYSVAR; - } + ($texmfconfig, $texmfvar) = + TeXLive::TLUtils::setup_sys_user_mode($prg, \%opts, + $TEXMFCONFIG, $TEXMFSYSCONFIG, $TEXMFVAR, $TEXMFSYSVAR); if ($opts{'dvipdfmoutputdir'} && !defined($opts{'dvipdfmxoutputdir'})) { $opts{'dvipdfmxoutputdir'} = $opts{'dvipdfmoutputdir'}; @@ -1342,15 +1325,17 @@ sub mkMaps { print_and_log(" WARNING: you are switching to updmap's per-user mappings. -You have run updmap (as opposed to updmap-sys) for the first time; this +You have run updmap-user (as opposed to updmap-sys) for the first time; this has created configuration files which are local to your personal account. Any changes in system map files will *not* be automatically reflected in your files; furthermore, running updmap-sys will no longer have any -effect for you. As a consequence, you have to rerun updmap yourself +effect for you. As a consequence, you have to rerun updmap-user yourself after any change in the system directories; for example, if a new font package is added. +See $TeXLive::TLConfig::SYSUSERURL for details. + If you want to undo this, remove the files mentioned above. (Run $prg --help for full documentation of updmap.) @@ -2240,8 +2225,9 @@ sub version { sub help { my $usage = <<"EOF"; -Usage: $prg [OPTION] ... [COMMAND] - or: $prg-sys [OPTION] ... [COMMAND] +Usage: $prg [-user|-sys] [OPTION] ... [COMMAND] + or: $prg-user [OPTION] ... [COMMAND] + or: $prg-sys [OPTION] ... [COMMAND] Update the default font map files used by pdftex (pdftex.map), dvips (psfonts.map), and dvipdfm(x), and optionally pxdvi, as determined by @@ -2252,12 +2238,15 @@ Among other things, these map files are used to determine which fonts should be used as bitmaps and which as outlines, and to determine which font files are included, typically subsetted, in the PDF or PostScript output. -updmap-sys is intended to affect the system-wide configuration, while -updmap affects personal configuration files only, overriding the system -files. As a consequence, once updmap has been run, even a single time, +updmap-sys (or updmap -sys) is intended to affect the system-wide +configuration, while updmap-user (or updmap -user) affects personal +configuration files only, overriding the system files. +As a consequence, once updmap-user has been run, even a single time, running updmap-sys no longer has any effect. (updmap-sys issues a warning in this situation.) +See $TeXLive::TLConfig::SYSUSERURL for details. + By default, the TeX filename database (ls-R) is also updated. The updmap system is regrettably complicated, for both inherent and @@ -2289,6 +2278,7 @@ Options: --nomkmap do not recreate map files --nohash do not run texhash --sys affect system-wide files (equivalent to updmap-sys) + --user affect personal files (equivalent to updmap-user) -n, --dry-run only show the configuration, no output --quiet, --silent reduce verbosity @@ -2323,7 +2313,7 @@ The main output: only and are not like other map files. dvipdfmx reads pdftex.map for the map entries for non-Kanji fonts. - If no option is given, so the invocation is just "updmap" or + If no option is given, so the invocation is just "updmap-user" or "updmap-sys", these output files are always recreated. Otherwise, if an option such as --enable or --disable is given, the @@ -2402,7 +2392,7 @@ Explanation of trees and files normally used: TEXMFLOCAL \$TEXLIVE/texmf-local/web2c/updmap.cfg TEXMFDIST \$TEXLIVE/YYYY/texmf-dist/web2c/updmap.cfg - For updmap: + For updmap-user: TEXMFCONFIG \$HOME/.texliveYYYY/texmf-config/web2c/updmap.cfg TEXMFVAR \$HOME/.texliveYYYY/texmf-var/web2c/updmap.cfg TEXMFHOME \$HOME/texmf/web2c/updmap.cfg @@ -2484,11 +2474,11 @@ Listing of maps: (again separated by tab) containing '(not available)' for those map files that cannot be found. -updmap vs. updmap-sys: +updmap-user vs. updmap-sys: When updmap-sys is run, TEXMFSYSCONFIG and TEXMFSYSVAR are used instead of TEXMFCONFIG and TEXMFVAR, respectively. This is the - primary difference between updmap-sys and updmap. + primary difference between updmap-sys and updmap-user. 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. diff --git a/Master/tlpkg/TeXLive/TLConfig.pm b/Master/tlpkg/TeXLive/TLConfig.pm index d10e8fa43e4..45835dc1cf7 100644 --- a/Master/tlpkg/TeXLive/TLConfig.pm +++ b/Master/tlpkg/TeXLive/TLConfig.pm @@ -46,6 +46,7 @@ BEGIN { $ChecksumLength $ChecksumProgram $ChecksumExtension + $SYSUSERURL ); @EXPORT = @EXPORT_OK; } @@ -218,6 +219,9 @@ $ChecksumProgram = "sha512sum"; # The extension of the checksum file $ChecksumExtension = "sha512"; +# +our $SYSUSERURL = 'http://tug.org/texlive/sys-user-scripts.html'; + 1; @@ -301,6 +305,10 @@ The texmf-tree name that can be relocated, defaults to C<texmf-dist>. The string that replaces the C<RelocTree> in the tlpdb if a package is relocated, defaults to C<RELOC>". +=item C<$TeXLive::TLConfig::SYSUSERURL> + +URL pointing to explanations concerning -sys and -user mode. + =back =head1 SEE ALSO diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm index a5b58a4791d..e645cc07b12 100644 --- a/Master/tlpkg/TeXLive/TLUtils.pm +++ b/Master/tlpkg/TeXLive/TLUtils.pm @@ -97,6 +97,7 @@ C<TeXLive::TLUtils> -- utilities used in TeX Live infrastructure TeXLive::TLUtils::report_tlpdb_differences(\%ret); TeXLive::TLUtils::tlnet_disabled_packages($root); TeXLive::TLUtils::mktexupd(); + TeXLive::TLUtils::setup_sys_user_mode($optsref,$tmfc, $tmfsc, $tmfv, $tmfsv); =head1 DESCRIPTION @@ -180,6 +181,7 @@ BEGIN { &report_tlpdb_differences &setup_persistent_downloads &mktexupd + &setup_sys_user_mode &nulldev &get_full_line &sort_archs @@ -3980,6 +3982,56 @@ sub mktexupd { return $hash; } + +=item C<check_sys_user_mode($user,$sys,$tmfc, $tmfsc, $tmfv, $tmfsv)> + +=cut + +sub setup_sys_user_mode { + my ($prg, $optsref, $TEXMFCONFIG, $TEXMFSYSCONFIG, + $TEXMFVAR, $TEXMFSYSVAR) = @_; + + if ($optsref->{'user'} && $optsref->{'sys'}) { + print STDERR "$prg [ERROR]: only one of -user and -sys can be used.\n"; + exit(1); + } + + # check if we are in *hidden* sys mode, in which case we switch + # to sys mode + # Nowdays we use -sys switch instead of simply overriding TEXMFVAR + # and TEXMFCONFIG + # This is used to warn users when they run updmap in usermode the first time. + # But it might happen that this script is called via another wrapper that + # sets TEXMFCONFIG and TEXMFVAR, and does not pass on the -sys option. + # for this case we check whether the SYS and non-SYS variants agree, + # and if, then switch to sys mode (with a warning) + if (($TEXMFSYSCONFIG eq $TEXMFCONFIG) && ($TEXMFSYSVAR eq $TEXMFVAR)) { + if ($optsref->{'user'}) { + print STDERR "$prg [ERROR]: -user mode but path setup is -sys type, bailing out.\n"; + exit(1); + } + if (!$optsref->{'sys'}) { + print STDERR "$prg [WARNING]: hidden sys mode found, switching to sys mode.\n" if (!$optsref->{'quiet'}); + $optsref->{'sys'} = 1; + } + } + + my ($texmfconfig, $texmfvar); + if ($optsref->{'sys'}) { + # we are running as updmap-sys, make sure that the right tree is used + $texmfconfig = $TEXMFSYSCONFIG; + $texmfvar = $TEXMFSYSVAR; + } elsif ($optsref->{'user'}) { + $texmfconfig = $TEXMFCONFIG; + $texmfvar = $TEXMFVAR; + } else { + print STDERR "$prg [ERROR]: Either -user or -sys mode is required.\n" . + "See $TeXLive::TLConfig::SYSUSERURL for details!\n"; + exit(1); + } + return ($texmfconfig, $texmfvar); +} + =back =cut 1; |