Bug 1411081 - Foster debugging of old-configure.vars; r?Build draft
authorGregory Szorc <gps@mozilla.com>
Tue, 24 Oct 2017 14:00:44 -0700
changeset 686260 9bebcd3bff36e5d21dda49828f5b9cbe0da379c6
parent 686254 248a307d72a432a14cc056dc703955fb4e572e22
child 686261 6a4f940b423801ea8d55e15a94c526d8b645cdeb
push id86146
push usergszorc@mozilla.com
push dateWed, 25 Oct 2017 16:57:28 +0000
reviewersBuild
bugs1411081
milestone58.0a1
Bug 1411081 - Foster debugging of old-configure.vars; r?Build We mix the added and modified variables from mozconfig and sort them. We also print comments indicating where values come from. MozReview-Commit-ID: 97x9iHxZe3m
build/moz.configure/old.configure
--- a/build/moz.configure/old.configure
+++ b/build/moz.configure/old.configure
@@ -61,16 +61,17 @@ def autoconf(mozconfig, autoconf):
 
 set_config('AUTOCONF', autoconf)
 
 
 @depends('OLD_CONFIGURE', mozconfig, autoconf, check_build_environment, shell,
          old_configure_assignments, build_project)
 @imports(_from='__builtin__', _import='open')
 @imports(_from='__builtin__', _import='print')
+@imports(_from='__builtin__', _import='sorted')
 @imports('glob')
 @imports('itertools')
 @imports('subprocess')
 # Import getmtime without overwriting the sandbox os.path.
 @imports(_from='os.path', _import='getmtime')
 @imports(_from='os.path', _import='exists')
 @imports(_from='mozbuild.shellutil', _import='quote')
 def prepare_configure(old_configure, mozconfig, autoconf, build_env, shell,
@@ -121,23 +122,31 @@ def prepare_configure(old_configure, moz
     with encoded_open('old-configure.vars', 'w') as out:
         log.debug('Injecting the following to old-configure:')
 
         def inject(command):
             print(command, file=out) # noqa Python 2vs3
             log.debug('| %s', command)
 
         if mozconfig['path']:
+            inject('# start of mozconfig values')
+            items = {}
             for key, value in mozconfig['vars']['added'].items():
-                inject("%s=%s" % (key, quote(value)))
+                items[key] = (value, 'added')
             for key, (old, value) in mozconfig['vars']['modified'].items():
-                inject("%s=%s" % (key, quote(value)))
+                items[key] = (value, 'modified')
+
+            for key, (value, action) in sorted(items.items()):
+                inject("%s=%s # %s" % (key, quote(value), action))
+
             for t in ('env', 'vars'):
-                for key in mozconfig[t]['removed'].keys():
-                    inject("unset %s" % key)
+                for key in sorted(mozconfig[t]['removed'].keys()):
+                    inject("unset %s # from %s" % (key, t))
+
+            inject('# end of mozconfig values')
 
         # Autoconf is special, because it might be passed from
         # mozconfig['make_extra'], which we don't pass automatically above.
         inject('export AUTOCONF=%s' % quote(autoconf))
 
         for assignment in old_configure_assignments:
             inject(assignment)