コード例 #1
0
ファイル: povray.py プロジェクト: simbuerg/benchbuild
 def prepare(self):
     super(Povray, self).prepare()
     cp("-ar", path.join(self.testdir, "cfg"), '.')
     cp("-ar", path.join(self.testdir, "etc"), '.')
     cp("-ar", path.join(self.testdir, "scenes"), '.')
     cp("-ar", path.join(self.testdir, "share"), '.')
     cp("-ar", path.join(self.testdir, "test"), '.')
コード例 #2
0
ファイル: container.py プロジェクト: simbuerg/benchbuild
    def configure(self):
        """Configure the gentoo container for a PolyJIT experiment."""
        self.write_bashrc("etc/portage/bashrc")
        self.write_makeconfig("etc/portage/make.conf")
        self.write_wgetrc("etc/wgetrc")
        self.write_layout("etc/portage/metadata/layout.conf")

        mkfile_uchroot("/etc/resolv.conf")
        cp("/etc/resolv.conf", "etc/resolv.conf")

        config_file = CFG["config_file"].value()

        if os.path.exists(str(config_file)):
            paths, libs = \
                    uchroot_env(
                        uchroot_mounts("mnt",
                                       CFG["container"]["mounts"].value()))
            uchroot_cfg = CFG
            uchroot_cfg["env"]["compiler_path"] = paths
            uchroot_cfg["env"]["compiler_ld_library_path"] = libs

            uchroot_cfg["env"]["binary_path"] = paths
            uchroot_cfg["env"]["binary_ld_library_path"] = libs

            uchroot_cfg["env"]["lookup_path"] = paths
            uchroot_cfg["env"]["lookup_ld_library_path"] = libs

            mkfile_uchroot("/.benchbuild.json")
            uchroot_cfg.store(".benchbuild.json")
コード例 #3
0
ファイル: gentoo.py プロジェクト: vulder/benchbuild
    def configure(self):
        write_bashrc("etc/portage/bashrc")
        write_makeconfig("etc/portage/make.conf")
        write_wgetrc("etc/wgetrc")
        write_layout("etc/portage/metadata/layout.conf")

        mkfile_uchroot("/etc/resolv.conf")
        cp("/etc/resolv.conf", "etc/resolv.conf")

        config_file = CFG["config_file"].value()

        if os.path.exists(str(config_file)):
            paths, libs = \
                    uchroot_env(
                        uchroot_mounts(
                            "mnt",
                            CFG["container"]["mounts"].value()))
            uchroot_cfg = CFG
            uchroot_cfg["plugins"]["projects"] = []

            uchroot_cfg["env"]["path"] = paths
            uchroot_cfg["env"]["ld_library_path"] = libs

            mkfile_uchroot("/.benchbuild.yml")
            uchroot_cfg.store(".benchbuild.yml")

        wrap_cc_in_uchroot(self.cflags, self.ldflags, self.compiler_extension)
        wrap_cxx_in_uchroot(self.cflags, self.ldflags, self.compiler_extension)
コード例 #4
0
    def configure(self):
        self.write_bashrc("etc/portage/bashrc")
        self.write_makeconfig("etc/portage/make.conf")
        self.write_wgetrc("etc/wgetrc")
        self.write_layout("etc/portage/metadata/layout.conf")

        mkfile_uchroot("/etc/resolv.conf")
        cp("/etc/resolv.conf", "etc/resolv.conf")

        config_file = CFG["config_file"].value()

        if path.exists(str(config_file)):
            with open("log.file", 'w') as outf:
                paths, libs = \
                        uchroot_env(
                            uchroot_mounts("mnt",
                                CFG["container"]["mounts"].value()))
                UCHROOT_CFG = CFG
                UCHROOT_CFG["plugins"]["projects"] = []
                UCHROOT_CFG["env"]["compiler_path"] = paths
                UCHROOT_CFG["env"]["compiler_ld_library_path"] = libs

                UCHROOT_CFG["env"]["binary_path"] = paths
                UCHROOT_CFG["env"]["binary_ld_library_path"] = libs

                UCHROOT_CFG["env"]["lookup_path"] = paths
                UCHROOT_CFG["env"]["lookup_ld_library_path"] = libs

                mkfile_uchroot("/.benchbuild.json")
                UCHROOT_CFG.store(".benchbuild.json")

        wrap_cc_in_uchroot(self.cflags, self.ldflags, self.compiler_extension)
        wrap_cxx_in_uchroot(self.cflags, self.ldflags, self.compiler_extension)
