Bug 1035096 - Make mach environment --format=configure only display configure arguments if COMM_BUILD is not set in the environment. r=gps

Also cleanup the output logic so that the configure arguments header is not
displayed when there aren't configure arguments, and so that variables are
still displayed when there aren't configure arguments.
This commit is contained in:
Mike Hommey 2014-07-08 13:47:25 +09:00
parent f795e368b4
commit 3a96529a38

View File

@ -1008,24 +1008,25 @@ class MachDebug(MachCommandBase):
# Replace ' with '"'"', so that shell quoting e.g.
# a'b becomes 'a'"'"'b'.
quote = lambda s: s.replace("'", """'"'"'""")
print('echo Adding configure options from %s' %
mozpath.normsep(self.mozconfig['path']), file=out)
if self.mozconfig['configure_args']:
if self.mozconfig['configure_args'] and \
'COMM_BUILD' not in os.environ:
print('echo Adding configure options from %s' %
mozpath.normsep(self.mozconfig['path']), file=out)
for arg in self.mozconfig['configure_args']:
quoted_arg = quote(arg)
print("echo ' %s'" % quoted_arg, file=out)
print("""set -- "$@" '%s'""" % quoted_arg, file=out)
for key, value in self.mozconfig['env']['added'].items():
print("export %s='%s'" % (key, quote(value)), file=out)
for key, (old, value) in self.mozconfig['env']['modified'].items():
print("export %s='%s'" % (key, quote(value)), file=out)
for key, value in self.mozconfig['vars']['added'].items():
print("%s='%s'" % (key, quote(value)), file=out)
for key, (old, value) in self.mozconfig['vars']['modified'].items():
print("%s='%s'" % (key, quote(value)), file=out)
for key in self.mozconfig['env']['removed'].keys() + \
self.mozconfig['vars']['removed'].keys():
print("unset %s" % key, file=out)
for key, value in self.mozconfig['env']['added'].items():
print("export %s='%s'" % (key, quote(value)), file=out)
for key, (old, value) in self.mozconfig['env']['modified'].items():
print("export %s='%s'" % (key, quote(value)), file=out)
for key, value in self.mozconfig['vars']['added'].items():
print("%s='%s'" % (key, quote(value)), file=out)
for key, (old, value) in self.mozconfig['vars']['modified'].items():
print("%s='%s'" % (key, quote(value)), file=out)
for key in self.mozconfig['env']['removed'].keys() + \
self.mozconfig['vars']['removed'].keys():
print("unset %s" % key, file=out)
def _environment_json(self, out, verbose):
import json