Bug 1491907 - Get comm/ version from comm/mail/*version.txt r=dustin
authorRob Lemley <rob@thunderbird.net>
Sat, 29 Sep 2018 20:53:10 +0000
changeset 494636 b96cec26d463643b2dc0347930cf2561bfcb0071
parent 494635 f9cf6e98fc4bbaebf12fe6c101adc6f7ff8702c7
child 494637 e540269f91e25d1735c619facf0af77115a8abb9
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdustin
bugs1491907
milestone64.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 1491907 - Get comm/ version from comm/mail/*version.txt r=dustin The release-update-verify-config task requires that the versions passed to it match up with what's been released. The version of Thunderbird does not necessarily match the Gecko version it's based on. Depends on D6509 Differential Revision: https://phabricator.services.mozilla.com/D6510
taskcluster/ci/config.yml
taskcluster/taskgraph/__init__.py
taskcluster/taskgraph/config.py
taskcluster/taskgraph/decision.py
taskcluster/taskgraph/parameters.py
--- a/taskcluster/ci/config.yml
+++ b/taskcluster/ci/config.yml
@@ -1,10 +1,11 @@
 trust-domain: gecko
 project-repo-param-prefix: ''
+product-dir: 'browser'
 treeherder:
     group-names:
         'cram': 'Cram tests'
         'js-bench-sm': 'JavaScript shell benchmarks with Spidermonkey'
         'js-bench-v8': 'JavaScript shell benchmarks with Google V8'
         'mocha': 'Mocha unit tests'
         'py2': 'Python 2 unit tests'
         'py3': 'Python 3 unit tests'
--- a/taskcluster/taskgraph/__init__.py
+++ b/taskcluster/taskgraph/__init__.py
@@ -3,19 +3,16 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 from __future__ import absolute_import, print_function, unicode_literals
 
 import os
 
 GECKO = os.path.realpath(os.path.join(__file__, '..', '..', '..'))
 
-APP_VERSION_PATH = os.path.join(GECKO, "browser", "config", "version.txt")
-VERSION_PATH = os.path.join(GECKO, "browser", "config", "version_display.txt")
-
 # Maximum number of dependencies a single task can have
 # https://docs.taskcluster.net/reference/platform/taskcluster-queue/references/api#createTask
 # specifies 100, but we also optionally add the decision task id as a dep in
 # taskgraph.create, so let's set this to 99.
 MAX_DEPENDENCIES = 99
 
 # Enable fast task generation for local debugging
 # This is normally switched on via the --fast/-F flag to `mach taskgraph`
--- a/taskcluster/taskgraph/config.py
+++ b/taskcluster/taskgraph/config.py
@@ -19,22 +19,25 @@ graph_config_schema = Schema({
     # The trust-domain for this graph.
     # (See https://firefox-source-docs.mozilla.org/taskcluster/taskcluster/taskgraph.html#taskgraph-trust-domain)  # noqa
     Required('trust-domain'): basestring,
     # This specifes the prefix for repo parameters that refer to the project being built.
     # This selects between `head_rev` and `comm_head_rev` and related paramters.
     # (See http://firefox-source-docs.mozilla.org/taskcluster/taskcluster/parameters.html#push-information  # noqa
     # and http://firefox-source-docs.mozilla.org/taskcluster/taskcluster/parameters.html#comm-push-information)  # noqa
     Required('project-repo-param-prefix'): basestring,
+    # This specifies the top level directory of the application being built.
+    # ie. "browser/" for Firefox, "comm/mail/" for Thunderbird.
+    Required('product-dir'): basestring,
     Required('treeherder'): {
         # Mapping of treeherder group symbols to descriptive names
         Required('group-names'): {basestring: basestring}
     },
     Required('index'): {
-        Required('products'): [basestring],
+        Required('products'): [basestring]
     },
     Required('try'): {
         # We have a few platforms for which we want to do some "extra" builds, or at
         # least build-ish things.  Sort of.  Anyway, these other things are implemented
         # as different "platforms".  These do *not* automatically ride along with "-p
         # all"
         Required('ridealong-builds', default={}): {basestring: [basestring]},
     },
--- a/taskcluster/taskgraph/decision.py
+++ b/taskcluster/taskgraph/decision.py
@@ -15,16 +15,17 @@ import yaml
 from .generator import TaskGraphGenerator
 from .create import create_tasks
 from .parameters import Parameters, get_version, get_app_version
 from .taskgraph import TaskGraph
 from .try_option_syntax import parse_message
 from .actions import render_actions_json
 from taskgraph.util.partials import populate_release_history
 from taskgraph.util.yaml import load_yaml
+from taskgraph.config import load_graph_config
 
 
 logger = logging.getLogger(__name__)
 
 ARTIFACTS_DIR = 'artifacts'
 
 # For each project, this gives a set of parameters specific to the project.
 # See `taskcluster/docs/parameters.rst` for information on parameters.
@@ -181,16 +182,21 @@ def taskgraph_decision(options, paramete
 
 
 def get_decision_parameters(options):
     """
     Load parameters from the command-line options for 'taskgraph decision'.
     This also applies per-project parameters, based on the given project.
 
     """
+    # --root is not passed to mach when building Firefox
+    root = options.get('root') or 'taskcluster/ci'
+    _config = load_graph_config(root)
+    product_dir = _config['product-dir']
+
     parameters = {n: options[n] for n in [
         'base_repository',
         'head_repository',
         'head_rev',
         'head_ref',
         'message',
         'project',
         'pushlog_id',
@@ -213,18 +219,18 @@ def get_decision_parameters(options):
     # custom filters.
     parameters['filters'] = [
         'check_servo',
         'target_tasks_method',
     ]
     parameters['existing_tasks'] = {}
     parameters['do_not_optimize'] = []
     parameters['build_number'] = 1
-    parameters['version'] = get_version()
-    parameters['app_version'] = get_app_version()
+    parameters['version'] = get_version(product_dir)
+    parameters['app_version'] = get_app_version(product_dir)
     parameters['next_version'] = None
     parameters['release_type'] = 'nightly'
     parameters['release_eta'] = ''
     parameters['release_enable_partners'] = False
     parameters['release_partners'] = []
     parameters['release_partner_config'] = {}
     parameters['release_partner_build_number'] = 1
     parameters['release_enable_emefree'] = False
--- a/taskcluster/taskgraph/parameters.py
+++ b/taskcluster/taskgraph/parameters.py
@@ -1,26 +1,26 @@
 # -*- coding: utf-8 -*-
 
 # 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 functools
+import os.path
 import json
 import time
 import yaml
 from datetime import datetime
 
 from mozbuild.util import ReadOnlyDict, memoize
 from mozversioncontrol import get_repository_object
 
-from . import APP_VERSION_PATH, GECKO, VERSION_PATH
+from . import GECKO
 from .util.attributes import RELEASE_PROJECTS
 
 
 class ParameterMismatch(Exception):
     """Raised when a parameters.yml has extra or missing parameters."""
 
 
 @memoize
@@ -29,18 +29,26 @@ def get_head_ref():
 
 
 def get_contents(path):
     with open(path, "r") as fh:
         contents = fh.readline().rstrip()
     return contents
 
 
-get_version = functools.partial(get_contents, VERSION_PATH)
-get_app_version = functools.partial(get_contents, APP_VERSION_PATH)
+def get_version(product_dir='browser'):
+    version_path = os.path.join(GECKO, product_dir, 'config',
+                                'version_display.txt')
+    return get_contents(version_path)
+
+
+def get_app_version(product_dir='browser'):
+    app_version_path = os.path.join(GECKO, product_dir, 'config',
+                                    'version.txt')
+    return get_contents(app_version_path)
 
 
 # Please keep this list sorted and in sync with taskcluster/docs/parameters.rst
 # Parameters are of the form: {name: default}
 PARAMETERS = {
     'app_version': get_app_version(),
     'base_repository': 'https://hg.mozilla.org/mozilla-unified',
     'build_date': lambda: int(time.time()),