コード例 #5
0
ファイル: bzip2.py プロジェクト: ognarb/benchbuild
    def compile(self):
        self.download()

        testfiles = [local.path(self.testdir) / x for x in self.testfiles]
        cp(testfiles, '.')

        clang = compiler.cc(self)
        with local.cwd(self.src_file):
            run.run(make["CFLAGS=-O3", "CC=" + str(clang), "clean", "bzip2"])
コード例 #6
0
ファイル: download.py プロジェクト: PolyJIT/benchbuild
def Copy(From, To):
    """
    Small copy wrapper.

    Args:
        From (str): Path to the SOURCE.
        To (str): Path to the TARGET.
    """
    from benchbuild.utils.cmd import cp
    cp("-ar", "--reflink=auto", From, To)
コード例 #7
0
def Copy(From, To):
    """
    Small copy wrapper.

    Args:
        From (str): Path to the SOURCE.
        To (str): Path to the TARGET.
    """
    from benchbuild.utils.cmd import cp
    cp("-ar", "--reflink=auto", From, To)
コード例 #8
0
ファイル: sevenz.py プロジェクト: tobiH94/benchbuild
    def compile(self):
        self.download()
        unpack_dir = local.path('p7zip_{0}'.format(self.version))
        tar('xfj', self.src_file)

        cp(unpack_dir / "makefile.linux_clang_amd64_asm",
           unpack_dir / "makefile.machine")

        clang = compiler.cc(self)
        clang_cxx = compiler.cxx(self)

        with local.cwd(unpack_dir):
            run.run(make["CC=" + str(clang), "CXX=" +
                         str(clang_cxx), "clean", "all"])
コード例 #9
0
ファイル: gzip.py プロジェクト: tobiH94/benchbuild
    def compile(self):
        self.download()
        tar("xfJ", self.src_file)
        unpack_dir = "gzip-{0}.tar.xz".format(self.version)

        testfiles = [local.path(self.testdir) / x for x in self.testfiles]
        cp(testfiles, '.')

        clang = compiler.cc(self)
        with local.cwd(unpack_dir):
            configure = local["./configure"]
            with local.env(CC=str(clang)):
                run.run(configure["--disable-dependency-tracking",
                                  "--disable-silent-rules", "--with-gnu-ld"])
            run.run(make["-j" + str(CFG["jobs"]), "clean", "all"])
コード例 #10
0
    def compile(self):
        self.download()
        testfiles = [local.path(self.testdir) / x for x in self.inputfiles]
        for testfile in testfiles:
            cp(testfile, self.builddir)

        clang = compiler.cc(self)

        with local.cwd(self.SRC_FILE):
            configure = local["./configure"]

            with local.env(CC=str(clang)):
                run.run(configure["--disable-thread", "--disable-opencl",
                                  "--enable-pic"])

            run.run(make["clean", "all", "-j", CFG["jobs"]])
コード例 #11
0
ファイル: x264.py プロジェクト: PolyJIT/benchbuild
    def compile(self):
        self.download()
        testfiles = [local.path(self.testdir) / x for x in self.inputfiles]
        for testfile in testfiles:
            cp(testfile, self.builddir)

        clang = compiler.cc(self)

        with local.cwd(self.SRC_FILE):
            configure = local["./configure"]

            with local.env(CC=str(clang)):
                run.run(configure["--disable-thread", "--disable-opencl",
                                  "--enable-pic"])

            run.run(make["clean", "all", "-j", CFG["jobs"]])
