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.
This commit is contained in:
Mike Hommey 2016-06-09 14:16:22 +09:00
parent 8a3b88f341
commit 721ada9f07
2 changed files with 4 additions and 0 deletions

View File

@ -192,6 +192,9 @@ ifdef WANT_MOZCONFIG_MK
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

View File

@ -41,6 +41,7 @@ class TestMozbuildObject(unittest.TestCase):
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)