Bug 1155238: pass --authentication-file to the old tooltool_wrapper.sh, too
authorDustin J. Mitchell <dustin@mozilla.com>
Wed, 29 Apr 2015 15:31:45 -0400 (2015-04-29)
changeset 3930 fbe718fe444062cc439d8ccd8736cbb77bdd6be3
parent 3929 81550ea89c735cb0af446a398eab5ca93e6d32cd
child 3931 06a2bc3e6b42407b590852d496084d60ba838101
push id3112
push userdmitchell@mozilla.com
push dateThu, 30 Apr 2015 14:08:17 +0000 (2015-04-30)
bugs1155238
Bug 1155238: pass --authentication-file to the old tooltool_wrapper.sh, too
mozharness/mozilla/building/buildbase.py
scripts/desktop_l10n.py
--- a/mozharness/mozilla/building/buildbase.py
+++ b/mozharness/mozilla/building/buildbase.py
@@ -1006,17 +1006,28 @@ or run without that action (ie: --no-{ac
                 next(mozconfig)
                 for line in mozconfig:
                     self.info(line)
         else:
             self.fatal("To build, you must supply a mozconfig from inside the "
                        "tree to use use. Please provide the path in your "
                        "config via 'src_mozconfig'")
 
-    # TODO add this or merge to ToolToolMixin
+    # TODO: replace with ToolToolMixin
+    def _get_tooltool_auth_file(self):
+        # set the default authentication file based on platform; this
+        # corresponds to where puppet puts the token
+        if 'tooltool_authentication_file' in self.config:
+            return self.config['tooltool_authentication_file']
+
+        if self._is_windows():
+            return r'c:\builds\relengapi.tok'
+        else:
+            return '/builds/relengapi.tok'
+
     def _run_tooltool(self):
         self._assert_cfg_valid_for_action(
             ['tooltool_script', 'tooltool_bootstrap', 'tooltool_url'],
             'build'
         )
         c = self.config
         dirs = self.query_abs_dirs()
         if not c.get('tooltool_manifest_src'):
@@ -1028,16 +1039,17 @@ or run without that action (ie: --no-{ac
         cmd = [
             'sh',
             fetch_script_path,
             tooltool_manifest_path,
             c['tooltool_url'],
             c['tooltool_bootstrap'],
         ]
         cmd.extend(c['tooltool_script'])
+        cmd.extend(['--authentication-file', self._get_tooltool_auth_file()])
         self.info(str(cmd))
         self.run_command(cmd, cwd=dirs['abs_src_dir'], halt_on_failure=True)
 
     def query_revision(self, source_path=None):
         """ returns the revision of the build
 
          first will look for it in buildbot_properties and then in
          buildbot_config. Failing that, it will actually poll the source of
--- a/scripts/desktop_l10n.py
+++ b/scripts/desktop_l10n.py
@@ -1244,16 +1244,28 @@ class DesktopSingleLocale(LocalesMixin, 
         """returns a list of .pcf files in basedir"""
         pgc_files = []
         for dirpath, dirnames, filenames in os.walk(basedir):
             for pgc in filenames:
                 if pgc.endswith('.pgc'):
                     pgc_files.append(os.path.join(dirpath, pgc))
         return pgc_files
 
+    # TODO: replace with ToolToolMixin
+    def _get_tooltool_auth_file(self):
+        # set the default authentication file based on platform; this
+        # corresponds to where puppet puts the token
+        if 'tooltool_authentication_file' in self.config:
+            return self.config['tooltool_authentication_file']
+
+        if self._is_windows():
+            return r'c:\builds\relengapi.tok'
+        else:
+            return '/builds/relengapi.tok'
+
     def _run_tooltool(self):
         config = self.config
         dirs = self.query_abs_dirs()
         if not config.get('tooltool_manifest_src'):
             return self.warning(ERROR_MSGS['tooltool_manifest_undetermined'])
         fetch_script_path = os.path.join(dirs['abs_tools_dir'],
                                          'scripts/tooltool/tooltool_wrapper.sh')
         tooltool_manifest_path = os.path.join(dirs['abs_mozilla_dir'],
@@ -1261,16 +1273,17 @@ class DesktopSingleLocale(LocalesMixin, 
         cmd = [
             'sh',
             fetch_script_path,
             tooltool_manifest_path,
             config['tooltool_url'],
             config['tooltool_bootstrap'],
         ]
         cmd.extend(config['tooltool_script'])
+        cmd.extend(['--authentication-file', self._get_tooltool_auth_file()])
         self.info(str(cmd))
         self.run_command(cmd, cwd=dirs['abs_mozilla_dir'], halt_on_failure=True)
 
     def _create_base_dirs(self):
         config = self.config
         dirs = self.query_abs_dirs()
         for make_dir in config.get('make_dirs', []):
             dirname = os.path.join(dirs['abs_objdir'], make_dir)