Bug 1278415 - Ensure MOZ_CURRENT_PROJECT is set when running make directly in objdir. r=gps
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 09 Jun 2016 14:16:22 +0900
changeset 301949 ba333bc43814a887e1ef6e74a5f2dfae5620d942
parent 301948 08093ab05dd463215a7ab14c73fa0905a7ef3ff9
child 301950 a2e4369f86dcf620b453de3da6525a87ea1808fc
push id30332
push usercbook@mozilla.com
push dateTue, 21 Jun 2016 10:33:59 +0000
treeherderautoland@0ffa18cfc8b4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs1278415
milestone50.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 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)