Bug 1257516 - Handle outputting the tail of config.log for old-configure failures from moz.configure. r?ted
--- a/build/autoconf/hooks.m4
+++ b/build/autoconf/hooks.m4
@@ -1,25 +1,16 @@
dnl This Source Code Form is subject to the terms of the Mozilla Public
dnl License, v. 2.0. If a copy of the MPL was not distributed with this
dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
-dnl Output the contents of config.log when configure exits with an
-dnl error code.
-define([MOZ_CONFIG_LOG_TRAP],
-[changequote(<<<, >>>)dnl
-trap '[ "$?" != 0 ] && echo "------ config.log ------" && tail -n 25 config.log' EXIT
-changequote([, ])dnl
-])
-
dnl Wrap AC_INIT_PREPARE to add the above trap.
define([_MOZ_AC_INIT_PREPARE], defn([AC_INIT_PREPARE]))
define([AC_INIT_PREPARE],
[_MOZ_AC_INIT_PREPARE($1)
-MOZ_CONFIG_LOG_TRAP
test "x$prefix" = xNONE && prefix=$ac_default_prefix
# Let make expand exec_prefix.
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
> subconfigures
> skip_subconfigures
])
@@ -74,17 +65,16 @@ done
define([MOZ_RUN_SUBCONFIGURES],
[dnl Execute subconfigure, unless --no-recursion was passed to configure.
if test "$no_recursion" != yes; then
trap '' EXIT
if ! $PYTHON $_topsrcdir/build/subconfigure.py $1; then
exit 1
fi
- MOZ_CONFIG_LOG_TRAP
fi
])
define([MOZ_RUN_ALL_SUBCONFIGURES],[
MOZ_RUN_SUBCONFIGURES([--list subconfigures --skip skip_subconfigures])
])
dnl Print error messages in config.log as well as stderr
--- a/build/moz.configure/old.configure
+++ b/build/moz.configure/old.configure
@@ -405,18 +405,26 @@ def old_configure(prepare_configure, ext
# We can't share the handle on the file, so close it. We assume nothing
# beyond this point is going to be interesting to log to config.log from
# our end, so we don't make the effort to recreate a logging.FileHandler.
logger = logging.getLogger('moz.configure')
for handler in logger.handlers:
if isinstance(handler, logging.FileHandler):
handler.close()
+ log_size = os.path.getsize('config.log')
+
ret = subprocess.call(cmd)
if ret:
+ with log.queue_debug():
+ with open('config.log') as fh:
+ fh.seek(log_size)
+ for line in fh:
+ log.debug(line.rstrip())
+ log.error('old-configure failed')
sys.exit(ret)
raw_config = {}
with encoded_open('config.data', 'r') as fh:
code = compile(fh.read(), 'config.data', 'exec')
# Every variation of the exec() function I tried led to:
# SyntaxError: unqualified exec is not allowed in function 'main' it
# contains a nested function with free variables