Bug 1257516 - Handle outputting the tail of config.log for old-configure failures from moz.configure. r=ted
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 25 Mar 2016 20:11:59 +0900
changeset 290981 23b31c46e2117f80b78e6033fb5f1dee3a222965
parent 290980 7640e60c144a8a954ed06a168d1bc7c2550cf3ef
child 290982 7ebd549a0af91d9bc1a3cfbe8e55631becf6f3b8
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
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