Bug 1497575: [staging-release] Add an option to limit the locales that get built; r=aki
authorTom Prince <mozilla@hocat.ca>
Mon, 15 Oct 2018 21:43:21 +0000
changeset 490107 c921b0c914099ecafb250540c9e3ef1b01794ed3
parent 490106 80f7c4e29bea3f238bbf047c3fdf8e853c8c0a5d
child 490108 3a4b8a6a0881ee031ce226f7a725d283e28f1137
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersaki
bugs1497575
milestone64.0a1
Bug 1497575: [staging-release] Add an option to limit the locales that get built; r=aki Differential Revision: https://phabricator.services.mozilla.com/D8627
tools/tryselect/selectors/release.py
--- a/tools/tryselect/selectors/release.py
+++ b/tools/tryselect/selectors/release.py
@@ -8,16 +8,21 @@ import os
 
 import attr
 from mozilla_version.gecko import FirefoxVersion
 
 from ..cli import BaseTryParser
 from ..push import push_to_try, vcs
 
 
+def read_file(path):
+    with open(path) as fh:
+        return fh.read()
+
+
 class ReleaseParser(BaseTryParser):
     name = 'release'
     arguments = [
         [['-v', '--version'],
          {'metavar': 'STR',
           'required': True,
           'action': 'store',
           'type': FirefoxVersion.parse,
@@ -25,21 +30,28 @@ class ReleaseParser(BaseTryParser):
           }],
         [['--migration'],
          {'metavar': 'STR',
           'action': 'append',
           'dest': 'migrations',
           'choices': ['central-to-beta', 'beta-to-release'],
           'help': "Migration to run for the release (can be specified multiple times).",
           }],
+        [['--no-limit-locales'],
+         {'action': 'store_false',
+          'dest': 'limit_locales',
+          'help': "Don't build a limited number of locales in the staging release.",
+          }],
     ]
     common_groups = ['push']
 
 
-def run_try_release(version, migrations=(), push=True, message='{msg}', **kwargs):
+def run_try_release(
+    version, migrations=(), push=True, message='{msg}', limit_locales=True, **kwargs
+):
 
     if version.is_beta:
         app_version = attr.evolve(version, beta_number=None)
     else:
         app_version = version
 
     files_to_change = {
         'browser/config/version.txt': '{}\n'.format(app_version),
@@ -68,19 +80,24 @@ def run_try_release(version, migrations=
             '{}.py'.format(migration.replace('-', '_')),
         )
         migration_config = {}
         execfile(migration_path, migration_config, migration_config)
         for (path, from_, to) in migration_config['config']['replacements']:
             if path in files_to_change:
                 contents = files_to_change[path]
             else:
-                with open(path) as fh:
-                    contents = fh.read()
+                contents = read_file(path)
             files_to_change[path] = contents.replace(from_, to)
 
+    if limit_locales:
+        files_to_change['browser/locales/l10n-changesets.json'] = read_file(
+            os.path.join(vcs.path, 'browser/locales/l10n-onchange-changesets.json'))
+        files_to_change['browser/locales/shipped-locales'] = "en-US\n" + read_file(
+            os.path.join(vcs.path, 'browser/locales/onchange-locales'))
+
     msg = 'staging release: {}'.format(version)
     return push_to_try(
         'release', message.format(msg=msg),
         push=push, closed_tree=kwargs["closed_tree"],
         try_task_config=task_config,
         files_to_change=files_to_change,
     )