No bug: [mozharness] Remove unused `--revision` option from l10n scripts; r=Callek
authorTom Prince <mozilla@hocat.ca>
Wed, 24 Oct 2018 17:57:39 +0000
changeset 491180 41e237ce7cccf1bcec005719145831a59289efbc
parent 491179 08b16a40d372d72f0a8eda2f56cad2064e4df6b3
child 491181 c5bded90844ee80d7fc2475ae999fe0b843391cc
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersCallek
milestone65.0a1
No bug: [mozharness] Remove unused `--revision` option from l10n scripts; r=Callek Differential Revision: https://phabricator.services.mozilla.com/D9621
taskcluster/ci/l10n/kind.yml
taskcluster/ci/nightly-l10n/kind.yml
taskcluster/taskgraph/transforms/l10n.py
testing/mozharness/configs/single_locale/mozilla-esr60.py
testing/mozharness/mozharness/mozilla/building/buildbase.py
testing/mozharness/scripts/desktop_l10n.py
testing/mozharness/scripts/mobile_l10n.py
--- a/taskcluster/ci/l10n/kind.yml
+++ b/taskcluster/ci/l10n/kind.yml
@@ -162,19 +162,17 @@ job-template:
                     - single_locale/tc_common.py
                     - single_locale/tc_win64.py
                     - single_locale/onchange.py
                 android-api-16:
                     - single_locale/{project}_android-api-16.py
                     - single_locale/tc_common.py
                     - single_locale/tc_android-api-16.py
                     - single_locale/onchange.py
-        # no default, so we fail on new entries
-        options:
-            - revision=$GECKO_HEAD_REV
+                # no default, so we fail on new entries
         actions:
             by-build-platform:
                 default: ['clone-locales', 'list-locales', 'setup', 'repack',
                           'summary']
                 android-api-16: ['get-secrets',
                                  'clone-locales', 'list-locales', 'setup', 'repack',
                                  'upload-repacks', 'summary']
         script:
--- a/taskcluster/ci/nightly-l10n/kind.yml
+++ b/taskcluster/ci/nightly-l10n/kind.yml
@@ -217,19 +217,17 @@ job-template:
                     - single_locale/tc_common.py
                     - single_locale/tc_win64.py
                     - taskcluster_nightly.py
                 android-api-16-nightly:
                     - taskcluster_nightly.py
                     - single_locale/{project}_android-api-16.py
                     - single_locale/tc_common.py
                     - single_locale/tc_android-api-16.py
-        # no default, so we fail on new entries
-        options:
-            - revision=$GECKO_HEAD_REV
+                # no default, so we fail on new entries
         actions:
             by-build-platform:
                 default: ['clone-locales', 'list-locales', 'setup', 'repack',
                           'summary']
                 android-api-16-nightly: ['get-secrets',
                                          'clone-locales', 'list-locales', 'setup', 'repack',
                                          'upload-repacks', 'summary']
         script:
