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): 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 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 write_bashrc(path): """ Write a valid gentoo bashrc file to :path:. Args: path - The output path of the make.conf """ mkfile_uchroot("/etc/portage/bashrc") paths, libs = uchroot_env( uchroot_mounts("mnt", CFG["container"]["mounts"].value())) p_paths, p_libs = uchroot_env(CFG["container"]["prefixes"].value()) with open(path, 'w') as bashrc: lines = ''' export PATH="{0}:${{PATH}}" export LD_LIBRARY_PATH="{1}:${{LD_LIBRARY_PATH}}" '''.format(list_to_path(paths + p_paths), list_to_path(libs + p_libs)) bashrc.write(lines)
def write_bashrc(self, path): """Write inside a bash and update the shell if necessary.""" mkfile_uchroot("/etc/portage/bashrc") paths, libs = uchroot_env( uchroot_mounts("mnt", CFG["container"]["mounts"].value())) with open(path, 'w') as bashrc: lines = ''' export PATH="{0}:${{PATH}}" export LD_LIBRARY_PATH="{1}:${{LD_LIBRARY_PATH}}" '''.format(list_to_path(paths), list_to_path(libs)) bashrc.write(lines)