Bug 1391427 - Add script 'arguments' key to toolchain tasks. r?glandium
Add an optional 'arguments' key to the yaml description for toolchain
tasks. This is just a string which is appended to the script invocation.
This lets us set behaviour, e.g. selecting the version to build or
selecting targets from the task description instead of having to
hard-code those things in the build script itself. Where the same
script otherwise works for multiple configurations, that is easier
to update and simplifies supporting variants.
MozReview-Commit-ID: 30oJYnQaZ7A
--- a/taskcluster/taskgraph/transforms/job/toolchain.py
+++ b/taskcluster/taskgraph/transforms/job/toolchain.py
@@ -24,19 +24,24 @@ from taskgraph.util.hash import hash_pat
from taskgraph import GECKO
TOOLCHAIN_INDEX = 'gecko.cache.level-{level}.toolchains.v1.{name}.{digest}'
toolchain_run_schema = Schema({
Required('using'): 'toolchain-script',
- # the script (in taskcluster/scripts/misc) to run
+ # The script (in taskcluster/scripts/misc) to run.
+ # Python scripts are invoked with `mach python` so vendored libraries
+ # are available.
Required('script'): basestring,
+ # Arguments to pass to the script.
+ Optional('arguments'): basestring,
+
# If not false, tooltool downloads will be enabled via relengAPIProxy
# for either just public files, or all files. Not supported on Windows
Required('tooltool-downloads', default=False): Any(
False,
'public',
'internal',
),
@@ -59,31 +64,36 @@ def add_optimizations(config, run, taskd
files.append('taskcluster/taskgraph/transforms/job/toolchain.py')
# The script
files.append('taskcluster/scripts/misc/{}'.format(run['script']))
# Tooltool manifest if any is defined:
tooltool_manifest = taskdesc['worker']['env'].get('TOOLTOOL_MANIFEST')
if tooltool_manifest:
files.append(tooltool_manifest)
- digest = hash_paths(GECKO, files)
+ # Accumulate dependency hashes for index generation.
+ data = [hash_paths(GECKO, files)]
# If the task has dependencies, we need those dependencies to influence
# the index path. So take the digest from the files above, add the list
# of its dependencies, and hash the aggregate.
# If the task has no dependencies, just use the digest from above.
deps = taskdesc['dependencies']
if deps:
- data = [digest] + sorted(deps.values())
- digest = hashlib.sha256('\n'.join(data)).hexdigest()
+ data.extend(sorted(deps.values()))
+
+ # Likewise script arguments should influence the index.
+ args = run.get('arguments')
+ if args:
+ data.append(args)
label = taskdesc['label']
subs = {
'name': label.replace('%s-' % config.kind, ''),
- 'digest': digest,
+ 'digest': hashlib.sha256('\n'.join(data)).hexdigest()
}
optimizations = taskdesc.setdefault('optimizations', [])
# We'll try to find a cached version of the toolchain at levels above
# and including the current level, starting at the highest level.
for level in reversed(range(int(config.params['level']), 4)):
subs['level'] = level