Skip to content

Commit

Permalink
Bug 1520920 - do not 'mach configure' when downloading clang-tidy art…
Browse files Browse the repository at this point in the history
…ifact. r=nalexander

Differential Revision: https://phabricator.services.mozilla.com/D16969

--HG--
extra : moz-landing-system : lando
  • Loading branch information
abpostelnicu committed Feb 12, 2019
1 parent 7d3d844 commit 1a6a9cb
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 28 deletions.
26 changes: 9 additions & 17 deletions python/mozboot/mozboot/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def suggest_mobile_android_artifact_mode_mozconfig(self):
'%s does not yet implement suggest_mobile_android_artifact_mode_mozconfig()'
% __name__)

def ensure_clang_static_analysis_package(self, checkout_root):
def ensure_clang_static_analysis_package(self, state_dir, checkout_root):
'''
Install the clang static analysis package
'''
Expand All @@ -276,23 +276,15 @@ def ensure_node_packages(self, state_dir, checkout_root):
'%s does not yet implement ensure_node_packages()'
% __name__)

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)
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)

if not sys.executable:
raise ValueError("cannot determine path to Python executable")

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)
# Re-create the directory for clang_tools
os.mkdir(clang_tools_path)
self.install_toolchain_artifact(clang_tools_path, checkout_root, toolchain_job)

def install_toolchain_artifact(self, state_dir, checkout_root, toolchain_job):
mach_binary = os.path.join(checkout_root, 'mach')
Expand Down
2 changes: 1 addition & 1 deletion python/mozboot/mozboot/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ def maybe_install_private_packages_or_exit(self, 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(checkout_root)
self.instance.ensure_clang_static_analysis_package(state_dir, checkout_root)

def check_telemetry_opt_in(self, state_dir):
# We can't prompt the user.
Expand Down
2 changes: 1 addition & 1 deletion python/mozboot/mozboot/freebsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ 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, checkout_root):
def ensure_clang_static_analysis_package(self, state_dir, checkout_root):
# TODO: we don't ship clang base static analysis for this platform
pass

Expand Down
6 changes: 4 additions & 2 deletions python/mozboot/mozboot/linux_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,12 @@ class ClangStaticAnalysisInstall(object):
def __init__(self, **kwargs):
pass

def ensure_clang_static_analysis_package(self, checkout_root):
def ensure_clang_static_analysis_package(self, state_dir, checkout_root):
if is_non_x86_64():
print('Cannot install static analysis tools from taskcluster.\n'
'Please install these tools manually.')
return

self.install_toolchain_static_analysis(checkout_root)
from mozboot import static_analysis
self.install_toolchain_static_analysis(
state_dir, checkout_root, static_analysis.LINUX_CLANG_TIDY)
6 changes: 4 additions & 2 deletions python/mozboot/mozboot/mozillabuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,10 @@ def install_mobile_android_packages(self):
def install_mobile_android_artifact_mode_packages(self):
pass

def ensure_clang_static_analysis_package(self, checkout_root):
self.install_toolchain_static_analysis(checkout_root)
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_stylo_packages(self, state_dir, checkout_root):
# On-device artifact builds are supported; on-device desktop builds are not.
Expand Down
2 changes: 1 addition & 1 deletion python/mozboot/mozboot/openbsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def ensure_browser_packages(self, artifact_mode=False):
# 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, checkout_root):
def ensure_clang_static_analysis_package(self, state_dir, checkout_root):
# TODO: we don't ship clang base static analysis for this platform
pass

Expand Down
6 changes: 4 additions & 2 deletions python/mozboot/mozboot/osx.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,8 +516,10 @@ def ensure_package_manager(self):

return active_name.lower()

def ensure_clang_static_analysis_package(self, checkout_root):
self.install_toolchain_static_analysis(checkout_root)
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_stylo_packages(self, state_dir, checkout_root):
from mozboot import stylo
Expand Down
9 changes: 9 additions & 0 deletions python/mozboot/mozboot/static_analysis.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# 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'
6 changes: 4 additions & 2 deletions python/mozboot/mozboot/windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,10 @@ def install_mobile_android_packages(self):
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, checkout_root):
self.install_toolchain_static_analysis(checkout_root)
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_stylo_packages(self, state_dir, checkout_root):
# On-device artifact builds are supported; on-device desktop builds are not.
Expand Down

0 comments on commit 1a6a9cb

Please sign in to comment.