Bug 1502457 - Move FIREFOX_VERSION to python configure. r=nalexander
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 16 Nov 2018 01:14:46 +0000
changeset 446697 a73cfbabdd47368eee9682c24de75cbaf1564dde
parent 446696 2c2b09264a82bb21a56620189020e146d80259d3
child 446698 1cf7694c8aa247c169c93d279bd16201103b75a8
push id35046
push userbtara@mozilla.com
push dateFri, 16 Nov 2018 09:46:36 +0000
treeherdermozilla-central@02f799e4c3da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnalexander
bugs1502457
milestone65.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 1502457 - Move FIREFOX_VERSION to python configure. r=nalexander Depends on D11982 Differential Revision: https://phabricator.services.mozilla.com/D11983
build/moz.configure/init.configure
old-configure.in
--- a/build/moz.configure/init.configure
+++ b/build/moz.configure/init.configure
@@ -1036,25 +1036,37 @@ set_define('MOZ_BUILD_APP', build_projec
 add_old_configure_assignment('MOZ_BUILD_APP', build_project)
 
 
 # set RELEASE_OR_BETA and NIGHTLY_BUILD variables depending on the cycle we're in
 # The logic works like this:
 # - if we have "a1" in GRE_MILESTONE, we're building Nightly (define NIGHTLY_BUILD)
 # - otherwise, if we have "a" in GRE_MILESTONE, we're building Nightly or Aurora
 # - otherwise, we're building Release/Beta (define RELEASE_OR_BETA)
-@depends(check_build_environment, '--help')
+@depends(check_build_environment, build_project, '--help')
 @imports(_from='__builtin__', _import='open')
 @imports('re')
-def milestone(build_env, _):
-    milestone_path = os.path.join(build_env.topsrcdir,
-                                  'config',
-                                  'milestone.txt')
-    with open(milestone_path, 'r') as fh:
-        milestone = fh.read().splitlines()[-1]
+def milestone(build_env, build_project, _):
+    versions = []
+    paths = ['config/milestone.txt']
+    if build_project == 'js':
+        paths = paths * 3
+    else:
+        paths += [
+            'browser/config/version.txt',
+            'browser/config/version_display.txt',
+        ]
+    for p in paths:
+        with open(os.path.join(build_env.topsrcdir, p), 'r') as fh:
+            content = fh.read().splitlines()
+            if not content:
+                die('Could not find a version number in {}'.format(p))
+            versions.append(content[-1])
+
+    milestone, firefox_version, firefox_version_display = versions
 
     is_nightly = is_release_or_beta = None
 
     if 'a1' in milestone:
         is_nightly = True
     elif 'a' not in milestone:
         is_release_or_beta = True
 
@@ -1066,17 +1078,19 @@ def milestone(build_env, _):
     # patch leve (bugs 572659 and 870868).
     #
     # Only expose major milestone and alpha version in the symbolversion
     # string; as the name suggests, we use it for symbol versioning on Linux.
     return namespace(version=milestone,
                      uaversion='%s.0' % major_version,
                      symbolversion='%s%s' % (major_version, ab_patch),
                      is_nightly=is_nightly,
-                     is_release_or_beta=is_release_or_beta)
+                     is_release_or_beta=is_release_or_beta,
+                     firefox_version=firefox_version,
+                     firefox_version_display=firefox_version_display)
 
 
 set_config('GRE_MILESTONE', milestone.version)
 set_config('NIGHTLY_BUILD', milestone.is_nightly)
 set_define('NIGHTLY_BUILD', milestone.is_nightly)
 add_old_configure_assignment('NIGHTLY_BUILD', milestone.is_nightly)
 set_config('RELEASE_OR_BETA', milestone.is_release_or_beta)
 set_define('RELEASE_OR_BETA', milestone.is_release_or_beta)
@@ -1086,16 +1100,21 @@ set_define('MOZILLA_VERSION', depends(mi
 set_config('MOZILLA_VERSION', milestone.version)
 set_define('MOZILLA_VERSION_U', milestone.version)
 set_define('MOZILLA_UAVERSION', depends(milestone)(lambda m: '"%s"' % m.uaversion))
 set_config('MOZILLA_SYMBOLVERSION', milestone.symbolversion)
 # JS configure still wants to look at these.
 add_old_configure_assignment('MOZILLA_VERSION', milestone.version)
 add_old_configure_assignment('MOZILLA_SYMBOLVERSION', milestone.symbolversion)
 
+set_config('FIREFOX_VERSION', milestone.firefox_version)
+set_define('FIREFOX_VERSION', milestone.firefox_version)
+add_old_configure_assignment('FIREFOX_VERSION', milestone.firefox_version)
+add_old_configure_assignment('FIREFOX_VERSION_DISPLAY', milestone.firefox_version_display)
+
 # The app update channel is 'default' when not supplied. The value is used in
 # the application's confvars.sh (and is made available to a project specific
 # moz.configure).
 option('--enable-update-channel',
        nargs=1,
        help='Select application update channel',
        default='default')
 
--- a/old-configure.in
+++ b/old-configure.in
@@ -684,28 +684,16 @@ case "$host" in
     ;;
 
 *)
     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
     ;;
 esac
 
-dnl Get version of various core apps from the version files.
-FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
-FIREFOX_VERSION_DISPLAY=`cat $_topsrcdir/browser/config/version_display.txt`
-
-if test -z "$FIREFOX_VERSION"; then
-    AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
-fi
-
-if test -z "$FIREFOX_VERSION_DISPLAY"; then
-    AC_MSG_ERROR([FIREFOX_VERSION_DISPLAY is unexpectedly blank.])
-fi
-
 MOZ_DOING_LTO(lto_is_enabled)
 
 dnl ========================================================
 dnl System overrides of the defaults for target
 dnl ========================================================
 
 case "$target" in
 *-darwin*)
@@ -4066,18 +4054,16 @@ AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MO
 AC_SUBST(MOZ_APP_UA_NAME)
 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
 AC_SUBST(MOZ_APP_VERSION)
 AC_SUBST(MOZ_APP_VERSION_DISPLAY)
 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL, $BROWSER_CHROME_URL)
 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL_QUOTED, "$BROWSER_CHROME_URL")
 
 AC_SUBST(MOZ_APP_MAXVERSION)
-AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
-AC_SUBST(FIREFOX_VERSION)
 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
   AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
 fi
 
 AC_SUBST(MOZ_PKG_SPECIAL)
 AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)