--- a/taskcluster/taskgraph/transforms/l10n.py
+++ b/taskcluster/taskgraph/transforms/l10n.py
@@ -67,17 +67,17 @@ l10n_description_schema = Schema({
         # Config files passed to the mozharness script
         Required('config'): _by_platform([basestring]),
 
         # Additional paths to look for mozharness configs in. These should be
         # relative to the base of the source checkout
         Optional('config-paths'): [basestring],
 
         # Options to pass to the mozharness script
-        Required('options'): _by_platform([basestring]),
+        Optional('options'): _by_platform([basestring]),
 
         # Action commands to provide to mozharness script
         Required('actions'): _by_platform([basestring]),
 
         # if true, perform a checkout of a comm-central based branch inside the
         # gecko checkout
         Required('comm-checkout', default=False): bool,
     },
--- a/testing/mozharness/configs/single_locale/mozilla-esr60.py
+++ b/testing/mozharness/configs/single_locale/mozilla-esr60.py
@@ -16,16 +16,15 @@ config = {
     "repos": [{
         "vcs": "hg",
         "repo": "https://hg.mozilla.org/build/tools",
         "branch": "default",
         "dest": "tools",
     }, {
         "vcs": "hg",
         "repo": "https://hg.mozilla.org/releases/mozilla-esr60",
-        "revision": "%(revision)s",
         "dest": "mozilla-esr60",
         "clone_upstream_url": "https://hg.mozilla.org/mozilla-unified",
     }],
     # purge options
     'purge_minsize': 12,
     'is_automation': True,
 }
--- a/testing/mozharness/mozharness/mozilla/building/buildbase.py
+++ b/testing/mozharness/mozharness/mozilla/building/buildbase.py
@@ -997,35 +997,16 @@ or run without that action (ie: --no-{ac
         if cache:
             cmd.extend(['--cache-dir', cache])
         if toolchains:
             cmd.extend(toolchains.split())
         self.info(str(cmd))
         self.run_command(cmd, cwd=dirs['abs_src_dir'], halt_on_failure=True,
                          env=env)
 
-    def query_revision(self, source_path=None):
-        """ returns the revision of the build
-
-         This method is used both to figure out what revision to check out and
-         to figure out what revision *was* checked out.
-        """
-        revision = None
-        if not source_path:
-            dirs = self.query_abs_dirs()
-            source_path = dirs['abs_src_dir']  # let's take the default
-
-        # Look at what we have checked out
-        if os.path.exists(source_path):
-            hg = self.query_exe('hg', return_type='list')
-            revision = self.get_output_from_command(
-                hg + ['parent', '--template', '{node}'], cwd=source_path
-            )
-        return revision.encode('ascii', 'replace') if revision else None
-
     def generate_build_props(self, console_output=True, halt_on_failure=False):
         """sets props found from mach build and, in addition, buildid,
         sourcestamp,  appVersion, and appName."""
 
         error_level = ERROR
         if halt_on_failure:
             error_level = FATAL
 
--- a/testing/mozharness/scripts/desktop_l10n.py
+++ b/testing/mozharness/scripts/desktop_l10n.py
@@ -45,17 +45,17 @@ FAILURE_STR = "Failed"
 
 # mandatory configuration options, without them, this script will not work
 # it's a list of values that are already known before starting a build
 configuration_tokens = ('branch', 'update_channel')
 
 # some other values such as "%(version)s", ...
 # are defined at run time and they cannot be enforced in the _pre_config_lock
 # phase
-runtime_config_tokens = ('version', 'locale', 'abs_objdir', 'revision',
+runtime_config_tokens = ('version', 'locale', 'abs_objdir',
                          'en_us_installer_binary_url')
 
 
 # DesktopSingleLocale {{{1
 class DesktopSingleLocale(LocalesMixin, AutomationMixin,
                           VCSMixin, BaseScript, MarMixin):
     """Manages desktop repacks"""
     config_options = [[
@@ -67,23 +67,16 @@ class DesktopSingleLocale(LocalesMixin, 
                  " revision separated by colon, en-GB:default."}
     ], [
         ['--tag-override', ],
         {"action": "store",
          "dest": "tag_override",
          "type": "string",
          "help": "Override the tags set for all repos"}
     ], [
-        ['--revision', ],
-        {"action": "store",
-         "dest": "revision",
-         "type": "string",
-         "help": "Override the gecko revision to use (otherwise use automation supplied"
-                 " value, or en-US revision) "}
-    ], [
         ['--en-us-installer-url', ],
         {"action": "store",
          "dest": "en_us_installer_url",
          "type": "string",
          "help": "Specify the url of the en-us binary"}
     ], [
         ['--scm-level'], {  # Ignored on desktop for now: see Bug 1414678.
          "action": "store",
@@ -117,17 +110,16 @@ class DesktopSingleLocale(LocalesMixin, 
             self,
             config_options=self.config_options,
             require_config_file=require_config_file,
             **buildscript_kwargs
         )
 
         self.bootstrap_env = None
         self.upload_env = None
-        self.revision = None
         self.upload_urls = {}
         self.pushdate = None
         # upload_files is a dictionary of files to upload, keyed by locale.
         self.upload_files = {}
 
     def _pre_config_lock(self, rw_config):
         """replaces 'configuration_tokens' with their values, before the
            configuration gets locked. If some of the configuration_tokens
@@ -278,37 +270,16 @@ class DesktopSingleLocale(LocalesMixin, 
         self.upload_env = upload_env
         return self.upload_env
 
     def query_l10n_env(self):
         l10n_env = self._query_upload_env().copy()
         l10n_env.update(self.query_bootstrap_env())
         return l10n_env
 
-    def _query_revision(self):
-        """ Get the gecko revision in this order of precedence
-              * cached value
-              * command line arg --revision   (development, taskcluster)
-              * from the en-US build          (m-c & m-a)
-
-        This will fail the last case if the build hasn't been pulled yet.
-        """
-        if self.revision:
-            return self.revision
-
-        config = self.config
-        revision = None
-        if config.get("revision"):
-            revision = config["revision"]
-
-        if not revision:
-            self.fatal("Can't determine revision!")
-        self.revision = str(revision)
-        return self.revision
-
     def _query_make_variable(self, variable, make_args=None):
         """returns the value of make echo-variable-<variable>
            it accepts extra make arguements (make_args)
         """
         dirs = self.query_abs_dirs()
         make_args = make_args or []
         target = ["echo-variable-%s" % variable] + make_args
         cwd = dirs['abs_locales_dir']
--- a/testing/mozharness/scripts/mobile_l10n.py
+++ b/testing/mozharness/scripts/mobile_l10n.py
@@ -46,23 +46,16 @@ class MobileSingleLocale(LocalesMixin, T
     ], [
         ['--tag-override', ],
         {"action": "store",
          "dest": "tag_override",
          "type": "string",
          "help": "Override the tags set for all repos"
          }
     ], [
-        ['--revision', ],
-        {"action": "store",
-         "dest": "revision",
-         "type": "string",
-         "help": "Override the gecko revision to use (otherwise use automation supplied"
-                 " value, or en-US revision) "}
-    ], [
         ['--scm-level'],
         {"action": "store",
          "type": "int",
          "dest": "scm_level",
          "default": 1,
          "help": "This sets the SCM level for the branch being built."
                  " See https://www.mozilla.org/en-US/about/"
                  "governance/policies/commit/access-policy/"}
@@ -86,17 +79,16 @@ class MobileSingleLocale(LocalesMixin, T
         MercurialScript.__init__(
             self,
             config_options=self.config_options,
             require_config_file=require_config_file,
             **buildscript_kwargs
         )
         self.base_package_name = None
         self.repack_env = None
-        self.revision = None
         self.upload_env = None
         self.upload_urls = {}
 
     # Helper methods {{{2
     def query_repack_env(self):
         if self.repack_env:
             return self.repack_env
         c = self.config
@@ -123,36 +115,16 @@ class MobileSingleLocale(LocalesMixin, T
         if self.upload_env:
             return self.upload_env
 
         upload_env = self.query_env(partial_env=self.config.get("upload_env"),
                                     replace_dict=dict(self.config))
         self.upload_env = upload_env
         return self.upload_env
 
-    def query_revision(self):
-        """ Get the gecko revision in this order of precedence
-              * cached value
-              * command line arg --revision   (development, taskcluster)
-              * from the en-US build          (m-c & m-a)
-
-        This will fail the last case if the build hasn't been pulled yet.
-        """
-        if self.revision:
-            return self.revision
-
-        config = self.config
-        revision = None
-        if config.get("revision"):
-            revision = config["revision"]
-        if not revision:
-            self.fatal("Can't determine revision!")
-        self.revision = str(revision)
-        return self.revision
-
     def _query_make_variable(self, variable, make_args=None):
         make = self.query_exe('make')
         env = self.query_repack_env()
         dirs = self.query_abs_dirs()
         if make_args is None:
             make_args = []
         # TODO error checking
         output = self.get_output_from_command(