Пример #1
0
    def main(self):
        self.package = self.package.rstrip("/")
        package_path = plumbum.local.path(self.package)
        name = package_path.name
        mock_path = plumbum.local.path(package_path / "mock_%s" % name)
        delete(mock_path // "*.go")
        buildscript = """
load("@com_github_jmhodges_bazel_gomock//:gomock.bzl", "gomock")
gomock(
    name = "go_default_mock",
    out = "mock.go",
    interfaces = %s,
    library = "//%s:go_default_library",
    package = "mock_%s",
)
""" % (self.interfaces.split(","), self.package, name)
        pathlib.Path(mock_path).mkdir(parents=True, exist_ok=True)
        pathlib.Path(mock_path / "BUILD.bazel").write_text(buildscript)
        mock_rule = "//%s:go_default_mock" % os.path.join(
            self.package, "mock_%s" % name)
        bazel = plumbum.local['bazel']
        bazel("build", mock_rule)
        bf, wf = rule_to_file(mock_rule)
        cmd.cp(bf, wf)
        cmd.chmod("0644", wf)
        cmd.make("gazelle")
Пример #2
0
    def run_makefile(self, makefile=None):
        """
        Run the whole build process with designated Makefile.
        """

        # cd into git repository directory
        with local.cwd(self.repo.working_dir):

            # cd into working directory inside git repository
            with local.cwd(self.workingdir):

                # Run Makefile to start the compilation process
                make('--file', makefile, 'all-plus-firmware-info', stdout=self.stream, stderr=self.stream)

                # Slurp output of build process
                try:
                    self.stream.seek(0)
                    output = self.stream.read()
                except IOError:
                    make_firmware_info = make['--file', makefile, 'firmware-info'] | grep['TARGET_']
                    output = make_firmware_info()

                # Grep "TARGET_HEX", "TARGET_ELF" (for AVR) as well as "TARGET_BIN" and "TARGET_CHIP" (for ESP) paths
                # from build output and store into "self.build_result"
                target_matcher = re.compile('(?P<name>TARGET_.+):(?: (?P<value>.+))?')
                for m in target_matcher.finditer(output):
                    match = m.groupdict()
                    name  = match['name']
                    value = match['value']
                    if value:
                        self.build_result[name] = value

                # Add build path to build result
                self.build_result['build_path'] = pwd().strip()
Пример #3
0
    def build(self):
        from plumbum.cmd import make
        from benchbuild.utils.compiler import lt_clang_cxx

        crocopat_dir = path.join(self.builddir, self.src_dir, "src")
        with local.cwd(crocopat_dir):
            cflags = self.cflags + ["-I.", "-ansi"]
            ldflags = self.ldflags + ["-L.", "-lrelbdd"]
            with local.cwd(self.builddir):
                clang_cxx = lt_clang_cxx(cflags, ldflags,
                                         self.compiler_extension)
            make("CXX=" + str(clang_cxx))
Пример #4
0
def fetch():
    os.makedirs("systems", exist_ok=True)
    with local.cwd("systems"):
        git("clone", "https://github.com/asoroa/ukb.git")
        with local.cwd("ukb/src"):
            local["./configure"]()
            make()
    # Prepare
    with local.env(UKB_PATH=abspath("systems/ukb/src")):
        with local.cwd("support/ukb"):
            bash("./prepare_wn30graph.sh")
    (python[__file__, "mkwndict", "--en-synset-ids"] > "support/ukb/wndict.fi.txt")()
Пример #5
0
Файл: run.py Проект: gz/sv6
def build_kernel(args):
    "Builds the kernel binary"
    log("Build kernel")
    with local.cwd(KERNEL_PATH):
        if args.verbose:
            print("cd {}".format(KERNEL_PATH))
            print("make")
        make()

        if args.verbose:
            print("make qemubuild")
        # also run make qemu to generate latest kernel.elf file
        make['qemubuild']()
Пример #6
0
def build_udfs():
    logger.info('Building UDFs')
    ibis_home_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    udf_dir = os.path.join(ibis_home_dir, 'ci', 'udf')

    with local.cwd(udf_dir):
        assert cmake('.') and make('VERBOSE=1')
Пример #7
0
def build_udfs():
    logger.info('Building UDFs')
    ibis_home_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    udf_dir = os.path.join(ibis_home_dir, 'ci', 'udf')

    with local.cwd(udf_dir):
        assert cmake('.') and make('VERBOSE=1')
Пример #8
0
 def install_uchroot(self):
     builddir = settings.CFG["build_dir"].value()
     with local.cwd(builddir):
         if not os.path.exists("erlent/.git"):
             git("clone", "[email protected]:PolyJIT/erlent")
         else:
             with local.cwd("erlent"):
                 git("pull", "--rebase")
         mkdir("-p", "erlent/build")
         with local.cwd("erlent/build"):
             from plumbum.cmd import cmake, make, cp
             cmake("../")
             make()
     erlent_path = os.path.abspath(os.path.join(builddir, "erlent",
                                                "build"))
     os.environ["PATH"] = os.path.pathsep.join([erlent_path, os.environ[
         "PATH"]])
     local.env.update(PATH=os.environ["PATH"])
     if not find_package("uchroot"):
         sys.exit(-1)
     settings.CFG["env"]["lookup_path"].value().append(erlent_path)
Пример #9
0
def install_singularity(singularity_version="3.5.3"):
    install_with_apt("golang-go")
    install_with_apt(
        "build-essential",
        "libssl-dev",
        "uuid-dev",
        "libgpgme11-dev",
        "squashfs-tools",
        "libseccomp-dev",
        "pkg-config",
    )

    with local.cwd(make_or_find_libraries_dir()):
        cmd.wget(
            f"https://github.com/sylabs/singularity/releases/download/v{singularity_version}/singularity-{singularity_version}.tar.gz"
        )
        cmd.tar("-xzf", f"singularity-{singularity_version}.tar.gz")

        with local.cwd("singularity"):
            local["./mconfig"]("--prefix=/opt/singularity")
            cmd.make("-C", "./builddir")
            cmd.sudo[cmd.make["-C", "./builddir", "install"]]()