bug 1345619 - look for build_platform in l10n-changesets.json. r=callek
Stop hardcoding `android`, since we want to use this for desktop too.
We could potentially remove the `android` platform from the bumper configs
at this point.
We strip `-nightly` from the `build_platform` before comparing against the
`l10n-changesets.json` platform list. If we want to support different sets
of ci and nightly locales, we could either:
- point at a second changesets file for ci. This could either be a flatfile
or json; either works. or,
- explicitly name `win32-nightly` etc. in the platform list, and stop removing
the `-nightly` from the `build_platform` before comparing. This means some
locales may have up to 10 different platforms listed. This may get unwieldy,
but would be explicit.
MozReview-Commit-ID: Fvpby92cXdg
--- a/taskcluster/taskgraph/transforms/l10n.py
+++ b/taskcluster/taskgraph/transforms/l10n.py
@@ -127,30 +127,29 @@ l10n_description_schema = Schema({
# passed through directly to the job description
Optional('attributes'): job_description_schema['attributes'],
Optional('extra'): job_description_schema['extra'],
})
transforms = TransformSequence()
-def _parse_locales_file(locales_file, platform=None):
+def _parse_locales_file(locales_file, platform):
""" Parse the passed locales file for a list of locales.
- If platform is unset matches all platforms.
"""
locales = []
with open(locales_file, mode='r') as f:
if locales_file.endswith('json'):
all_locales = json.load(f)
# XXX Only single locales are fetched
locales = {
locale: data['revision']
for locale, data in all_locales.items()
- if 'android' in data['platforms']
+ if platform in data['platforms']
}
else:
all_locales = f.read().split()
# 'default' is the hg revision at the top of hg repo, in this context
locales = {locale: 'default' for locale in all_locales}
return locales
@@ -259,17 +258,19 @@ def handle_keyed_by(config, jobs):
for field in fields:
resolve_keyed_by(item=job, field=field, item_name=job['name'])
yield job
@transforms.add
def all_locales_attribute(config, jobs):
for job in jobs:
- locales_with_changesets = _parse_locales_file(job["locales-file"])
+ locales_platform = job['attributes']['build_platform'].rstrip("-nightly")
+ locales_with_changesets = _parse_locales_file(job["locales-file"],
+ platform=locales_platform)
locales_with_changesets = _remove_locales(locales_with_changesets,
to_remove=job['ignore-locales'])
locales = sorted(locales_with_changesets.keys())
attributes = job.setdefault('attributes', {})
attributes["all_locales"] = locales
attributes["all_locales_with_changesets"] = locales_with_changesets
yield job