Backed out changeset d6bda0108d61 (bug 1520920) as requested by the dev
authorDorel Luca <dluca@mozilla.com>
Tue, 12 Feb 2019 12:38:48 +0200
changeset 458684 2dbc0282899d090127b977912762bf983f56d6c4
parent 458683 d6bda0108d61e14b30bf8b268884e97b2b073481
child 458685 9ad69518248dbb19568b8485df6fb6e36cc56f32
push id77971
push userdluca@mozilla.com
push dateTue, 12 Feb 2019 10:39:10 +0000
treeherderautoland@2dbc0282899d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1520920
milestone67.0a1
backs outd6bda0108d61e14b30bf8b268884e97b2b073481
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset d6bda0108d61 (bug 1520920) as requested by the dev
python/mozboot/mozboot/base.py
python/mozboot/mozboot/bootstrap.py
python/mozboot/mozboot/freebsd.py
python/mozboot/mozboot/linux_common.py
python/mozboot/mozboot/mozillabuild.py
python/mozboot/mozboot/openbsd.py
python/mozboot/mozboot/osx.py
python/mozboot/mozboot/static_analysis.py
python/mozboot/mozboot/windows.py
--- a/python/mozboot/mozboot/base.py
+++ b/python/mozboot/mozboot/base.py
@@ -248,17 +248,17 @@ class BaseBootstrapper(object):
 
         GeckoView/Firefox for Android Artifact Mode needs an application and an ABI set,
         and it needs paths to the Android SDK.
         '''
         raise NotImplementedError(
             '%s does not yet implement suggest_mobile_android_artifact_mode_mozconfig()'
             % __name__)
 
-    def ensure_clang_static_analysis_package(self, state_dir, checkout_root):
+    def ensure_clang_static_analysis_package(self, checkout_root):
         '''
         Install the clang static analysis package
         '''
         raise NotImplementedError(
             '%s does not yet implement ensure_clang_static_analysis_package()'
             % __name__)
 
     def ensure_stylo_packages(self, state_dir, checkout_root):
@@ -271,25 +271,33 @@ class BaseBootstrapper(object):
 
     def ensure_node_packages(self, state_dir, checkout_root):
         '''
         Install any necessary packages needed to supply NodeJS'''
         raise NotImplementedError(
             '%s does not yet implement ensure_node_packages()'
             % __name__)
 
-    def install_toolchain_static_analysis(self, state_dir, checkout_root, toolchain_job):
-        clang_tools_path = os.path.join(state_dir, 'clang-tools')
-        import shutil
-        if os.path.exists(clang_tools_path):
-            shutil.rmtree(clang_tools_path)
+    def install_toolchain_static_analysis(self, checkout_root):
+        mach_binary = os.path.join(checkout_root, 'mach')
+        mach_binary = os.path.abspath(mach_binary)
+        if not os.path.exists(mach_binary):
+            raise ValueError("mach not found at %s" % mach_binary)
+
+        if not sys.executable:
+            raise ValueError("cannot determine path to Python executable")
 
-        # Re-create the directory for clang_tools
-        os.mkdir(clang_tools_path)
-        self.install_toolchain_artifact(clang_tools_path, checkout_root, toolchain_job)
+        cmd = [sys.executable, mach_binary, 'static-analysis', 'install',
+               '--force', '--minimal-install']
+
+        from subprocess import CalledProcessError
+        try:
+            subprocess.check_call(cmd)
+        except CalledProcessError as e:
+            print(e.output)
 
     def install_toolchain_artifact(self, state_dir, checkout_root, toolchain_job):
         mach_binary = os.path.join(checkout_root, 'mach')
         mach_binary = os.path.abspath(mach_binary)
         if not os.path.exists(mach_binary):
             raise ValueError("mach not found at %s" % mach_binary)
 
         # If Python can't figure out what its own executable is, there's little
--- a/python/mozboot/mozboot/bootstrap.py
+++ b/python/mozboot/mozboot/bootstrap.py
@@ -377,17 +377,17 @@ class Bootstrapper(object):
         if not have_clone:
             print(STYLE_NODEJS_REQUIRES_CLONE)
             sys.exit(1)
 
         self.instance.state_dir = state_dir
         self.instance.ensure_node_packages(state_dir, checkout_root)
         if not self.instance.artifact_mode:
             self.instance.ensure_stylo_packages(state_dir, checkout_root)
-            self.instance.ensure_clang_static_analysis_package(state_dir, checkout_root)
+            self.instance.ensure_clang_static_analysis_package(checkout_root)
 
     def check_telemetry_opt_in(self, state_dir):
         # We can't prompt the user.
         if self.instance.no_interactive:
             return
         # Don't prompt if the user already has a setting for this value.
         if self.mach_context is not None and 'telemetry' in self.mach_context.settings.build:
             return
--- a/python/mozboot/mozboot/freebsd.py
+++ b/python/mozboot/mozboot/freebsd.py
@@ -61,17 +61,17 @@ class FreeBSDBootstrapper(BaseBootstrapp
 
     def install_browser_artifact_mode_packages(self):
         self.ensure_browser_packages(artifact_mode=True)
 
     def ensure_browser_packages(self, artifact_mode=False):
         # TODO: Figure out what not to install for artifact mode
         self.pkg_install(*self.browser_packages)
 
-    def ensure_clang_static_analysis_package(self, state_dir, checkout_root):
+    def ensure_clang_static_analysis_package(self, checkout_root):
         # TODO: we don't ship clang base static analysis for this platform
         pass
 
     def ensure_stylo_packages(self, state_dir, checkout_root):
         # Clang / llvm already installed as browser package
         self.pkg_install('rust-cbindgen')
 
     def ensure_node_packages(self, state_dir, checkout_root):
--- a/python/mozboot/mozboot/linux_common.py
+++ b/python/mozboot/mozboot/linux_common.py
@@ -50,11 +50,9 @@ class ClangStaticAnalysisInstall(object)
         pass
 
     def ensure_clang_static_analysis_package(self, checkout_root):
         if is_non_x86_64():
             print('Cannot install static analysis tools from taskcluster.\n'
                   'Please install these tools manually.')
             return
 
-        from mozboot import static_analysis
-        self.install_toolchain_static_analysis(
-            state_dir, checkout_root, static_analysis.LINUX_CLANG_TIDY)
+        self.install_toolchain_static_analysis(checkout_root)
--- a/python/mozboot/mozboot/mozillabuild.py
+++ b/python/mozboot/mozboot/mozillabuild.py
@@ -67,20 +67,18 @@ class MozillaBuildBootstrapper(BaseBoots
         pass
 
     def install_mobile_android_packages(self):
         pass
 
     def install_mobile_android_artifact_mode_packages(self):
         pass
 
-    def ensure_clang_static_analysis_package(self, state_dir, checkout_root):
-        from mozboot import static_analysis
-        self.install_toolchain_static_analysis(
-            state_dir, checkout_root, static_analysis.WINDOWS_CLANG_TIDY)
+    def ensure_clang_static_analysis_package(self, checkout_root):
+        self.install_toolchain_static_analysis(checkout_root)
 
     def ensure_stylo_packages(self, state_dir, checkout_root):
         # On-device artifact builds are supported; on-device desktop builds are not.
         if is_aarch64_host():
             raise Exception('You should not be performing desktop builds on an '
                             'AArch64 device.  If you want to do artifact builds '
                             'instead, please choose the appropriate artifact build '
                             'option when beginning bootstrap.')
--- a/python/mozboot/mozboot/openbsd.py
+++ b/python/mozboot/mozboot/openbsd.py
@@ -42,17 +42,17 @@ class OpenBSDBootstrapper(BaseBootstrapp
     def install_browser_artifact_mode_packages(self):
         self.ensure_browser_packages(artifact_mode=True)
 
     def ensure_browser_packages(self, artifact_mode=False):
         # TODO: Figure out what not to install for artifact mode
         # we use -z because there's no other way to say "any autoconf-2.13"
         self.run_as_root(['pkg_add', '-z'] + self.browser_packages)
 
-    def ensure_clang_static_analysis_package(self, state_dir, checkout_root):
+    def ensure_clang_static_analysis_package(self, checkout_root):
         # TODO: we don't ship clang base static analysis for this platform
         pass
 
     def ensure_stylo_packages(self, state_dir, checkout_root):
         # Clang / llvm already installed as browser package
         self.run_as_root(['pkg_add', 'cbindgen'])
 
     def ensure_node_packages(self, state_dir, checkout_root):
--- a/python/mozboot/mozboot/osx.py
+++ b/python/mozboot/mozboot/osx.py
@@ -511,20 +511,18 @@ class OSXBootstrapper(BaseBootstrapper):
 
             for check in ('/bin', '/usr/bin'):
                 if path == check:
                     print(BAD_PATH_ORDER % (check, p_dir, p_dir, check, p_dir))
                     sys.exit(1)
 
         return active_name.lower()
 
-    def ensure_clang_static_analysis_package(self, state_dir, checkout_root):
-        from mozboot import static_analysis
-        self.install_toolchain_static_analysis(
-            state_dir, checkout_root, static_analysis.MACOS_CLANG_TIDY)
+    def ensure_clang_static_analysis_package(self, checkout_root):
+        self.install_toolchain_static_analysis(checkout_root)
 
     def ensure_stylo_packages(self, state_dir, checkout_root):
         from mozboot import stylo
         # We installed clang via homebrew earlier.  However, on Android, we're
         # seeing many compiler errors so we use our own toolchain clang.
         if 'mobile_android' in self.application:
             self.install_toolchain_artifact(state_dir, checkout_root, stylo.MACOS_CLANG)
         self.install_toolchain_artifact(state_dir, checkout_root, stylo.MACOS_CBINDGEN)
deleted file mode 100644
--- a/python/mozboot/mozboot/static_analysis.py
+++ /dev/null
@@ -1,9 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-from __future__ import absolute_import, print_function, unicode_literals
-
-WINDOWS_CLANG_TIDY = 'win64-clang-tidy'
-LINUX_CLANG_TIDY = 'linux64-clang-tidy'
-MACOS_CLANG_TIDY = 'macosx64-clang-tidy'
--- a/python/mozboot/mozboot/windows.py
+++ b/python/mozboot/mozboot/windows.py
@@ -94,20 +94,18 @@ class WindowsBootstrapper(BaseBootstrapp
         self.pacman_install(*self.BROWSER_PACKAGES)
 
     def install_mobile_android_packages(self):
         raise NotImplementedError('We do not support building Android on Windows. Sorry!')
 
     def install_mobile_android_artifact_mode_packages(self):
         raise NotImplementedError('We do not support building Android on Windows. Sorry!')
 
-    def ensure_clang_static_analysis_package(self, state_dir, checkout_root):
-        from mozboot import static_analysis
-        self.install_toolchain_static_analysis(
-            state_dir, checkout_root, static_analysis.WINDOWS_CLANG_TIDY)
+    def ensure_clang_static_analysis_package(self, checkout_root):
+        self.install_toolchain_static_analysis(checkout_root)
 
     def ensure_stylo_packages(self, state_dir, checkout_root):
         # On-device artifact builds are supported; on-device desktop builds are not.
         if is_aarch64_host():
             raise Exception('You should not be performing desktop builds on an '
                             'AArch64 device.  If you want to do artifact builds '
                             'instead, please choose the appropriate artifact build '
                             'option when beginning bootstrap.')