コード例 #12
0
    def version(self, target_dir: str, version: str = 'HEAD') -> pb.LocalPath:
        """Overrides ``Git`` s version to create a new git worktree pointing to
        the requested version."""

        main_repo_src_local = self.fetch()
        tgt_loc = pb.local.path(target_dir) / self.local
        vara_test_repos_path = self.__vara_test_repos_git.fetch()
        main_repo_src_remote = vara_test_repos_path / self.remote

        mkdir('-p', tgt_loc)

        # Extract main repository
        cp("-r", main_repo_src_local + "/.", tgt_loc)

        # Skip submodule extraction if none exist
        if not Path(tgt_loc / ".gitmodules").exists():
            with pb.local.cwd(tgt_loc):
                git("checkout", "--detach", version)
            return tgt_loc

        # Extract submodules
        with pb.local.cwd(tgt_loc):

            # Get submodule entries
            submodule_url_entry_list = git(
                "config", "--file", ".gitmodules", "--name-only",
                "--get-regexp", "url"
            ).split('\n')

            # Remove empty strings
            submodule_url_entry_list = list(
                filter(None, submodule_url_entry_list)
            )

            for entry in submodule_url_entry_list:
                relative_submodule_url = Path(
                    git("config", "--file", ".gitmodules", "--get",
                        entry).replace('\n', '')
                )
                copy_renamed_git_to_dest(
                    main_repo_src_remote / relative_submodule_url,
                    relative_submodule_url
                )
            git("checkout", "--detach", version)
            git("submodule", "update")

        return tgt_loc
コード例 #13
0
ファイル: container.py プロジェクト: PolyJIT/benchbuild
def unpack(container, path):
    """
    Unpack a container usable by uchroot.

    Method that checks if a directory for the container exists,
    checks if erlent support is needed and then unpacks the
    container accordingly.

    Args:
        path: The location where the container is, that needs to be unpacked.

    """
    from benchbuild.utils.run import run
    from benchbuild.utils.uchroot import no_args

    path = local.path(path)
    c_filename = local.path(container.filename)
    name = c_filename.basename

    if not path.exists():
        path.mkdir()

    with local.cwd(path):
        Wget(container.remote, name)

        uchroot = no_args()
        uchroot = uchroot["-E", "-A", "-C", "-r", "/", "-w",
                          os.path.abspath("."), "--"]

        # Check, if we need erlent support for this archive.
        has_erlent = bash[
            "-c", "tar --list -f './{0}' | grep --silent '.erlent'".format(
                name)]
        has_erlent = (has_erlent & TF)

        untar = local["/bin/tar"]["xf", "./" + name]
        if not has_erlent:
            untar = uchroot[untar]

        run(untar["--exclude=dev/*"])
        if not os.path.samefile(name, container.filename):
            rm(name)
        else:
            LOG.warning("File contents do not match: %s != %s", name,
                        container.filename)
        cp(container.filename + ".hash", path)
コード例 #14
0
def unpack(container, path):
    """
    Unpack a container usable by uchroot.

    Method that checks if a directory for the container exists,
    checks if erlent support is needed and then unpacks the
    container accordingly.

    Args:
        path: The location where the container is, that needs to be unpacked.

    """
    from benchbuild.utils.run import run
    from benchbuild.utils.uchroot import no_args

    path = local.path(path)
    c_filename = local.path(container.filename)
    name = c_filename.basename

    if not path.exists():
        path.mkdir()

    with local.cwd(path):
        Wget(container.remote, name)

        uchroot = no_args()
        uchroot = uchroot["-E", "-A", "-C", "-r", "/", "-w",
                          os.path.abspath("."), "--"]

        # Check, if we need erlent support for this archive.
        has_erlent = bash[
            "-c",
            "tar --list -f './{0}' | grep --silent '.erlent'".format(name)]
        has_erlent = (has_erlent & TF)

        untar = local["/bin/tar"]["xf", "./" + name]
        if not has_erlent:
            untar = uchroot[untar]

        run(untar["--exclude=dev/*"])
        if not os.path.samefile(name, container.filename):
            rm(name)
        else:
            LOG.warning("File contents do not match: %s != %s", name,
                        container.filename)
        cp(container.filename + ".hash", path)
