Bug 1278415 - Ensure MOZ_CURRENT_PROJECT is set when running make directly in objdir. r?gps draft
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 09 Jun 2016 14:16:22 +0900
changeset 376945 63a54374c84d757436483a43d83d440fad692f87
parent 376944 1e73c774b4cf76a700621c6a713c16c0f0be9ef8
child 376946 8267c3277808802b664c23d077c9bd568faa9bfe
push id20723
push userbmo:mh+mozilla@glandium.org
push dateThu, 09 Jun 2016 11:05:12 +0000
reviewersgps
bugs1278415
milestone50.0a1
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.
client.mk
python/mozbuild/mozbuild/test/test_base.py
--- 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)