bug 1345619 - update l10n-bumper to include desktop. r=callek draft
authorAki Sasaki <asasaki@mozilla.com>
Mon, 25 Sep 2017 10:16:04 -0700
changeset 669936 3d7d1adf12445645b8d15a8af5d512d969b1e6dc
parent 669925 9007fcde0344ea646f0d6b6d9132e734bea7b6e4
child 669937 0d8352fe9774c51b0bd48c1548d370d5012250ba
push id81475
push userasasaki@mozilla.com
push dateMon, 25 Sep 2017 17:32:54 +0000
reviewerscallek
bugs1345619
milestone58.0a1
bug 1345619 - update l10n-bumper to include desktop. r=callek This patch: - removes the obsolete mozilla-aurora l10n-bumper config. - adds both central and beta format desktop bumper configs to jamun for testing. - updates the central and beta configs to add desktop. - updates the script to support the desktop configs. We now support an `ignore_config` which acts like the `ignore-platforms` attribute. MozReview-Commit-ID: KGwo0bRibw4
testing/mozharness/configs/l10n_bumper/jamun.py
testing/mozharness/configs/l10n_bumper/mozilla-aurora.py
testing/mozharness/configs/l10n_bumper/mozilla-beta.py
testing/mozharness/configs/l10n_bumper/mozilla-central.py
testing/mozharness/scripts/l10n_bumper.py
--- a/testing/mozharness/configs/l10n_bumper/jamun.py
+++ b/testing/mozharness/configs/l10n_bumper/jamun.py
@@ -1,17 +1,23 @@
+import sys
+
 MULTI_REPO = "projects/jamun"
-config = {
-    "log_name": "l10n_bumper",
-
-    "exes": {
+EXES = {}
+if sys.platform.startswith("linux"):
+    EXES = {
         # Get around the https warnings
         "hg": ["/usr/local/bin/hg", "--config", "web.cacerts=/etc/pki/tls/certs/ca-bundle.crt"],
         "hgtool.py": ["/usr/local/bin/hgtool.py"],
-    },
+    }
+
+
+config = {
+    "log_name": "l10n_bumper",
+    "exes": EXES,
 
     "gecko_pull_url": "https://hg.mozilla.org/{}".format(MULTI_REPO),
     "gecko_push_url": "ssh://hg.mozilla.org/{}".format(MULTI_REPO),
 
     "hg_user": "L10n Bumper Bot <release+l10nbumper@mozilla.com>",
     "ssh_key": "~/.ssh/ffxbld_rsa",
     "ssh_user": "ffxbld",
 
@@ -23,12 +29,40 @@ config = {
         "format": "json",
         "name": "Fennec l10n changesets",
         "revision_url": "https://l10n.mozilla.org/shipping/l10n-changesets?av=fennec%(MAJOR_VERSION)s",
         "platform_configs": [{
             "platforms": ["android-api-16", "android"],
             "path": "mobile/android/locales/all-locales"
         }, {
             "platforms": ["android-multilocale"],
-            "path": "mobile/android/locales/maemo-locales"
+            "path": "mobile/android/locales/maemo-locales",
+        }],
+    }, {
+        "path": "browser/locales/l10n-changesets.json",
+        "format": "json",
+        "name": "Firefox l10n changesets",
+        "revision_url": "https://l10n.mozilla.org/shipping/l10n-changesets?av=fx%(MAJOR_VERSION)s",
+        "ignore_config": {
+            "ja": ["macosx64"],
+            "ja-JP-mac": ["linux", "linux64", "win32", "win64"],
+        },
+        "platform_configs": [{
+            "platforms": ["linux64", "linux", "macosx64",
+                          "win32", "win64"],
+            "path": "browser/locales/shipped-locales",
+            "format": "shipped-locales",
+        }],
+    }, {
+        "path": "browser/locales/central-changesets.json",
+        "format": "json",
+        "name": "Firefox l10n changesets",
+        "ignore_config": {
+            "ja": ["macosx64"],
+            "ja-JP-mac": ["linux", "linux64", "win32", "win64"],
+        },
+        "platform_configs": [{
+            "platforms": ["linux64", "linux", "macosx64",
+                          "win32", "win64"],
+            "path": "browser/locales/all-locales",
         }],
     }],
 }
