Bug 1363582 - Pass environment-only js_options down to old-configure through the environment. r?chmanchester draft
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 10 May 2017 11:04:00 +0900
changeset 575161 27916ed0f76d73ebfcfb2cf0f06bb8f10d2decef
parent 575153 7b0b64afac288e63e8c1f1faefa6f2bc3bec8639
child 575165 15ee34935cfbf4ae66614b1a4738eb8d601e486e
push id57976
push userbmo:mh+mozilla@glandium.org
push dateWed, 10 May 2017 02:11:07 +0000
reviewerschmanchester
bugs1363582
milestone55.0a1
Bug 1363582 - Pass environment-only js_options down to old-configure through the environment. r?chmanchester old-configure does not support being passed them as command line arguments, so we have to pass them through the environment.
build/moz.configure/old.configure
--- a/build/moz.configure/old.configure
+++ b/build/moz.configure/old.configure
@@ -314,25 +314,40 @@ def old_configure(prepare_configure, ext
     # so we don't need to pass it every single option we've been passed. Only
     # the ones that are not supported by python configure need to.
     cmd += [
         value.format(name)
         for name, value in zip(all_options, options)
         if value.origin != 'default'
     ]
 
+    env = os.environ
+    extra_env = {}
+
     # We also pass it the options from js/moz.configure so that it can pass
     # them down to js/src/configure. Note this list is empty when running
     # js/src/configure, in which case we don't need to pass those options
     # to old-configure since old-configure doesn't handle them anyways.
     if extra_old_configure_args:
-        cmd += extra_old_configure_args
+        for arg in extra_old_configure_args:
+            if arg.startswith('-'):
+                cmd.append(arg)
+            else:
+                k, v = arg.split('=', 1)
+                extra_env[k] = v
+
+    if extra_env:
+        env = dict(env)
+        env.update(extra_env)
 
     # 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.
     logger = logging.getLogger('moz.configure')
     for handler in logger.handlers:
         if isinstance(handler, logging.FileHandler):