DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (c68fe15a81fc)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
# 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/.

# An easy way for distribution-specific bootstrappers to share the code
# needed to install Stylo and Node dependencies.  This class must come before
# BaseBootstrapper in the inheritance list.

from __future__ import absolute_import, print_function, unicode_literals

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 FixStacksInstall(object):
    def __init__(self, **kwargs):
        pass

    def ensure_fix_stacks_packages(self, state_dir, checkout_root):
        from mozboot import fix_stacks

        self.install_toolchain_artifact(state_dir, checkout_root,
                                        fix_stacks.LINUX_FIX_STACKS)


class LucetcInstall(object):
    def __init__(self, **kwargs):
        pass

    def ensure_lucetc_packages(self, state_dir, checkout_root):
        from mozboot import lucetc

        self.install_toolchain_artifact(state_dir, checkout_root,
                                        lucetc.LINUX_LUCETC)


class WasiSysrootInstall(object):
    def __init__(self, **kwargs):
        pass

    def ensure_wasi_sysroot_packages(self, state_dir, checkout_root):
        from mozboot import wasi_sysroot

        self.install_toolchain_artifact(state_dir, checkout_root,
                                        wasi_sysroot.LINUX_WASI_SYSROOT)


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():
            print('Cannot install bindgen clang and cbindgen packages from taskcluster.\n'
                  'Please install these packages manually.')
            return

        self.install_toolchain_artifact(state_dir, checkout_root, stylo.LINUX_CLANG)
        self.install_toolchain_artifact(state_dir, checkout_root, stylo.LINUX_CBINDGEN)


class NasmInstall(object):
    def __init__(self, **kwargs):
        pass

    def ensure_nasm_packages(self, state_dir, checkout_root):
        if is_non_x86_64():
            print('Cannot install nasm from taskcluster.\n'
                  'Please install this package manually.')
            return

        from mozboot import nasm
        self.install_toolchain_artifact(state_dir, checkout_root, nasm.LINUX_NASM)


class NodeInstall(object):
    def __init__(self, **kwargs):
        pass

    def ensure_node_packages(self, state_dir, checkout_root):
        if is_non_x86_64():
            print('Cannot install node package from taskcluster.\n'
                  'Please install this package manually.')
            return

        from mozboot import node
        self.install_toolchain_artifact(state_dir, checkout_root, node.LINUX)


class ClangStaticAnalysisInstall(object):
    def __init__(self, **kwargs):
        pass

    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

        from mozboot import static_analysis
        self.install_toolchain_static_analysis(
            state_dir, checkout_root, static_analysis.LINUX_CLANG_TIDY)


class MinidumpStackwalkInstall(object):
    def __init__(self, **kwargs):
        pass

    def ensure_minidump_stackwalk_packages(self, state_dir, checkout_root):
        from mozboot import minidump_stackwalk

        self.install_toolchain_artifact(state_dir, checkout_root,
                                        minidump_stackwalk.LINUX_MINIDUMP_STACKWALK)


class LinuxBootstrapper(
        ClangStaticAnalysisInstall,
        FixStacksInstall,
        LucetcInstall,
        MinidumpStackwalkInstall,
        NasmInstall,
        NodeInstall,
        SccacheInstall,
        StyloInstall,
        WasiSysrootInstall):

    def __init__(self, **kwargs):
        pass