deleted file mode 100644
--- a/testing/mozharness/configs/l10n_bumper/mozilla-aurora.py
+++ /dev/null
@@ -1,33 +0,0 @@
-MULTI_REPO = "releases/mozilla-aurora"
-config = {
-    "log_name": "l10n_bumper",
-
-    "exes": {
-        # Get around the https warnings
-        "hg": ["/usr/local/bin/hg", "--config", "web.cacerts=/etc/pki/tls/certs/ca-bundle.crt"],
-        "hgtool.py": ["/usr/local/bin/hgtool.py"],
-    },
-
-    "gecko_pull_url": "https://hg.mozilla.org/{}".format(MULTI_REPO),
-    "gecko_push_url": "ssh://hg.mozilla.org/{}".format(MULTI_REPO),
-
-    "hg_user": "L10n Bumper Bot <release+l10nbumper@mozilla.com>",
-    "ssh_key": "~/.ssh/ffxbld_rsa",
-    "ssh_user": "ffxbld",
-
-    "vcs_share_base": "/builds/hg-shared",
-    "version_path": "browser/config/version.txt",
-
-    "bump_configs": [{
-        "path": "mobile/locales/l10n-changesets.json",
-        "format": "json",
-        "name": "Fennec l10n changesets",
-        "platform_configs": [{
-            "platforms": ["android-api-16", "android"],
-            "path": "mobile/android/locales/all-locales"
-        }, {
-            "platforms": ["android-multilocale"],
-            "path": "mobile/android/locales/maemo-locales"
-        }],
-    }],
-}
--- a/testing/mozharness/configs/l10n_bumper/mozilla-beta.py
+++ b/testing/mozharness/configs/l10n_bumper/mozilla-beta.py
@@ -1,17 +1,22 @@
+import sys
+
 MULTI_REPO = "releases/mozilla-beta"
-config = {
-    "log_name": "l10n_bumper",
-
-    "exes": {
+EXES = {}
+if sys.platform.startswith("linux"):
+    EXES = {
         # Get around the https warnings
         "hg": ["/usr/local/bin/hg", "--config", "web.cacerts=/etc/pki/tls/certs/ca-bundle.crt"],
         "hgtool.py": ["/usr/local/bin/hgtool.py"],
-    },
+    }
+
+config = {
+    "log_name": "l10n_bumper",
+    "exes": EXES,
 
     "gecko_pull_url": "https://hg.mozilla.org/{}".format(MULTI_REPO),
     "gecko_push_url": "ssh://hg.mozilla.org/{}".format(MULTI_REPO),
 
     "hg_user": "L10n Bumper Bot <release+l10nbumper@mozilla.com>",
     "ssh_key": "~/.ssh/ffxbld_rsa",
     "ssh_user": "ffxbld",
 
@@ -25,10 +30,25 @@ config = {
         "revision_url": "https://l10n.mozilla.org/shipping/l10n-changesets?av=fennec%(MAJOR_VERSION)s",
         "platform_configs": [{
             "platforms": ["android-api-16", "android"],
             "path": "mobile/android/locales/all-locales"
         }, {
             "platforms": ["android-multilocale"],
             "path": "mobile/android/locales/maemo-locales"
         }],
+    }, {
+        "path": "browser/locales/l10n-changesets.json",
+        "format": "json",
+        "name": "Firefox l10n changesets",
+        "revision_url": "https://l10n.mozilla.org/shipping/l10n-changesets?av=fx%(MAJOR_VERSION)s",
+        "ignore_config": {
+            "ja": ["macosx64"],
+            "ja-JP-mac": ["linux", "linux64", "win32", "win64"],
+        },
+        "platform_configs": [{
+            "platforms": ["linux64", "linux", "macosx64",
+                          "win32", "win64"],
+            "path": "browser/locales/shipped-locales",
+            "format": "shipped-locales",
+        }],
     }],
 }
