Bug 1520394 - Restore logging to file after running old-configure. r=nalexander
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 16 Jan 2019 20:27:53 +0000
changeset 514177 596f8d9346ece3e6815d1af5460e9557ca91aec3
parent 514176 f611bc50d11cae1f48cc44d1468f2c34ec46e287
child 514178 e1f95cea7f0cf24df86031ee1e8433ecf3d1667d
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnalexander
bugs1520394
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1520394 - Restore logging to file after running old-configure. r=nalexander We're going to want to log some more. At the moment, this just adds the output of subconfigure to top-level config.log, but this will become more useful down the road. Depends on D16665 Differential Revision: https://phabricator.services.mozilla.com/D16666
build/moz.configure/old.configure
--- a/build/moz.configure/old.configure
+++ b/build/moz.configure/old.configure
@@ -317,22 +317,22 @@ def old_configure(prepare_configure, pre
 
     # For debugging purpose, in case it's not what we'd expect.
     log.debug('Running %s', quote(*cmd))
     if extra_env:
         log.debug('with extra environment: %s',
                   ' '.join('%s=%s' % pair for pair in extra_env.iteritems()))
 
     # Our logging goes to config.log, the same file old.configure uses.
-    # 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.
+    # We can't share the handle on the file, so close it.
     logger = logging.getLogger('moz.configure')
+    config_log = None
     for handler in logger.handlers:
         if isinstance(handler, logging.FileHandler):
+            config_log = handler
             handler.close()
             logger.removeHandler(handler)
 
     log_size = os.path.getsize('config.log')
 
     proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
                             env=encode(env))
     while True:
@@ -346,16 +346,22 @@ def old_configure(prepare_configure, pre
         with log.queue_debug():
             with encoded_open('config.log', 'r') as fh:
                 fh.seek(log_size)
                 for line in fh:
                     log.debug(line.rstrip())
             log.error('old-configure failed')
         sys.exit(ret)
 
+    if config_log:
+        # Create a new handler in append mode
+        handler = logging.FileHandler(config_log.baseFilename, mode='a', delay=True)
+        handler.setFormatter(config_log.formatter)
+        logger.addHandler(handler)
+
     raw_config = {
         'split': split,
         'unique_list': unique_list,
     }
     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