Bug 1142872 - add --en-us-binary-url option in desktop_l10n.py. r=jlund
authorMassimo Gervasini <mgervasini@mozilla.com>
Tue, 17 Mar 2015 20:15:13 +0100 (2015-03-17)
changeset 3775 116e748b985b9ae62fd22a1dac46ef096079b47b
parent 3774 6a2f35325f28d657435719774bd9398f413db172
child 3776 fde96e1730ccd6ff6cda7acc8e21ff33fda18896
child 3777 ac58dcb7372cf48f22b9ff90bd983d7440df5523
push id2973
push usermgervasini@mozilla.com
push dateTue, 17 Mar 2015 19:15:45 +0000 (2015-03-17)
reviewersjlund
bugs1142872
Bug 1142872 - add --en-us-binary-url option in desktop_l10n.py. r=jlund
scripts/desktop_l10n.py
--- a/scripts/desktop_l10n.py
+++ b/scripts/desktop_l10n.py
@@ -25,16 +25,17 @@ from mozharness.mozilla.buildbot import 
 from mozharness.mozilla.building.buildbase import MakeUploadOutputParser
 from mozharness.mozilla.l10n.locales import LocalesMixin
 from mozharness.mozilla.mar import MarMixin
 from mozharness.mozilla.mock import MockMixin
 from mozharness.mozilla.release import ReleaseMixin
 from mozharness.mozilla.signing import SigningMixin
 from mozharness.mozilla.updates.balrog import BalrogMixin
 from mozharness.mozilla.mock import ERROR_MSGS
+from mozharness.base.log import FATAL
 
 try:
     import simplejson as json
     assert json
 except ImportError:
     import json
 
 
@@ -137,16 +138,22 @@ class DesktopSingleLocale(LocalesMixin, 
          "type": "int",
          "help": "Specify which chunk of locales to run"}
     ], [
         ['--total-chunks', ],
         {"action": "store",
          "dest": "total_locale_chunks",
          "type": "int",
          "help": "Specify the total number of chunks of locales"}
+    ], [
+        ['--en-us-binary-url', ],
+        {"action": "store",
+         "dest": "en_us_binary_url",
+         "type": "string",
+         "help": "Specify the url of the en-us binary"}
     ]]
 
     def __init__(self, require_config_file=True):
         # fxbuild style:
         buildscript_kwargs = {
             'all_actions': [
                 "clobber",
                 "pull",
@@ -690,16 +697,25 @@ class DesktopSingleLocale(LocalesMixin, 
         cwd = os.path.join(dirs['abs_objdir'], config['locales_dir'])
         return self._make(target=["unpack"], cwd=cwd, env=env)
 
     def make_wget_en_US(self):
         """wrapper for make wget-en-US"""
         env = self.query_bootstrap_env()
         dirs = self.query_abs_dirs()
         cwd = dirs['abs_locales_dir']
+        binary_file = env['EN_US_BINARY_URL']
+        if binary_file.endswith(('tar.bz2', 'dmg', 'zip')):
+            # specified EN_US_BINARY url is an installer file...
+            dst_filename = binary_file.split('/')[-1].strip()
+            dst_filename = os.path.join(dirs['abs_objdir'], 'dist', dst_filename)
+            self.info('Specified binary url, %s, appears to be an installer file' % (binary_file))
+            return self._retry_download_file(binary_file, dst_filename, error_level=FATAL)
+
+        # binary url is not an installer, use make wget-en-US to download it
         return self._make(target=["wget-en-US"], cwd=cwd, env=env)
 
     def make_upload(self, locale):
         """wrapper for make upload command"""
         config = self.config
         env = self.query_l10n_env()
         dirs = self.query_abs_dirs()
         buildid = self._query_buildid()