--- a/testing/mozharness/configs/l10n_bumper/mozilla-central.py
+++ b/testing/mozharness/configs/l10n_bumper/mozilla-central.py
@@ -1,17 +1,22 @@
+import sys
+
 MULTI_REPO = "mozilla-central"
-config = {
-    "log_name": "l10n_bumper",
-
-    "exes": {
+EXES = {}
+if sys.platform.startswith("linux"):
+    EXES = {
         # Get around the https warnings
         "hg": ["/usr/local/bin/hg", "--config", "web.cacerts=/etc/pki/tls/certs/ca-bundle.crt"],
         "hgtool.py": ["/usr/local/bin/hgtool.py"],
-    },
+    }
+
+config = {
+    "log_name": "l10n_bumper",
+    "exes": EXES,
 
     "gecko_pull_url": "https://hg.mozilla.org/{}".format(MULTI_REPO),
     "gecko_push_url": "ssh://hg.mozilla.org/{}".format(MULTI_REPO),
 
     "hg_user": "L10n Bumper Bot <release+l10nbumper@mozilla.com>",
     "ssh_key": "~/.ssh/ffxbld_rsa",
     "ssh_user": "ffxbld",
 
@@ -24,10 +29,23 @@ config = {
         "name": "Fennec l10n changesets",
         "platform_configs": [{
             "platforms": ["android-api-16", "android"],
             "path": "mobile/android/locales/all-locales"
         }, {
             "platforms": ["android-multilocale"],
             "path": "mobile/android/locales/maemo-locales"
         }],
+    }, {
+        "path": "browser/locales/central-changesets.json",
+        "format": "json",
+        "name": "Firefox l10n changesets",
+        "ignore_config": {
+            "ja": ["macosx64"],
+            "ja-JP-mac": ["linux", "linux64", "win32", "win64"],
+        },
+        "platform_configs": [{
+            "platforms": ["linux64", "linux", "macosx64",
+                          "win32", "win64"],
+            "path": "browser/locales/all-locales",
+        }],
     }],
 }
--- a/testing/mozharness/scripts/l10n_bumper.py
+++ b/testing/mozharness/scripts/l10n_bumper.py
@@ -140,24 +140,32 @@ class L10nBumper(VCSScript):
             elif old_contents.get(k, {}).get('platforms') != v['platforms']:
                 locale_map[k] = v['platforms']
         return locale_map
 
     def _build_platform_dict(self, bump_config):
         dirs = self.query_abs_dirs()
         repo_path = dirs['gecko_local_dir']
         platform_dict = {}
+        ignore_config = bump_config.get('ignore_config', {})
         for platform_config in bump_config['platform_configs']:
             path = os.path.join(repo_path, platform_config['path'])
             self.info("Reading %s for %s locales..." % (path, platform_config['platforms']))
             contents = self.read_from_file(path)
             for locale in contents.splitlines():
-                platforms = platform_dict.get(locale, {}).get('platforms', [])
-                platforms = sorted(list(platform_config['platforms']) + platforms)
-                platform_dict[locale] = {'platforms': platforms}
+                # locale is 1st word in line in shipped-locales
+                if platform_config.get('format') == 'shipped-locales':
+                    locale = locale.split(' ')[0]
+                existing_platforms = set(platform_dict.get(locale, {}).get('platforms', []))
+                platforms = set(platform_config['platforms'])
+                ignore_platforms = set(ignore_config.get(locale, []))
+                platforms = (platforms | existing_platforms) - ignore_platforms
+                platform_dict[locale] = {
+                    'platforms': sorted(list(platforms))
+                }
         self.info("Built platform_dict:\n%s" % pprint.pformat(platform_dict))
         return platform_dict
 
     def _build_revision_dict(self, bump_config, version_list):
         self.info("Building revision dict...")
         platform_dict = self._build_platform_dict(bump_config)
         revision_dict = {}
         if bump_config.get('revision_url'):