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"), '.')
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")
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)
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)
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"])
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)
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)
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"])
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"])
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"]])
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"]])
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
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)
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)
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)
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)
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"])
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"])
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"])
def prepare(self): testfiles = [path.join(self.testdir, x) for x in self.testfiles] cp(testfiles, '.')
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")
def prepare(self): super(Lammps, self).prepare() cp("-vr", self.testdir, "test")
def prepare(self): super(XZ, self).prepare() testfiles = [path.join(self.testdir, x) for x in self.testfiles] cp(testfiles, self.builddir)
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"), ".")
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)()
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")
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)
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)
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"))