Bug 1031132 - Refactor mach environment to use logic from MachCommandBase instead of its own. r=gps
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 03 Jul 2014 07:15:31 +0900
changeset 191953 3ee4eaf0c38e0480514c0f9ea42fd80ae61efc0e
parent 191952 59a323e670baba5f2b9f114ef7ac8b80ea5be7a8
child 191954 588203633ba714cc4ee0e1f03cf9844faee41e09
push id45713
push usermh@glandium.org
push dateWed, 02 Jul 2014 22:16:23 +0000
treeherdermozilla-inbound@ce1c57e03b88 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs1031132
milestone33.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 1031132 - Refactor mach environment to use logic from MachCommandBase instead of its own. r=gps Also don't print section titles when there is nothing under them, and move move the ObjdirMismatchException handling to MachCommandBase.
python/mozbuild/mozbuild/base.py
python/mozbuild/mozbuild/mach_commands.py
--- a/python/mozbuild/mozbuild/base.py
+++ b/python/mozbuild/mozbuild/base.py
@@ -550,16 +550,25 @@ class MachCommandBase(MozbuildObject):
         topsrcdir = context.topdir
         topobjdir = None
         try:
             dummy = MozbuildObject.from_environment(cwd=context.cwd)
             topsrcdir = dummy.topsrcdir
             topobjdir = dummy._topobjdir
         except BuildEnvironmentNotFoundException:
             pass
+        except ObjdirMismatchException as e:
+            print('Ambiguous object directory detected. We detected that '
+                'both %s and %s could be object directories. This is '
+                'typically caused by having a mozconfig pointing to a '
+                'different object directory from the current working '
+                'directory. To solve this problem, ensure you do not have a '
+                'default mozconfig in searched paths.' % (e.objdir1,
+                    e.objdir2))
+            sys.exit(1)
 
         MozbuildObject.__init__(self, topsrcdir, context.settings,
             context.log_manager, topobjdir=topobjdir)
 
         self._mach_context = context
 
         # Incur mozconfig processing so we have unified error handling for
         # errors. Otherwise, the exceptions could bubble back to mach's error
--- a/python/mozbuild/mozbuild/mach_commands.py
+++ b/python/mozbuild/mozbuild/mach_commands.py
@@ -927,70 +927,39 @@ class MachDebug(MachCommandBase):
         print('platform:\n\t%s' % platform.platform())
         print('python version:\n\t%s' % sys.version)
         print('python prefix:\n\t%s' % sys.prefix)
         print('mach cwd:\n\t%s' % self._mach_context.cwd)
         print('os cwd:\n\t%s' % os.getcwd())
         print('mach directory:\n\t%s' % self._mach_context.topdir)
         print('state directory:\n\t%s' % state_dir)
 
-        try:
-            mb = MozbuildObject.from_environment(cwd=self._mach_context.cwd)
-        except ObjdirMismatchException as e:
-            print('Ambiguous object directory detected. We detected that '
-                'both %s and %s could be object directories. This is '
-                'typically caused by having a mozconfig pointing to a '
-                'different object directory from the current working '
-                'directory. To solve this problem, ensure you do not have a '
-                'default mozconfig in searched paths.' % (e.objdir1,
-                    e.objdir2))
-            return 1
-
-        mozconfig = None
+        print('object directory:\n\t%s' % self.topobjdir)
 
-        try:
-            mozconfig = mb.mozconfig
-            print('mozconfig path:\n\t%s' % mozconfig['path'])
-        except MozconfigFindException as e:
-            print('Unable to find mozconfig: %s' % e.message)
-            return 1
-
-        except MozconfigLoadException as e:
-            print('Error loading mozconfig: %s' % e.path)
-            print(e.message)
-
-            if e.output:
-                print('mozconfig evaluation output:')
-                for line in e.output:
-                    print(line)
-
-            return 1
-
-        print('object directory:\n\t%s' % mb.topobjdir)
-
-        if mozconfig:
-            print('mozconfig configure args:')
-            if mozconfig['configure_args']:
-                for arg in mozconfig['configure_args']:
+        if self.mozconfig['path']:
+            print('mozconfig path:\n\t%s' % self.mozconfig['path'])
+            if self.mozconfig['configure_args']:
+                print('mozconfig configure args:')
+                for arg in self.mozconfig['configure_args']:
                     print('\t%s' % arg)
 
-            print('mozconfig extra make args:')
-            if mozconfig['make_extra']:
-                for arg in mozconfig['make_extra']:
+            if self.mozconfig['make_extra']:
+                print('mozconfig extra make args:')
+                for arg in self.mozconfig['make_extra']:
                     print('\t%s' % arg)
 
-            print('mozconfig make flags:')
-            if mozconfig['make_flags']:
-                for arg in mozconfig['make_flags']:
+            if self.mozconfig['make_flags']:
+                print('mozconfig make flags:')
+                for arg in self.mozconfig['make_flags']:
                     print('\t%s' % arg)
 
         config = None
 
         try:
-            config = mb.config_environment
+            config = self.config_environment
 
         except Exception:
             pass
 
         if config:
             print('config topsrcdir:\n\t%s' % config.topsrcdir)
             print('config topobjdir:\n\t%s' % config.topobjdir)