Bug 1241111 - Allow overriding SOURCE_REV_URL, SOURCE_REPO, SOURCE_CHANGESET. r=ted
☠☠ backed out by 0512df61134e ☠ ☠
authorGeorg Fritzsche <georg.fritzsche@googlemail.com>
Fri, 29 Jan 2016 18:42:51 +0100
changeset 282352 e8d8faa2595513aca6258f0d9e224f86c6ecd01e
parent 282351 3958782fe187026cbc3755ad6eae6920e67fa7d2
child 282353 62b2d7cabf94a62d5fea1836eb50f7e813dff8c1
push id29957
push userphilringnalda@gmail.com
push dateSat, 30 Jan 2016 17:15:45 +0000
treeherderautoland@8be8932a2e0f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs1241111
milestone47.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 1241111 - Allow overriding SOURCE_REV_URL, SOURCE_REPO, SOURCE_CHANGESET. r=ted
build/Makefile.in
configure.in
toolkit/content/Makefile.in
toolkit/mozapps/installer/package-name.mk
toolkit/xre/Makefile.in
--- a/build/Makefile.in
+++ b/build/Makefile.in
@@ -11,23 +11,33 @@ APP_INI_DEPS = $(topsrcdir)/config/miles
 
 MOZ_APP_BUILDID := $(shell cat $(DEPTH)/config/buildid)
 APP_INI_DEPS += $(DEPTH)/config/buildid
 
 DEFINES += -DMOZ_APP_BUILDID=$(MOZ_APP_BUILDID)
 
 APP_INI_DEPS += $(DEPTH)/config/autoconf.mk
 
+ifdef MOZ_SOURCE_CHANGESET
+MOZ_SOURCE_STAMP := $(MOZ_SOURCE_CHANGESET)
+else
 MOZ_SOURCE_STAMP := $(firstword $(shell cd $(topsrcdir)/$(MOZ_BUILD_APP)/.. && hg parent --template='{node}\n' 2>/dev/null))
+endif
+
 ifdef MOZ_SOURCE_STAMP
 DEFINES += -DMOZ_SOURCE_STAMP='$(MOZ_SOURCE_STAMP)'
 endif
 
+
 ifdef MOZ_INCLUDE_SOURCE_INFO
+ifdef MOZ_SOURCE_REPO
+source_repo := $(MOZ_SOURCE_REPO)
+else
 source_repo ?= $(call getSourceRepo,$(topsrcdir)/$(MOZ_BUILD_APP)/..)
+endif
 ifneq (,$(source_repo))
   DEFINES += -DMOZ_SOURCE_REPO='$(source_repo)'
 endif
 endif
 
 endif
 
 # NOTE: Keep .gdbinit in the topsrcdir for people who run gdb from the topsrcdir.
--- a/configure.in
+++ b/configure.in
@@ -8708,23 +8708,28 @@ if test "$MOZILLA_OFFICIAL"; then
     AC_DEFINE(MOZILLA_OFFICIAL)
     # Build revisions should always be present in official builds
     MOZ_INCLUDE_SOURCE_INFO=1
 fi
 
 # On official builds, we need to know in Telemetry what revision this is built from.
 # This is e.g. needed to match incoming data to a specific revision of the Histograms.json
 # file.
-if test "$MOZILLA_OFFICIAL" && test -d ${_topsrcdir}/.hg; then
-  SOURCE_REV=`cd $_topsrcdir && hg parent --template='{node|short}'`
-  SOURCE_REPO=`cd $_topsrcdir && hg showconfig paths.default | sed -e 's|^ssh://|http://|' -e 's|/$||'`
-  SOURCE_REV_URL=$SOURCE_REPO/rev/$SOURCE_REV
-else
-  SOURCE_REV_URL=
-fi
+# External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
+# explicitly set the repository and changeset information in.
+if test "$MOZILLA_OFFICIAL"; then
+    if test -z "$MOZ_SOURCE_REPO" && test -z "$MOZ_SOURCE_CHANGESET" && test -d ${_topsrcdir}/.hg; then
+        MOZ_SOURCE_CHANGESET=`cd $_topsrcdir && hg parent --template='{node}'`
+        MOZ_SOURCE_REPO=`cd $_topsrcdir && hg showconfig paths.default | sed -e 's|^ssh://|http://|' -e 's|/$||'`
+    fi
+    SOURCE_REV_URL=$MOZ_SOURCE_REPO/rev/$MOZ_SOURCE_CHANGESET
+fi
+
+AC_SUBST(MOZ_SOURCE_CHANGESET)
+AC_SUBST(MOZ_SOURCE_REPO)
 AC_SUBST(SOURCE_REV_URL)
 
 AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
 
 AC_DEFINE_UNQUOTED(MOZ_TELEMETRY_DISPLAY_REV, 2)
 AC_SUBST(MOZ_TELEMETRY_DISPLAY_REV)
 
 if test "$MOZ_TELEMETRY_REPORTING"; then
