Bug 1278415 - Ensure MOZ_CURRENT_PROJECT is set when running make directly in objdir. r?gps
The topobjdir-finding logic in mozbuild relies on MOZ_CURRENT_PROJECT
being set, and it's currently only set when going through client.mk.
On automation, during universal builds, make check is invoked directly
in one of the objdirs, so MOZ_CURRENT_PROJECT is not set. We've had
other similar problems in the past. Ensuring MOZ_CURRENT_PROJECT is set
in the objdir itself should reduce the risk of other such issues in the
future.
--- a/client.mk
+++ b/client.mk
@@ -187,16 +187,19 @@ WANT_MOZCONFIG_MK = 1
endif
ifdef WANT_MOZCONFIG_MK
# For now, only output "export" lines and lines containing UPLOAD_EXTRA_FILES
# from mach environment --format=client.mk output.
MOZCONFIG_MK_LINES := $(filter export||% UPLOAD_EXTRA_FILES% %UPLOAD_EXTRA_FILES%,$(MOZCONFIG_OUT_LINES))
$(OBJDIR)/.mozconfig.mk: $(TOPSRCDIR)/client.mk $(FOUND_MOZCONFIG) $(call mkdir_deps,$(OBJDIR)) $(OBJDIR)/CLOBBER
$(if $(MOZCONFIG_MK_LINES),( $(foreach line,$(MOZCONFIG_MK_LINES), echo '$(subst ||, ,$(line))';) )) > $@
+ifdef MOZ_CURRENT_PROJECT
+ echo export MOZ_CURRENT_PROJECT=$(MOZ_CURRENT_PROJECT) >> $@
+endif
# Include that makefile so that it is created. This should not actually change
# the environment since MOZCONFIG_CONTENT, which MOZCONFIG_OUT_LINES derives
# from, has already been eval'ed.
include $(OBJDIR)/.mozconfig.mk
endif
# Print out any options loaded from mozconfig.
--- a/python/mozbuild/mozbuild/test/test_base.py
+++ b/python/mozbuild/mozbuild/test/test_base.py
@@ -36,16 +36,17 @@ log_manager = LoggingManager()
class TestMozbuildObject(unittest.TestCase):
def setUp(self):
self._old_cwd = os.getcwd()
self._old_env = dict(os.environ)
os.environ.pop('MOZCONFIG', None)
os.environ.pop('MOZ_OBJDIR', None)
+ os.environ.pop('MOZ_CURRENT_PROJECT', None)
def tearDown(self):
os.chdir(self._old_cwd)
os.environ.clear()
os.environ.update(self._old_env)
def get_base(self, topobjdir=None):
return MozbuildObject(topsrcdir, None, log_manager, topobjdir=topobjdir)