From bf026a233643ee44ad14a8dcdc7a003f10b3af7b Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 23 Nov 2014 18:05:32 +0000 Subject: * install-tl (run_postinst_cmd): new fn. (do_postinst_stuff): call it; accumulate error count. * TLUtils.pm (wsystem): call system and warn if failure. * tl-update-tlnet: reimplement --no-consistency. git-svn-id: svn://tug.org/texlive/trunk@35647 c570f23f-e606-0410-a88d-b1316a301751 --- Master/install-tl | 78 +++++++++++++++++++++------------------- Master/tlpkg/TeXLive/TLUtils.pm | 53 ++++++++++++++++----------- Master/tlpkg/bin/tl-update-tlnet | 12 ++++--- 3 files changed, 82 insertions(+), 61 deletions(-) diff --git a/Master/install-tl b/Master/install-tl index 31ae2249b91..732e1199c01 100755 --- a/Master/install-tl +++ b/Master/install-tl @@ -48,7 +48,7 @@ use Pod::Usage; use TeXLive::TLUtils qw(platform platform_desc sort_archs which getenv win32 unix info log debug tlwarn ddebug tldie - get_system_tmpdir member process_logging_options rmtree + get_system_tmpdir member process_logging_options rmtree wsystem mkdirhier make_var_skeleton make_local_skeleton install_package copy install_packages dirname setup_programs native_slashify forward_slashify); use TeXLive::TLPOBJ; @@ -787,11 +787,27 @@ sub do_installation { return $errcount; } +sub run_postinst_cmd { + my ($cmd) = @_; + + info ("running $cmd ..."); + my ($out,$ret) = TeXLive::TLUtils::run_cmd ("$cmd 2>&1"); + info ("done\n"); + log ($out); + + if ($ret != 0) { + tlwarn ("$0: $cmd failed: $!\n"); + $ret = 1; # be sure we don't overflow the sum on anything crazy + } + + return $ret; +} + # # Make texmf.cnf, backup directory, cleanups, path setting, and # (most importantly) post-install subprograms: mktexlsr, fmtutil, -# and more. Return count of errors detected, or zero. +# and more. Return count of errors detected, hopefully zero. sub do_postinst_stuff { my $TEXDIR = "$vars{'TEXDIR'}"; my $TEXMFSYSVAR = "$vars{'TEXMFSYSVAR'}"; @@ -831,7 +847,7 @@ sub do_postinst_stuff { if (defined($ENV{'TEXMFCNF'})) { print "WARNING: environment variable TEXMFCNF is set. You should know what you are doing. -We will remove that for the post install actions, but all further +We will unset it for the post-install actions, but all further operations might be disturbed.\n\n"; } foreach $tmv (@TMFVARS) { @@ -870,8 +886,8 @@ operations might be disturbed.\n\n"; my $usedtlpdb = $vars{'in_place'} ? $tlpdb : $localtlpdb; if (win32()) { - debug "Actual environment:\n".`set`."\n\n"; - debug 'Effective TEXMFCNF: '.`kpsewhich -expand-path=\$TEXMFCNF`."\n"; + debug("Actual environment:\n" . `set` ."\n\n"); + debug("Effective TEXMFCNF: " . `kpsewhich -expand-path=\$TEXMFCNF` ."\n"); } if (win32() and !$vars{'portable'} and !$vars{'in_place'}) { @@ -882,11 +898,9 @@ operations might be disturbed.\n\n"; # Step 4: run the programs my $errcount = 0; - # xxxx errcount -- check all these things and add any errors. if (!$vars{'in_place'}) { - info("running mktexlsr $TEXDIR/texmf-dist ...\n"); - system('mktexlsr', "$TEXDIR/texmf-dist"); + $errcount += wsystem("running", 'mktexlsr', "$TEXDIR/texmf-dist"); } # we have to generate the various config file. That could be done with @@ -919,46 +933,38 @@ operations might be disturbed.\n\n"; "$TEXMFSYSVAR/tex/generic/config/language.dat.lua", "$TEXMFLOCAL/tex/generic/config/language-local.dat.lua"); - info("running mktexlsr $TEXMFSYSVAR $TEXMFSYSCONFIG $TEXDIR/texmf-dist ...\n"); - system("mktexlsr", $TEXMFSYSVAR, $TEXMFSYSCONFIG, "$TEXDIR/texmf-dist"); + $errcount += wsystem("running", "mktexlsr", + $TEXMFSYSVAR, $TEXMFSYSCONFIG, "$TEXDIR/texmf-dist"); - info("running updmap-sys..."); - # system('updmap-sys', '--nohash'); - log(`updmap-sys --nohash 2>&1`); - info("done\n"); + $errcount += run_postinst_cmd("updmap-sys --nohash"); # now work through the options if specified at all # letter instead of a4 if ($vars{'option_letter'}) { - # set paper size, but do not execute any post actions, in this case - # it would be: - # - mktexlsr - # - fmtutil-sys -all - info("setting default paper size to letter\n"); - log(`tlmgr --no-execute-actions paper letter 2>&1`); + # set paper size, but do not execute any post actions, which in this + # case would be mktexlsr and fmtutil-sys -all; clearly premature + # here in the installer. + info("setting default paper size to letter:\n"); + $errcount += run_postinst_cmd("tlmgr --no-execute-actions paper letter"); } # now rerun mktexlsr for updmap-sys and tlmgr paper letter updates. - info("re-running mktexlsr $TEXMFSYSVAR $TEXMFSYSCONFIG...\n"); - system("mktexlsr", $TEXMFSYSVAR, $TEXMFSYSCONFIG); + $errcount += wsystem("re-running", "mktexlsr", $TEXMFSYSVAR,$TEXMFSYSCONFIG); - # luatex/context + # luatex/context setup. if (exists($install{"context"}) && $install{"context"} == 1 && !exists $ENV{"TEXLIVE_INSTALL_NO_CONTEXT_CACHE"}) { - info("setting up ConTeXt MkIV cache with mtxrun --generate ..."); - system('mtxrun', '--generate'); - info("done\n"); + info("setting up ConTeXt cache:\n"); + $errcount += run_postinst_cmd("mtxrun --generate"); } # all formats option if ($vars{'option_fmt'}) { - info("pre-generating all format files (fmtutil-sys --all), be patient..."); - log(`fmtutil-sys $common_fmtutil_args --all 2>&1`); - info("done\n"); + info("pre-generating all format files, be patient...\n"); + $errcount += run_postinst_cmd("fmtutil-sys $common_fmtutil_args --all"); } - # # do path adjustments: On Windows add/remove to PATH etc, # on Unix set symlinks # for portable, this option should be unset @@ -987,12 +993,12 @@ sub do_tlpdb_postactions { my $usedtlpdb = $vars{'in_place'} ? $tlpdb : $localtlpdb; foreach my $package ($usedtlpdb->list_packages) { - &TeXLive::TLUtils::do_postaction("install", - $usedtlpdb->get_package($package), - $vars{'option_file_assocs'}, - $vars{'option_menu_integration'}, - $vars{'option_desktop_integration'}, - $vars{'option_post_code'}); + TeXLive::TLUtils::do_postaction("install", + $usedtlpdb->get_package($package), + $vars{'option_file_assocs'}, + $vars{'option_menu_integration'}, + $vars{'option_desktop_integration'}, + $vars{'option_post_code'}); } info ("finished with package-specific postactions\n"); diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm index 2b77add8f67..7668697c4c8 100644 --- a/Master/tlpkg/TeXLive/TLUtils.pm +++ b/Master/tlpkg/TeXLive/TLUtils.pm @@ -27,7 +27,7 @@ C -- utilities used in the TeX Live infrastructure use TeXLive::TLUtils; -=head2 Platform Detection +=head2 Platform detection TeXLive::TLUtils::platform(); TeXLive::TLUtils::platform_name($canonical_host); @@ -35,17 +35,18 @@ C -- utilities used in the TeX Live infrastructure TeXLive::TLUtils::win32(); TeXLive::TLUtils::unix(); -=head2 System Tools +=head2 System tools TeXLive::TLUtils::getenv($string); TeXLive::TLUtils::which($string); TeXLive::TLUtils::get_system_tmpdir(); TeXLive::TLUtils::tl_tmpdir(); TeXLive::TLUtils::xchdir($dir); + TeXLive::TLUtils::wsystem($msg,@args); TeXLive::TLUtils::xsystem(@args); TeXLive::TLUtils::run_cmd($cmd); -=head2 File Utilities +=head2 File utilities TeXLive::TLUtils::dirname($path); TeXLive::TLUtils::basename($path); @@ -65,7 +66,7 @@ C -- utilities used in the TeX Live infrastructure TeXLive::TLUtils::nulldev(); TeXLive::TLUtils::get_full_line($fh); -=head2 Installer Functions +=head2 Installer functions TeXLive::TLUtils::make_var_skeleton($path); TeXLive::TLUtils::make_local_skeleton($path); @@ -175,6 +176,7 @@ BEGIN { &create_mirror_list &extract_mirror_entry &tlmd5 + &wsystem &xsystem &run_cmd &announce_execute_actions @@ -207,8 +209,8 @@ use TeXLive::TLConfig; $::opt_verbosity = 0; # see process_logging_options - -=head2 Platform Detection + +=head2 Platform detection =over 4 @@ -483,7 +485,7 @@ sub get_system_tmpdir { =item C -Create a temporary directory which is cleaned up as soon as the program +Create a temporary directory which is removed when the program is terminated. =cut @@ -505,9 +507,28 @@ sub xchdir { } +=item C + +Call C about what is being done starting with C<$msg>, then run +C; C if unsuccessful and return the exit status. + +=cut + +sub wsystem { + my ($msg,@args) = @_; + info("$msg @args ...\n"); + my $status = system(@args); + if ($status != 0) { + tlwarn("$0: command failed: @args: $!\n"); + } + return $status; +} + + =item C -Run C and die if unsuccessful. +Call C about what is being done, then run C, and +die if unsuccessful. =cut @@ -524,7 +545,7 @@ sub xsystem { =item C -runs shell CMD and captures its output. Returns a list with CMD's +Run shell command C<$cmd> and captures its output. Returns a list with CMD's output as the first element and the return value (exit code) as second. =cut @@ -542,8 +563,6 @@ sub run_cmd { } - - =back =head2 File Utilities @@ -1045,9 +1064,6 @@ sub touch { } } - - - =item C @@ -2352,7 +2368,6 @@ sub read_file_ignore_cr { return $ret; } - =item C @@ -2673,7 +2688,7 @@ sub get_full_line { return $line . $cont; } - + =back =head2 Installer Functions @@ -2728,7 +2743,6 @@ sub make_local_skeleton { mkdirhier "$prefix/web2c"; } - =item C @@ -3074,7 +3088,7 @@ sub parse_AddFormat_line { return %ret; } - + =back =head2 Miscellaneous @@ -3930,8 +3944,6 @@ sub sort_archs ($$) { $aa cmp $bb ; } -############################################# -# # Taken from Text::ParseWords # sub quotewords { @@ -4086,7 +4098,6 @@ sub mktexupd { return $hash; } - =back =cut 1; diff --git a/Master/tlpkg/bin/tl-update-tlnet b/Master/tlpkg/bin/tl-update-tlnet index 07c97a4fa36..63d85a834fc 100755 --- a/Master/tlpkg/bin/tl-update-tlnet +++ b/Master/tlpkg/bin/tl-update-tlnet @@ -11,7 +11,7 @@ unset LS_COLORS yyyy=2014 -check_consistency=check-tlnet-consistency +check_consistency=true chicken=false critical= pretest=false @@ -26,8 +26,8 @@ while test $# -gt 0; do --critical) critical=--all;; --dry-run|-n) chicken=true;; --master) shift; Master=$1;; - --no-consistency) check_consistency=true;; # takes a long time. - --no-testinstall|-N) testinstall=false;; # and no updates; quit early. + --no-consistency) check_consistency=false;; # takes a long time. + --no-testinstall|-N) testinstall=false;; # and no updates; quit early. --pretest) tlweb=/home/ftp/texlive/tlpretest;; --recreate) recreate=--recreate;; --scheme) shift; scheme=$1;; @@ -192,10 +192,14 @@ if test $failure = false; then for cmd in \ "$tltryinst/$yyyy/bin/*/tlmgr --repository $tltry update --list" \ "$tltryinst/$yyyy/bin/*/updmap-sys -n" \ - "$Master/tlpkg/bin/$check_consistency --location=$tltry" \ + "$Master/tlpkg/bin/check-tlnet-consistency --location=$tltry" \ "$Master/tlpkg/bin/tl-compare-tlpdbs $critical $tltry/tlpkg/texlive.tlpdb" \ ; do cmdname=`echo "$cmd" | awk '{print $1}'` + if echo "$cmdname" | grep check-tlnet-consistency >/dev/null; then + # skip consistency check if requested (for development only). + $check_consistency || continue + fi basecmd=`basename $cmdname` echo "$0: Running $basecmd ($cmd)" outfile=/tmp/tlnet.$basecmd -- cgit v1.2.3