コード例 #15
0
def unpack_container(container, path):
    """
    Unpack a container usable by uchroot.

    Method that checks if a directory for the container exists,
    checks if erlent support is needed and then unpacks the
    container accordingly.

    Args:
        path: The location where the container is, that needs to be unpacked.

    """
    from benchbuild.utils.run import run, uchroot_no_args

    path = os.path.abspath(path)
    name = os.path.basename(os.path.abspath(container.filename))
    if not os.path.exists(path):
        mkdir("-p", path)

    with local.cwd(path):
        Wget(container.remote, name)

        uchroot = uchroot_no_args()
        uchroot = uchroot["-E", "-A", "-C", "-r", "/", "-w",
                          os.path.abspath("."), "--"]

        # Check, if we need erlent support for this archive.
        has_erlent = bash[
            "-c",
            "tar --list -f './{0}' | grep --silent '.erlent'".format(name)]
        has_erlent = (has_erlent & TF)

        cmd = local["/bin/tar"]["xf"]
        if not has_erlent:
            cmd = uchroot[cmd["./" + name]]
        else:
            cmd = cmd[name]

        run(cmd["--exclude=dev/*"])
        if not os.path.samefile(name, container.filename):
            rm(name)
        else:
            logging.warning("File contents do not match: {0} != {1}", name,
                            container.filename)
        cp(container.filename + ".hash", path)
コード例 #16
0
    def extract(self) -> actions.StepResult:
        """This step extracts the bitcode of the executable of the project into
        one file."""
        if not self.obj:
            return
        project = self.obj

        bc_cache_folder = self.BC_CACHE_FOLDER_TEMPLATE.format(
            cache_dir=str(bb_cfg()["varats"]["result"]),
            project_name=str(project.name))
        mkdir("-p", local.path() / bc_cache_folder)

        for binary in project.binaries:
            bc_cache_file = bc_cache_folder + self.get_bc_file_name(
                project_name=str(project.name),
                binary_name=str(binary.name),
                project_version=project.version_of_primary,
                bc_file_extensions=self.bc_file_extensions)

            target_binary = Path(project.source_of_primary) / binary.path
            extract_bc(target_binary)
            cp(str(target_binary) + ".bc", local.path() / bc_cache_file)
コード例 #17
0
    def compile(self):
        self.download()

        tar('xfz', self.src_file)

        test_dir = local.path(self.testdir)
        testfiles = [test_dir / x for x in self.testfiles]
        cp(testfiles, self.builddir)

        unpack_dir = local.path('xz-{0}'.format(self.version))
        clang = compiler.cc(self)
        with local.cwd(unpack_dir):
            configure = local["./configure"]
            with local.env(CC=str(clang)):
                run.run(configure["--enable-threads=no", "--with-gnu-ld=yes",
                                  "--disable-shared",
                                  "--disable-dependency-tracking",
                                  "--disable-xzdec", "--disable-lzmadec",
                                  "--disable-lzmainfo", "--disable-lzma-links",
                                  "--disable-scripts", "--disable-doc"])

            run.run(make["CC=" + str(clang), "clean", "all"])
コード例 #18
0
ファイル: povray.py プロジェクト: PolyJIT/benchbuild
    def compile(self):
        self.download()
        download.Wget(self.boost_src_uri, self.boost_src_file)
        tar("xfj", self.boost_src_file)

        cp("-ar", local.path(self.testdir) / "cfg", '.')
        cp("-ar", local.path(self.testdir) / "etc", '.')
        cp("-ar", local.path(self.testdir) / "scenes", '.')
        cp("-ar", local.path(self.testdir) / "share", '.')
        cp("-ar", local.path(self.testdir) / "test", '.')

        clang = compiler.cc(self)
        clang_cxx = compiler.cxx(self)
        # First we have to prepare boost for lady povray...
        boost_prefix = "boost-install"
        with local.cwd(self.boost_src_dir):
            mkdir(boost_prefix)
            bootstrap = local["./bootstrap.sh"]
            run.run(bootstrap["--with-toolset=clang",
                              "--prefix=\"{0}\"".format(boost_prefix)])
            _b2 = local["./b2"]
            run.run(
                _b2["--ignore-site-config", "variant=release", "link=static",
                    "threading=multi", "optimization=speed", "install"])

        src_file = local.path(self.src_file)
        with local.cwd(src_file):
            with local.cwd("unix"):
                sh("prebuild.sh")

            configure = local["./configure"]
            with local.env(
                    COMPILED_BY="BB <*****@*****.**>",
                    CC=str(clang),
                    CXX=str(clang_cxx)):
                run.run(configure["--with-boost=" + boost_prefix])
            run.run(make["all"])