--- a/toolkit/content/Makefile.in
+++ b/toolkit/content/Makefile.in
@@ -6,21 +6,29 @@
 USE_RCS_MK := 1
 include $(topsrcdir)/config/makefiles/makeutils.mk
 
 DEFINES += \
   -DCXXFLAGS='$(CXXFLAGS)' \
   -DCPPFLAGS='$(CPPFLAGS)' \
   $(NULL)
 
+ifdef MOZ_SOURCE_CHANGESET
+MOZ_SOURCE_STAMP = $(MOZ_SOURCE_CHANGESET)
+else
 MOZ_SOURCE_STAMP ?= $(shell hg -R $(topsrcdir) parent --template='{node}\n' 2>/dev/null)
+endif
 ifdef MOZ_SOURCE_STAMP
 DEFINES += -DSOURCE_CHANGESET='$(MOZ_SOURCE_STAMP)'
 endif
 
 ifdef MOZ_INCLUDE_SOURCE_INFO
+ifdef MOZ_SOURCE_REPO
+source_repo = $(MOZ_SOURCE_REPO)
+else
 source_repo ?= $(call getSourceRepo)
+endif
 ifneq (,$(filter http%,$(source_repo)))
   DEFINES += -DSOURCE_REPO='$(source_repo)'
 else ifneq (,$(strip $(source_repo)))
   DEFINES += -DSOURCE_GIT_COMMIT='$(source_repo)'
 endif
 endif
--- a/toolkit/mozapps/installer/package-name.mk
+++ b/toolkit/mozapps/installer/package-name.mk
@@ -151,25 +151,31 @@ else
 BUILDID = $(shell $(PYTHON) $(MOZILLA_DIR)/config/printconfigsetting.py $(DIST)/bin/platform.ini Build BuildID)
 endif
 
 ifndef INCLUDED_RCS_MK
   USE_RCS_MK := 1
   include $(MOZILLA_DIR)/config/makefiles/makeutils.mk
 endif
 
+ifdef MOZ_SOURCE_CHANGESET
+MOZ_SOURCE_STAMP = $(MOZ_SOURCE_CHANGESET)
+else
 MOZ_SOURCE_STAMP = $(firstword $(shell hg -R $(MOZILLA_DIR) parent --template="{node}\n" 2>/dev/null))
+endif
 
 ###########################################################################
 # bug: 746277 - preserve existing functionality.
 # MOZILLA_DIR="": cd $(SPACE); hg # succeeds if ~/.hg exists
 ###########################################################################
 ifdef MOZ_INCLUDE_SOURCE_INFO
+ifndef MOZ_SOURCE_REPO
 MOZ_SOURCE_REPO = $(call getSourceRepo,$(MOZILLA_DIR)$(NULL) $(NULL))
 endif
+endif
 
 MOZ_SOURCESTAMP_FILE = $(DIST)/$(PKG_PATH)/$(MOZ_INFO_BASENAME).txt
 MOZ_BUILDINFO_FILE = $(DIST)/$(PKG_PATH)/$(MOZ_INFO_BASENAME).json
 MOZ_MOZINFO_FILE = $(DIST)/$(PKG_PATH)/$(MOZ_INFO_BASENAME).mozinfo.json
 MOZ_TEST_PACKAGES_FILE = $(DIST)/$(PKG_PATH)/test_packages.json
 MOZ_TEST_PACKAGES_FILE_TC = $(DIST)/$(PKG_PATH)/test_packages_tc.json
 
 # JavaScript Shell
--- a/toolkit/xre/Makefile.in
+++ b/toolkit/xre/Makefile.in
@@ -14,23 +14,31 @@ include $(topsrcdir)/config/rules.mk
 
 # Should version be optional or required ?
 TOOLKIT_EM_VERSION=$(shell $(PYTHON) $(topsrcdir)/python/mozbuild/mozbuild/milestone.py --topsrcdir=$(topsrcdir))
 $(call warnIfEmpty,TOOLKIT_EM_VERSION)
 
 # Valid if null: {warn,error}IfEmpty
 DEFINES += -DTOOLKIT_EM_VERSION='"$(TOOLKIT_EM_VERSION)"'
 
+ifdef MOZ_SOURCE_CHANGESET
+MOZ_SOURCE_STAMP = $MOZ_SOURCE_CHANGESET
+else
 MOZ_SOURCE_STAMP ?= $(firstword $(shell hg -R $(topsrcdir) parent --template='{node}\n' 2>/dev/null))
+endif
 ifdef MOZ_SOURCE_STAMP
 
   INIARGS = --sourcestamp=$(MOZ_SOURCE_STAMP)
 
   ifdef MOZ_INCLUDE_SOURCE_INFO
+    ifdef MOZ_SOURCE_REPO
+    source_repo = $MOZ_SOURCE_REPO
+    else
     source_repo := $(call getSourceRepo)
+    endif
 
     # extra sanity check for old versions of hg, no showconfig support
     ifneq (,$(filter http%,$(source_repo)))
       INIARGS += --sourcerepo=$(source_repo)
     endif
   endif
 
 endif # MOZ_SOURCE_STAMP