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