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
--- 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)