Bug 1304593 - Take universal binaries into account when detecting objdir mismatches, r?gps draft
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Fri, 30 Sep 2016 14:27:38 -0400
changeset 420148 7f13cceb7133a1eb92ab5f733d1ab73cba598cc5
parent 420147 9e5f2ed402c67185b97b6870ea655fc761cc7696
child 420149 26d4e1f6da67d888a6f788a17b30b989f8c8db27
push id31113
push userahalberstadt@mozilla.com
push dateMon, 03 Oct 2016 15:07:18 +0000
reviewersgps
bugs1304593
milestone52.0a1
Bug 1304593 - Take universal binaries into account when detecting objdir mismatches, r?gps When attempting to run mach from a make target, there were failures on OSX due to an objdir mismatch: https://dxr.mozilla.org/mozilla-central/rev/7c576fe3279d87543f0a03b844eba7bc215e17f1/python/mozbuild/mozbuild/base.py#656 The two detected objdirs were "<objdir>" and "<objdir>/x86_64". I believe this should not count as a mismatch, otherwise it would not be possible to run a mach command from the x86_64 directory. MozReview-Commit-ID: CXDEABNWX8L
python/mozbuild/mozbuild/base.py
--- a/python/mozbuild/mozbuild/base.py
+++ b/python/mozbuild/mozbuild/base.py
@@ -643,18 +643,24 @@ class MachCommandBase(MozbuildObject):
             topobjdir = dummy._topobjdir
             if topobjdir:
                 # If we're inside a objdir and the found mozconfig resolves to
                 # another objdir, we abort. The reasoning here is that if you
                 # are inside an objdir you probably want to perform actions on
                 # that objdir, not another one. This prevents accidental usage
                 # of the wrong objdir when the current objdir is ambiguous.
                 config_topobjdir = dummy.resolve_mozconfig_topobjdir()
-                if config_topobjdir and not samepath(topobjdir,
-                                                     config_topobjdir):
+
+                try:
+                    universal_bin = dummy.substs.get('UNIVERSAL_BINARY')
+                except:
+                    universal_bin = False
+
+                if config_topobjdir and not (samepath(topobjdir, config_topobjdir) or
+                        universal_bin and topobjdir.startswith(config_topobjdir)):
                     raise ObjdirMismatchException(topobjdir, config_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 '