コード例 #19
0
    def compile(self):
        self.download()
        download.Wget(self.boost_src_uri, self.boost_src_file)
        tar("xfj", self.boost_src_file)

        cp("-ar", local.path(self.testdir) / "cfg", '.')
        cp("-ar", local.path(self.testdir) / "etc", '.')
        cp("-ar", local.path(self.testdir) / "scenes", '.')
        cp("-ar", local.path(self.testdir) / "share", '.')
        cp("-ar", local.path(self.testdir) / "test", '.')

        clang = compiler.cc(self)
        clang_cxx = compiler.cxx(self)
        # First we have to prepare boost for lady povray...
        boost_prefix = "boost-install"
        with local.cwd(self.boost_src_dir):
            mkdir(boost_prefix)
            bootstrap = local["./bootstrap.sh"]
            run.run(bootstrap["--with-toolset=clang",
                              "--prefix=\"{0}\"".format(boost_prefix)])
            _b2 = local["./b2"]
            run.run(_b2["--ignore-site-config", "variant=release",
                        "link=static", "threading=multi", "optimization=speed",
                        "install"])

        src_file = local.path(self.src_file)
        with local.cwd(src_file):
            with local.cwd("unix"):
                sh("prebuild.sh")

            configure = local["./configure"]
            with local.env(COMPILED_BY="BB <*****@*****.**>",
                           CC=str(clang),
                           CXX=str(clang_cxx)):
                run.run(configure["--with-boost=" + boost_prefix])
            run.run(make["all"])
コード例 #20
0
ファイル: bzip2.py プロジェクト: vulder/benchbuild
 def prepare(self):
     testfiles = [path.join(self.testdir, x) for x in self.testfiles]
     cp(testfiles, '.')
コード例 #21
0
ファイル: gentoo.py プロジェクト: tobiH94/benchbuild
def setup_networking():
    LOG.debug("Setting up networking...")
    path.mkfile_uchroot("/etc/resolv.conf")
    cp("/etc/resolv.conf", "etc/resolv.conf")
    write_wgetrc("etc/wgetrc")
コード例 #22
0
ファイル: lammps.py プロジェクト: simbuerg/benchbuild
 def prepare(self):
     super(Lammps, self).prepare()
     cp("-vr", self.testdir, "test")
コード例 #23
0
ファイル: xz.py プロジェクト: vulder/benchbuild
 def prepare(self):
     super(XZ, self).prepare()
     testfiles = [path.join(self.testdir, x) for x in self.testfiles]
     cp(testfiles, self.builddir)
コード例 #24
0
 def configure(self):
     cp("-ar", path.join(self.src_dir, self.path_dict[self.name],
                         self.name), self.name + ".dir")
     cp("-ar", path.join(self.src_dir, "utilities"), ".")
コード例 #25
0
ファイル: linpack.py プロジェクト: vulder/benchbuild
    def download(self):
        lp_patch = template_path("../projects/patches/linpack.patch")
        Wget(self.src_uri, "linpackc.new")
        cp("-a", "linpackc.new", "linpack.c")

        (patch["-p0"] < lp_patch)()
コード例 #26
0
ファイル: gentoo.py プロジェクト: PolyJIT/benchbuild
def setup_networking():
    LOG.debug("Setting up networking...")
    path.mkfile_uchroot("/etc/resolv.conf")
    cp("/etc/resolv.conf", "etc/resolv.conf")
    write_wgetrc("etc/wgetrc")
コード例 #27
0
    def prepare(self):
        super(Postgres, self).prepare()

        testfiles = [path.join(self.testdir, x) for x in self.testfiles]
        for test_f in testfiles:
            cp("-a", test_f, self.builddir)
コード例 #28
0
ファイル: x264.py プロジェクト: simbuerg/benchbuild
    def prepare(self):
        super(X264, self).prepare()

        testfiles = [path.join(self.testdir, x) for x in self.inputfiles]
        for testfile in testfiles:
            cp(testfile, self.builddir)
コード例 #29
0
ファイル: sevenz.py プロジェクト: vulder/benchbuild
 def download(self):
     Wget(self.src_uri, self.SRC_FILE)
     tar('xfj', self.SRC_FILE)
     cp(path.join(self.src_dir, "makefile.linux_clang_amd64_asm"),
        path.join(self.src_dir, "makefile.machine"))