зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1422859 - move MOZILLA_*VERSION setting into moz.configure; r=chmanchester
This has the virtue of not executing python three times during configure just to read the same value of milestone.txt and munge it. We can also remove milestone.py as a happy side effect, so all the milestone computations can be done in init.configure.
This commit is contained in:
Родитель
74128f6578
Коммит
6d4a891a5f
|
@ -994,6 +994,7 @@ add_old_configure_assignment('MOZ_BUILD_APP', build_project)
|
|||
# - otherwise, we're building Release/Beta (define RELEASE_OR_BETA)
|
||||
@depends(check_build_environment, '--help')
|
||||
@imports(_from='__builtin__', _import='open')
|
||||
@imports('re')
|
||||
def milestone(build_env, _):
|
||||
milestone_path = os.path.join(build_env.topsrcdir,
|
||||
'config',
|
||||
|
@ -1008,7 +1009,18 @@ def milestone(build_env, _):
|
|||
elif 'a' not in milestone:
|
||||
is_release_or_beta = True
|
||||
|
||||
major_version = milestone.split('.')[0]
|
||||
m = re.search(r"([ab]\d+)", milestone)
|
||||
ab_patch = m.group(1) if m else ''
|
||||
|
||||
# Only expose the major version milestone in the UA string and hide the
|
||||
# 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)
|
||||
|
||||
|
@ -1021,6 +1033,14 @@ set_config('RELEASE_OR_BETA', milestone.is_release_or_beta)
|
|||
set_define('RELEASE_OR_BETA', milestone.is_release_or_beta)
|
||||
add_old_configure_assignment('RELEASE_OR_BETA',
|
||||
milestone.is_release_or_beta)
|
||||
set_define('MOZILLA_VERSION', depends(milestone)(lambda m: '"%s"' % m.version))
|
||||
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)
|
||||
|
||||
# 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
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
# x.x.x.x
|
||||
# x.x.x+
|
||||
#
|
||||
# Referenced by milestone.py.
|
||||
# Referenced by build/moz.configure/init.configure.
|
||||
# Hopefully I'll be able to automate replacement of *all*
|
||||
# hardcoded milestones in the tree from these two files.
|
||||
#--------------------------------------------------------
|
||||
|
|
|
@ -356,21 +356,6 @@ XCFLAGS="$X_CFLAGS"
|
|||
|
||||
fi # COMPILE_ENVIRONMENT
|
||||
|
||||
dnl ==============================================================
|
||||
dnl Get mozilla version from central milestone file
|
||||
dnl ==============================================================
|
||||
MOZILLA_VERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir`
|
||||
MOZILLA_UAVERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir --uaversion`
|
||||
MOZILLA_SYMBOLVERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir --symbolversion`
|
||||
if test -z "$MOZILLA_VERSION"; then
|
||||
AC_MSG_ERROR([failed to read version info from milestone file])
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
|
||||
AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
|
||||
AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION,"$MOZILLA_UAVERSION")
|
||||
AC_SUBST(MOZILLA_SYMBOLVERSION)
|
||||
|
||||
# Separate version into components for use in shared object naming etc
|
||||
changequote(,)
|
||||
MOZJS_MAJOR_VERSION=`echo $MOZILLA_VERSION | sed "s|\(^[0-9]*\)\.[0-9]*.*|\1|"`
|
||||
|
@ -1926,8 +1911,6 @@ MOZ_CHECK_ALLOCATOR
|
|||
|
||||
AC_CHECK_FUNCS(setlocale localeconv)
|
||||
|
||||
AC_SUBST(MOZILLA_VERSION)
|
||||
|
||||
AC_SUBST(ac_configure_args)
|
||||
|
||||
if test -n "$JS_STANDALONE"; then
|
||||
|
|
|
@ -748,16 +748,6 @@ case "$host" in
|
|||
;;
|
||||
esac
|
||||
|
||||
dnl ==============================================================
|
||||
dnl Get mozilla version from central milestone file
|
||||
dnl ==============================================================
|
||||
MOZILLA_VERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir`
|
||||
MOZILLA_UAVERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir --uaversion`
|
||||
MOZILLA_SYMBOLVERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir --symbolversion`
|
||||
if test -z "$MOZILLA_VERSION"; then
|
||||
AC_MSG_ERROR([failed to read version info from milestone file])
|
||||
fi
|
||||
|
||||
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`
|
||||
|
@ -770,11 +760,6 @@ if test -z "$FIREFOX_VERSION_DISPLAY"; then
|
|||
AC_MSG_ERROR([FIREFOX_VERSION_DISPLAY is unexpectedly blank.])
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
|
||||
AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
|
||||
AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION,"$MOZILLA_UAVERSION")
|
||||
AC_SUBST(MOZILLA_SYMBOLVERSION)
|
||||
|
||||
MOZ_DOING_LTO(lto_is_enabled)
|
||||
|
||||
dnl ========================================================
|
||||
|
@ -4843,8 +4828,6 @@ if test -n "$A11Y_LOG"; then
|
|||
AC_DEFINE(A11Y_LOG)
|
||||
fi
|
||||
|
||||
AC_SUBST(MOZILLA_VERSION)
|
||||
|
||||
dnl Spit out some output
|
||||
dnl ========================================================
|
||||
|
||||
|
|
|
@ -1,75 +0,0 @@
|
|||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# 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/.
|
||||
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
|
||||
def get_milestone_ab_with_num(milestone):
|
||||
"""
|
||||
Returns the alpha and beta tag with its number (a1, a2, b3, ...).
|
||||
"""
|
||||
|
||||
match = re.search(r"([ab]\d+)", milestone)
|
||||
if match:
|
||||
return match.group(1)
|
||||
|
||||
return ""
|
||||
|
||||
|
||||
def get_official_milestone(path):
|
||||
"""
|
||||
Returns the contents of the first line in `path` that starts with a digit.
|
||||
"""
|
||||
|
||||
with open(path) as fp:
|
||||
for line in fp:
|
||||
line = line.strip()
|
||||
if line[:1].isdigit():
|
||||
return line
|
||||
|
||||
raise Exception("Didn't find a line that starts with a digit.")
|
||||
|
||||
|
||||
def get_milestone_major(milestone):
|
||||
"""
|
||||
Returns the major (first) part of the milestone.
|
||||
"""
|
||||
|
||||
return milestone.split('.')[0]
|
||||
|
||||
|
||||
def main(args):
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--uaversion', default=False, action='store_true')
|
||||
parser.add_argument('--symbolversion', default=False, action='store_true')
|
||||
parser.add_argument('--topsrcdir', metavar='TOPSRCDIR', required=True)
|
||||
options = parser.parse_args(args)
|
||||
|
||||
milestone_file = os.path.join(options.topsrcdir, 'config', 'milestone.txt')
|
||||
|
||||
milestone = get_official_milestone(milestone_file)
|
||||
|
||||
if options.uaversion:
|
||||
# Only expose the major milestone in the UA string, hide the patch
|
||||
# level (bugs 572659 and 870868).
|
||||
uaversion = "%s.0" % (get_milestone_major(milestone),)
|
||||
print(uaversion)
|
||||
|
||||
elif options.symbolversion:
|
||||
# Only expose major milestone and alpha version. Used for symbol
|
||||
# versioning on Linux.
|
||||
symbolversion = "%s%s" % (get_milestone_major(milestone),
|
||||
get_milestone_ab_with_num(milestone))
|
||||
print(symbolversion)
|
||||
else:
|
||||
print(milestone)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main(sys.argv[1:])
|
Загрузка…
Ссылка в новой задаче