summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-01-15 18:33:58 +0000
committerKarl Berry <karl@freefriends.org>2013-01-15 18:33:58 +0000
commit607c25d782c2e57a60ab2f2ecf30c12e238b44ec (patch)
treec6df6b996331fdba5123e248031971a8a6dcf59d
parent91e14a4070923303aec36198e1d237057b3401e9 (diff)
always save log file
git-svn-id: svn://tug.org/texlive/trunk@28843 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Build/source/texk/texlive/linked_scripts/tetex/ChangeLog6
-rwxr-xr-xBuild/source/texk/texlive/linked_scripts/tetex/fmtutil.sh121
2 files changed, 67 insertions, 60 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/tetex/ChangeLog b/Build/source/texk/texlive/linked_scripts/tetex/ChangeLog
index 459ffe2f408..7db3359c839 100644
--- a/Build/source/texk/texlive/linked_scripts/tetex/ChangeLog
+++ b/Build/source/texk/texlive/linked_scripts/tetex/ChangeLog
@@ -1,3 +1,9 @@
+2013-01-15 Karl Berry <karl@tug.org>
+
+ * fmtutil.sh (run_initex): save log file first,
+ even if the .fmt isn't built. Tweak message wordings.
+ Report from tljack, 12 Jan 2013 14:35:16.
+
2012-08-08 Peter Breitenlohner <peb@mppmu.mpg.de>
* fmtutil*, tcfmgr*, texconfig*, texlinks* (removed):
diff --git a/Build/source/texk/texlive/linked_scripts/tetex/fmtutil.sh b/Build/source/texk/texlive/linked_scripts/tetex/fmtutil.sh
index b9f97aa8998..0d75795c9d5 100755
--- a/Build/source/texk/texlive/linked_scripts/tetex/fmtutil.sh
+++ b/Build/source/texk/texlive/linked_scripts/tetex/fmtutil.sh
@@ -1,10 +1,11 @@
#!/bin/sh
# fmtutil - utility to maintain format files.
+# $Id$
# Public domain. Originally written by Thomas Esser.
# Run with --help for usage.
# program history:
-# further changes in texk/tetex/ChangeLog.
+# further changes in texk/texlive/ChangeLog.
# 2007-01-04 patch by JK to support $engine subdir (enabled by default)
# Fr Apr 8 19:15:05 CEST 2005 cleanup now has an argument for the return code
# Do Mar 02 10:42:31 CET 2006 add tmpdir to TEXFORMATS
@@ -67,7 +68,7 @@ export PATH
###############################################################################
# cleanup()
# clean up the temp area and exit with proper exit status
-###############################################################################
+#
cleanup()
{
rc=$1
@@ -80,7 +81,7 @@ cleanup()
###############################################################################
# help() and version()
# display help (or version) message and exit
-###############################################################################
+#
help()
{
cat <<eof
@@ -153,7 +154,7 @@ eof
###############################################################################
# setupTmpDir()
# set up a temp directory and a trap to remove it
-###############################################################################
+#
setupTmpDir()
{
$needsCleanup && return
@@ -168,7 +169,7 @@ setupTmpDir()
# configReplace(file, pattern, line)
# The first line in file that matches pattern gets replaced by line.
# line will be added at the end of the file if pattern does not match.
-###############################################################################
+#
configReplace()
{
file=$1; pat=$2; line=$3
@@ -191,7 +192,7 @@ eof
# setmatch(match)
# setting the "match state" to true or false. Used to see if there was at
# least one match.
-###############################################################################
+#
setmatch()
{
match=$1
@@ -200,7 +201,7 @@ setmatch()
###############################################################################
# getmatch()
# return success if there was at least one match.
-###############################################################################
+#
getmatch()
{
test "x$match" = xtrue
@@ -209,7 +210,7 @@ getmatch()
###############################################################################
# initTexmfMain()
# get $MT_TEXMFMAIN from $TEXMFMAIN
-###############################################################################
+#
initTexmfMain()
{
case $MT_TEXMFMAIN in
@@ -222,7 +223,7 @@ initTexmfMain()
# cache_vars()
# locate files / kpathsea variables and export variables to environment
# this speeds up future calls to e.g. mktexupd
-###############################################################################
+#
cache_vars()
{
: ${MT_VARTEXFONTS=`kpsewhich --expand-var='$VARTEXFONTS' | sed 's%^!!%%'`}
@@ -240,7 +241,7 @@ cache_vars()
###############################################################################
# abort(errmsg)
# print `errmsg' to stderr and exit with error code 1
-###############################################################################
+#
abort()
{
echo "$progname: $1." >&2
@@ -251,7 +252,7 @@ abort()
# maybe_abort(errmsg)
# print `errmsg' to stderr and
# unless noAbortFlag is set exit with error code 1
-###############################################################################
+#
maybe_abort()
{
echo "$progname: $1." >&2
@@ -260,8 +261,8 @@ maybe_abort()
###############################################################################
# verboseMsg(msg)
-# print `msg' to stderr is $verbose is true
-###############################################################################
+# print `msg' to stderr if $verbose is true
+#
verboseMsg() {
$verboseFlag && verbose echo ${1+"$@"}
}
@@ -269,21 +270,19 @@ verboseMsg() {
###############################################################################
# byebye()
# report any failures and exit the program
-###############################################################################
+#
byebye()
{
if $has_warnings; then
{
cat <<eof
-
###############################################################################
+
$progname: Warning! Some warnings have been issued.
-Visit the log files in directory
+For details, see the .log files in directory (and subdirectories of)
$destdir
-for details.
-###############################################################################
-This is a summary of all \`warning' messages:
+Meanwhile, this is a summary of all warning messages:
$log_warning_msg
eof
} >&2
@@ -292,15 +291,13 @@ eof
if $has_errors; then
{
cat <<eof
-
###############################################################################
+
$progname: Error! Not all formats have been built successfully.
-Visit the log files in directory
+For details, see the .log files in directory (and subdirectories of)
$destdir
-for details.
-###############################################################################
-This is a summary of all \`failed' messages:
+Meanwhile, this is a summary of all failure messages:
$log_failure_msg
eof
} >&2
@@ -313,7 +310,7 @@ eof
###############################################################################
# init_log_warning()
# reset the list of warning messages
-###############################################################################
+#
init_log_warning()
{
log_warning_msg=
@@ -323,7 +320,7 @@ init_log_warning()
###############################################################################
# init_log_failure()
# reset the list of failure messages
-###############################################################################
+#
init_log_failure()
{
log_failure_msg=
@@ -333,7 +330,7 @@ init_log_failure()
###############################################################################
# log_warning(errmsg)
# report and save warning message `errmsg'
-###############################################################################
+#
log_warning()
{
echo "Warning: $@" >&2
@@ -351,7 +348,7 @@ $@"
###############################################################################
# log_failure(errmsg)
# report and save failure message `errmsg'
-###############################################################################
+#
log_failure()
{
echo "Error: $@" >&2
@@ -369,7 +366,7 @@ $@"
###############################################################################
# verbose (cmd)
# execute cmd. Redirect output depending on $mktexfmtMode.
-###############################################################################
+#
verbose()
{
$mktexfmtMode && ${1+"$@"} >&2 || ${1+"$@"}
@@ -378,7 +375,7 @@ verbose()
###############################################################################
# mktexdir(args)
# call mktexdir script, disable all features (to prevent sticky directories)
-###############################################################################
+#
mktexdir()
{
initTexmfMain
@@ -388,7 +385,7 @@ mktexdir()
###############################################################################
# tcfmgr(args)
# call tcfmgr script
-###############################################################################
+#
tcfmgr()
{
initTexmfMain
@@ -398,7 +395,7 @@ tcfmgr()
###############################################################################
# mktexupd(args)
# call mktexupd script
-###############################################################################
+#
mktexupd()
{
initTexmfMain
@@ -409,7 +406,7 @@ mktexupd()
# main()
# parse commandline arguments, initialize variables,
# switch into temp. direcrory, execute desired command
-###############################################################################
+#
main()
{
destdir= # global variable: where do we put the format files?
@@ -647,7 +644,7 @@ main()
# inside the 4th field in fmtutil.cnf.
#
# exit code: returns error code if the ini file is not installed
-###############################################################################
+#
parse_line()
{
case $1 in
@@ -690,7 +687,7 @@ parse_line()
# find_hyphenfile(format, hyphenation) searches for hyphenation along
# searchpath of format
# exit code: returns error is file is not found
-###############################################################################
+#
find_hyphenfile()
{
format="$1"; hyphenation="`echo $2 | sed 's/,/ /g'`"
@@ -704,7 +701,7 @@ find_hyphenfile()
# find_info_for_name(format)
# Look up the config line for format `format' and call parse_line to set
# global variables.
-###############################################################################
+#
find_info_for_name()
{
format="$1"
@@ -718,10 +715,9 @@ find_info_for_name()
###############################################################################
# run_initex()
# Calls initex. Assumes that global variables are set by parse_line.
-###############################################################################
+#
run_initex()
{
-
# install a pool file and set tcx flag if requested in lang= option:
rm -f *.pool
poolfile=
@@ -757,13 +753,15 @@ run_initex()
mktexfmt_loop=$mktexfmt_loop:$format/$engine
export mktexfmt_loop
- verboseMsg "$progname: running \`$engine -ini $tcxflag $jobswitch $prgswitch $texargs' ..."
+ engine_invocation="$engine -ini $tcxflag $jobswitch $prgswitch $texargs"
+ verboseMsg "$progname: running \`$engine_invocation' ..."
+ #debugMsg "$progname: (in `pwd`)"
# run in a subshell to get a local effect of TEXPOOL manipulation:
(
# If necessary, set TEXPOOL. Use absolute path, because of KPSE_DOT.
$localpool && { TEXPOOL="`pwd`:$TEXPOOL"; export TEXPOOL; }
- verbose $engine -ini $tcxflag $jobswitch $prgswitch $texargs
+ verbose $engine_invocation
) </dev/null
if test $use_engine_dir; then
@@ -772,15 +770,20 @@ run_initex()
fulldestdir="$destdir"
fi
mkdir -p "$fulldestdir"
+ #
+ # Move the log file first so that it will be in the stated output
+ # directory even if the .fmt build failed.
+ # We definitely don't want user interaction for the mv.
+ saved_log=$fulldestdir/$format.log
+ mv "$format.log" "$saved_log" </dev/null
+ #
if test -f "$fmtfile"; then
- grep '^! ' $format.log >/dev/null 2>&1 &&
- log_warning "\`$engine -ini $tcxflag $jobswitch $prgswitch $texargs' possibly failed."
+ grep '^! ' "$saved_log" >/dev/null 2>&1 &&
+ log_warning "\`$engine_invocation' possibly failed."
- # We don't want user-interaction for the following "mv" commands:
- mv "$format.log" "$fulldestdir/$format.log" </dev/null
- #
destfile=$fulldestdir/$fmtfile
if mv "$fmtfile" "$destfile" </dev/null; then
+ verboseMsg "$progname: $saved_log log saved."
verboseMsg "$progname: $destfile installed."
#
# As a special special case, we create mplib-luatex.mem for use by
@@ -814,7 +817,7 @@ run_initex()
mktexupd "$fulldestdir" "$fmtfile"
fi
else
- log_failure "\`$engine -ini $tcxflag $jobswitch $prgswitch $texargs' failed"
+ log_failure "\`$engine_invocation' failed"
fi
}
@@ -822,7 +825,7 @@ run_initex()
# recreate_loop()
# for each line in config file: check match-condition and recreate format
# if there is a match
-###############################################################################
+#
recreate_loop()
{
OIFS=$IFS
@@ -842,7 +845,7 @@ recreate_loop()
# listcfg_loop()
# prints all format definitions in config files (enabled and disabled ones)
# for supported formats (i.e. for those which have an existing ini file)
-###############################################################################
+#
listcfg_loop()
{
OIFS=$IFS
@@ -859,7 +862,7 @@ listcfg_loop()
###############################################################################
# check_match()
# recreate all formats
-###############################################################################
+#
check_match()
{
$need_find_hyphenfile && \
@@ -871,7 +874,7 @@ check_match()
###############################################################################
# recreate_by_fmt(fmtname)
# recreate all versions of fmtname
-###############################################################################
+#
recreate_by_fmt()
{
fmtname=$1
@@ -882,7 +885,7 @@ recreate_by_fmt()
###############################################################################
# create_missing()
# create all missing format files
-###############################################################################
+#
create_missing()
{
# match_cmd='test ! -f $destdir/$fmtfile'
@@ -893,7 +896,7 @@ create_missing()
###############################################################################
# recreate_existing()
# recreate only existing format files
-###############################################################################
+#
recreate_existing()
{
match_cmd='test -f "`kpsewhich -engine=$texengine -progname=$format $fmtfile`"'
@@ -903,7 +906,7 @@ recreate_existing()
###############################################################################
# recreate_all()
# recreate all formats
-###############################################################################
+#
recreate_all()
{
match_cmd=true
@@ -913,7 +916,7 @@ recreate_all()
###############################################################################
# recreate_by_hyphenfile(hyphenfile)
# recreate all formats that depend on hyphenfile
-###############################################################################
+#
recreate_by_hyphenfile()
{
hyphenfile=$1
@@ -944,7 +947,7 @@ recreate_by_hyphenfile()
###############################################################################
# recreate_by_engine(enginename)
# recreate all formats that are based on enginename
-###############################################################################
+#
recreate_by_engine()
{
enginename=$1
@@ -960,15 +963,13 @@ recreate_by_engine()
getmatch || maybe_abort "no format depends on engine \`$enginename'"
}
-
-
###############################################################################
# show_hyphen_file(format)
# prints full name of the hyphenfile for format
#
# exit code: returns error code if the ini file is not installed or if
# the hyphen file cannot be found
-###############################################################################
+#
show_hyphen_file()
{
fmtname=$1
@@ -985,7 +986,7 @@ show_hyphen_file()
###############################################################################
# disablefmt(format)
# disables format in configuration file
-###############################################################################
+#
disablefmt()
{
grep "^$1[ ]" $cnf_file >/dev/null || { (exit 0); return 0; }
@@ -1001,7 +1002,7 @@ eof
###############################################################################
# enablefmt(format)
# enables format in configuration file
-###############################################################################
+#
enablefmt()
{
grep "^#![ ]*$1[ ]" $cnf_file >/dev/null || { (exit 0); return 0; }