# HG changeset patch # User Chris Manchester # Date 1558049217 0 # Node ID 44a79556ff86f3c3ead666fc2fd973e8b24681ea # Parent 440af2283cba49998a618def0ff973955ec68bdc Bug 1552336 - Download the currently available toolchain build of sccache during |./mach bootstrap|. r=nalexander Differential Revision: https://phabricator.services.mozilla.com/D31544 diff --git a/python/mozboot/mozboot/archlinux.py b/python/mozboot/mozboot/archlinux.py --- a/python/mozboot/mozboot/archlinux.py +++ b/python/mozboot/mozboot/archlinux.py @@ -6,20 +6,25 @@ from __future__ import absolute_import, import os import sys import tempfile import subprocess import glob from mozboot.base import BaseBootstrapper -from mozboot.linux_common import NodeInstall, StyloInstall, ClangStaticAnalysisInstall +from mozboot.linux_common import ( + ClangStaticAnalysisInstall, + NodeInstall, + SccacheInstall, + StyloInstall, +) -class ArchlinuxBootstrapper(NodeInstall, StyloInstall, +class ArchlinuxBootstrapper(NodeInstall, StyloInstall, SccacheInstall, ClangStaticAnalysisInstall, BaseBootstrapper): '''Archlinux experimental bootstrapper.''' SYSTEM_PACKAGES = [ 'autoconf2.13', 'base-devel', 'nodejs', 'python2', diff --git a/python/mozboot/mozboot/base.py b/python/mozboot/mozboot/base.py --- a/python/mozboot/mozboot/base.py +++ b/python/mozboot/mozboot/base.py @@ -275,16 +275,22 @@ class BaseBootstrapper(object): def ensure_nasm_packages(self, state_dir, checkout_root): ''' Install nasm. ''' raise NotImplementedError( '%s does not yet implement ensure_nasm_packages()' % __name__) + def ensure_sccache_packages(self, state_dir, checkout_root): + ''' + Install sccache. + ''' + pass + 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): diff --git a/python/mozboot/mozboot/bootstrap.py b/python/mozboot/mozboot/bootstrap.py --- a/python/mozboot/mozboot/bootstrap.py +++ b/python/mozboot/mozboot/bootstrap.py @@ -331,16 +331,17 @@ class Bootstrapper(object): print(STYLE_NODEJS_REQUIRES_CLONE) sys.exit(1) self.instance.state_dir = state_dir self.instance.ensure_node_packages(state_dir, checkout_root) self.instance.ensure_stylo_packages(state_dir, checkout_root) self.instance.ensure_clang_static_analysis_package(state_dir, checkout_root) self.instance.ensure_nasm_packages(state_dir, checkout_root) + self.instance.ensure_sccache_packages(state_dir, checkout_root) def bootstrap(self): if self.choice is None: # Like ['1. Firefox for Desktop', '2. Firefox for Android Artifact Mode', ...]. labels = ['%s. %s' % (i + 1, name) for (i, (name, _)) in enumerate(APPLICATIONS_LIST)] prompt = APPLICATION_CHOICE % '\n'.join(' {}'.format(label) for label in labels) prompt_choice = self.instance.prompt_int(prompt=prompt, low=1, high=len(APPLICATIONS)) name, application = APPLICATIONS_LIST[prompt_choice-1] diff --git a/python/mozboot/mozboot/centosfedora.py b/python/mozboot/mozboot/centosfedora.py --- a/python/mozboot/mozboot/centosfedora.py +++ b/python/mozboot/mozboot/centosfedora.py @@ -2,21 +2,28 @@ # 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 import platform from mozboot.base import BaseBootstrapper -from mozboot.linux_common import NasmInstall, NodeInstall, StyloInstall, ClangStaticAnalysisInstall +from mozboot.linux_common import ( + ClangStaticAnalysisInstall, + NasmInstall, + NodeInstall, + SccacheInstall, + StyloInstall, +) class CentOSFedoraBootstrapper(NasmInstall, NodeInstall, StyloInstall, - ClangStaticAnalysisInstall, BaseBootstrapper): + SccacheInstall, ClangStaticAnalysisInstall, + BaseBootstrapper): def __init__(self, distro, version, dist_id, **kwargs): BaseBootstrapper.__init__(self, **kwargs) self.distro = distro self.version = int(version.split('.')[0]) self.dist_id = dist_id self.group_packages = [] diff --git a/python/mozboot/mozboot/debian.py b/python/mozboot/mozboot/debian.py --- a/python/mozboot/mozboot/debian.py +++ b/python/mozboot/mozboot/debian.py @@ -1,16 +1,22 @@ # 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 from mozboot.base import BaseBootstrapper -from mozboot.linux_common import NasmInstall, NodeInstall, StyloInstall, ClangStaticAnalysisInstall +from mozboot.linux_common import ( + ClangStaticAnalysisInstall, + NasmInstall, + NodeInstall, + SccacheInstall, + StyloInstall, +) MERCURIAL_INSTALL_PROMPT = ''' Mercurial releases a new version every 3 months and your distro's package may become out of date. This may cause incompatibility with some Mercurial extensions that rely on new Mercurial features. As a result, you may not have an optimal version control experience. @@ -21,17 +27,17 @@ in files being placed in /usr/local/bin How would you like to continue? 1. Install a modern Mercurial via pip (recommended) 2. Install a legacy Mercurial via apt 3. Do not install Mercurial Your choice: ''' class DebianBootstrapper(NasmInstall, NodeInstall, StyloInstall, ClangStaticAnalysisInstall, - BaseBootstrapper): + SccacheInstall, BaseBootstrapper): # These are common packages for all Debian-derived distros (such as # Ubuntu). COMMON_PACKAGES = [ 'autoconf2.13', 'build-essential', 'nodejs', 'python-dev', 'python-pip', diff --git a/python/mozboot/mozboot/gentoo.py b/python/mozboot/mozboot/gentoo.py --- a/python/mozboot/mozboot/gentoo.py +++ b/python/mozboot/mozboot/gentoo.py @@ -1,28 +1,35 @@ # 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 from mozboot.base import BaseBootstrapper -from mozboot.linux_common import NasmInstall, NodeInstall, StyloInstall, ClangStaticAnalysisInstall +from mozboot.linux_common import ( + ClangStaticAnalysisInstall, + NasmInstall, + NodeInstall, + SccacheInstall, + StyloInstall, +) try: from urllib2 import urlopen except ImportError: from urllib.request import urlopen import re import subprocess class GentooBootstrapper(NasmInstall, NodeInstall, StyloInstall, ClangStaticAnalysisInstall, - BaseBootstrapper): + SccacheInstall, BaseBootstrapper): + def __init__(self, version, dist_id, **kwargs): BaseBootstrapper.__init__(self, **kwargs) self.version = version self.dist_id = dist_id def install_system_packages(self): self.run_as_root(['emerge', '--noreplace', '--quiet', 'nodejs']) diff --git a/python/mozboot/mozboot/linux_common.py b/python/mozboot/mozboot/linux_common.py --- a/python/mozboot/mozboot/linux_common.py +++ b/python/mozboot/mozboot/linux_common.py @@ -10,16 +10,26 @@ from __future__ import absolute_import, import os def is_non_x86_64(): return os.uname()[4] != 'x86_64' +class SccacheInstall(object): + def __init__(self, **kwargs): + pass + + def ensure_sccache_packages(self, state_dir, checkout_root): + from mozboot import sccache + + self.install_toolchain_artifact(state_dir, checkout_root, sccache.LINUX_SCCACHE) + + class StyloInstall(object): def __init__(self, **kwargs): pass def ensure_stylo_packages(self, state_dir, checkout_root): from mozboot import stylo if is_non_x86_64(): diff --git a/python/mozboot/mozboot/sccache.py b/python/mozboot/mozboot/sccache.py new file mode 100644 --- /dev/null +++ b/python/mozboot/mozboot/sccache.py @@ -0,0 +1,7 @@ +# 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 + +LINUX_SCCACHE = 'linux64-sccache'