Bug 1257516 - Handle outputting the tail of config.log for old-configure failures from moz.configure. r?ted draft
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 25 Mar 2016 20:11:59 +0900
changeset 344700 87bca546082def5d8e646f98bc24a07e48ffa85e
parent 344699 e98313c5c848ee2ef7a9d10b1288ee03b1077bdb
child 517028 cff9787dbcef9ed03a568f31a56c76c9f4e4a9ff
push id13908
push userbmo:mh+mozilla@glandium.org
push dateFri, 25 Mar 2016 11:36:41 +0000
reviewersted
bugs1257516
milestone48.0a1
Bug 1257516 - Handle outputting the tail of config.log for old-configure failures from moz.configure. r?ted
build/autoconf/hooks.m4
build/moz.configure/old.configure
--- 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