Bug 891766 - Add gecko's git commit info in B2G build. r=gps
authorAskeing Yen <fyen@mozilla.com>
Thu, 05 Sep 2013 11:31:31 +0800
changeset 145682 5033980115faf63df1273d7c6fca0299d55942c4
parent 145681 57b01dc1c59b84fe488277b061757ba93da50131
child 145683 c45e24c1798bc17ab52b0793822eec592ed19359
push id25220
push userryanvm@gmail.com
push dateThu, 05 Sep 2013 19:36:32 +0000
treeherdermozilla-central@1ada033f80f1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs891766
milestone26.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 891766 - Add gecko's git commit info in B2G build. r=gps
config/makefiles/rcs.mk
js/src/config/makefiles/rcs.mk
toolkit/content/Makefile.in
toolkit/content/buildconfig.html
--- a/config/makefiles/rcs.mk
+++ b/config/makefiles/rcs.mk
@@ -5,38 +5,50 @@
 # License, v. 2.0. If a copy of the MPL was not distributed with this file,
 # You can obtain one at http://mozilla.org/MPL/2.0/.
 #
 
 ifdef USE_RCS_MK #{
 
 ifndef INCLUDED_RCS_MK #{
 
-MOZ_RCS_TYPE ?= $(notdir $(wildcard $(topsrcdir)/.hg))
+MOZ_RCS_TYPE_HG ?= $(notdir $(wildcard $(topsrcdir)/.hg))
+MOZ_RCS_TYPE_GIT ?= $(notdir $(wildcard $(topsrcdir)/.git))
 
 
 ###########################################################################
 # HAVE_MERCURIAL_RCS
 ###########################################################################
-ifeq (.hg,$(MOZ_RCS_TYPE)) #{
+ifeq (.hg,$(MOZ_RCS_TYPE_HG)) #{
 
 # Intent: Retrieve the http:// repository path for a directory.
 # Usage: $(call getSourceRepo[,repo_dir|args])
 # Args:
 #   path (optional): repository to query.  Defaults to $(topsrcdir)
 getSourceRepo = \
   $(call FUNC_getSourceRepo,$(if $(1),cd $(1) && hg,hg --repository $(topsrcdir)))
 
 # return: http://hg.mozilla.org/mozilla-central
 FUNC_getSourceRepo = \
   $(strip \
     $(patsubst %/,%,\
     $(patsubst ssh://%,http://%,\
     $(firstword $(shell $(getargv) showconfig paths.default))\
     )))
 
-endif #} HAVE_MERCURIAL_RCS
+#} HAVE_MERCURIAL_RCS
+
+###########################################################################
+# HAVE_GIT_RCS
+###########################################################################
+else ifeq (.git,$(MOZ_RCS_TYPE_GIT)) #{
+
+GIT ?= git
+getSourceRepo = \
+  $(shell cd $(topsrcdir) && $(GIT) rev-parse --verify HEAD)
+
+endif #} HAVE_GIT_RCS
 
 
 INCLUDED_RCS_MK := 1
 endif #}
 
 endif #}
--- a/js/src/config/makefiles/rcs.mk
+++ b/js/src/config/makefiles/rcs.mk
@@ -5,38 +5,50 @@
 # License, v. 2.0. If a copy of the MPL was not distributed with this file,
 # You can obtain one at http://mozilla.org/MPL/2.0/.
 #
 
 ifdef USE_RCS_MK #{
 
 ifndef INCLUDED_RCS_MK #{
 
-MOZ_RCS_TYPE ?= $(notdir $(wildcard $(topsrcdir)/.hg))
+MOZ_RCS_TYPE_HG ?= $(notdir $(wildcard $(topsrcdir)/.hg))
+MOZ_RCS_TYPE_GIT ?= $(notdir $(wildcard $(topsrcdir)/.git))
 
 
 ###########################################################################
 # HAVE_MERCURIAL_RCS
 ###########################################################################
-ifeq (.hg,$(MOZ_RCS_TYPE)) #{
+ifeq (.hg,$(MOZ_RCS_TYPE_HG)) #{
 
 # Intent: Retrieve the http:// repository path for a directory.
 # Usage: $(call getSourceRepo[,repo_dir|args])
 # Args:
 #   path (optional): repository to query.  Defaults to $(topsrcdir)
 getSourceRepo = \
   $(call FUNC_getSourceRepo,$(if $(1),cd $(1) && hg,hg --repository $(topsrcdir)))
 
 # return: http://hg.mozilla.org/mozilla-central
 FUNC_getSourceRepo = \
   $(strip \
     $(patsubst %/,%,\
     $(patsubst ssh://%,http://%,\
     $(firstword $(shell $(getargv) showconfig paths.default))\
     )))
 
-endif #} HAVE_MERCURIAL_RCS
+#} HAVE_MERCURIAL_RCS
+
+###########################################################################
+# HAVE_GIT_RCS
+###########################################################################
+else ifeq (.git,$(MOZ_RCS_TYPE_GIT)) #{
+
+GIT ?= git
+getSourceRepo = \
+  $(shell cd $(topsrcdir) && $(GIT) rev-parse --verify HEAD)
+
+endif #} HAVE_GIT_RCS
 
 
 INCLUDED_RCS_MK := 1
 endif #}
 
 endif #}
--- a/toolkit/content/Makefile.in
+++ b/toolkit/content/Makefile.in
@@ -34,16 +34,18 @@ endif
 
 ifeq (Android,$(OS_TARGET))
 DEFINES += -DANDROID_PACKAGE_NAME=$(ANDROID_PACKAGE_NAME)
 endif
 
 source_repo ?= $(call getSourceRepo)
 ifneq (,$(filter http%,$(source_repo)))
   DEFINES += -DSOURCE_REPO="$(source_repo)"
+else ifneq (,$(strip $(source_repo)))
+  DEFINES += -DSOURCE_GIT_COMMIT="$(source_repo)"
 endif
 
 ifneq (,$(findstring stlport,$(STLPORT_LIBS)))
 DEFINES += -DUSE_STLPORT
 endif
 
 BUILD_HOSTNAME = $(shell hostname -s || hostname)
 DEFINES += -DBUILD_HOSTNAME="$(BUILD_HOSTNAME)"
--- a/toolkit/content/buildconfig.html
+++ b/toolkit/content/buildconfig.html
@@ -25,16 +25,19 @@
 <h2>Build Machine</h2>
 <p>@BUILD_HOSTNAME@</p>
 #endif
 #ifdef SOURCE_REPO
 #ifdef SOURCE_CHANGESET
 <h2>Source</h2>
 <p>Built from <a href="@SOURCE_REPO@/rev/@SOURCE_CHANGESET@">@SOURCE_REPO@/rev/@SOURCE_CHANGESET@</a></p>
 #endif
+#else ifdef SOURCE_GIT_COMMIT
+<h2>Source</h2>
+<p>Built from git commit <a href="#">@SOURCE_GIT_COMMIT@</a></p>
 #endif
 <h2>Build platform</h2>
 <table>
   <tbody>
     <tr>
       <th>target</th>
     </tr>
     <tr>