예제 #1
0
    def configure_benchbuild(self, cfg):
        config_file = local.path("/.benchbuild.yml")
        paths, libs = \
                uchroot.env(
                    uchroot.mounts(
                        "mnt",
                        cfg["container"]["mounts"].value))

        uchroot_cfg = cfg
        env = uchroot_cfg["env"].value
        env["PATH"] = paths
        env["LD_LIBRARY_PATH"] = libs

        uchroot_cfg["env"] = env
        uchroot_cfg['plugins']['projects'] = [str(self.__module__)]
        uchroot_cfg['plugins']['experiments'] = [
            str(self.experiment.__module__)
        ]
        uchroot_cfg["config_file"] = str(config_file)
        uchroot_cfg["unionfs"]["enable"] = False
        uchroot_cfg["build_dir"] = "/benchbuild/build"
        uchroot_cfg["tmp_dir"] = "/mnt/distfiles"
        uchroot_cfg["clean"] = False

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

        write_sandbox_d("etc/sandbox.conf")
예제 #2
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)
예제 #3
0
def write_sandbox_d(_path):
    path.mkfile_uchroot(local.path('/') / _path)
    with open(_path, 'a') as sandbox_conf:
        lines = '''
SANDBOX_WRITE="/clang.stderr:/clang++.stderr:/clang.stdout:/clang++.stdout"
'''
        sandbox_conf.write(lines)
예제 #4
0
    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")
예제 #5
0
def write_bashrc(_path):
    """
    Write a valid gentoo bashrc file to :path:.

    Args:
        path - The output path of the make.conf
    """
    cfg_mounts = CFG["container"]["mounts"].value
    cfg_prefix = CFG["container"]["prefixes"].value

    path.mkfile_uchroot("/etc/portage/bashrc")
    mounts = uchroot.mounts("mnt", cfg_mounts)
    p_paths, p_libs = uchroot.env(cfg_prefix)
    paths, libs = uchroot.env(mounts)

    paths = paths + p_paths
    libs = libs + p_libs

    with open(_path, 'w') as bashrc:
        lines = '''
export PATH="{0}:${{PATH}}"
export LD_LIBRARY_PATH="{1}:${{LD_LIBRARY_PATH}}"
'''.format(path.list_to_path(paths), path.list_to_path(libs))

        bashrc.write(lines)
예제 #6
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)
예제 #7
0
def write_bashrc(_path):
    """
    Write a valid gentoo bashrc file to :path:.

    Args:
        path - The output path of the make.conf
    """
    cfg_mounts = CFG["container"]["mounts"].value
    cfg_prefix = CFG["container"]["prefixes"].value

    path.mkfile_uchroot("/etc/portage/bashrc")
    mounts = uchroot.mounts("mnt", cfg_mounts)
    p_paths, p_libs = uchroot.env(cfg_prefix)
    paths, libs = uchroot.env(mounts)

    paths = paths + p_paths
    libs = libs + p_libs

    with open(_path, 'w') as bashrc:
        lines = '''
export PATH="{0}:${{PATH}}"
export LD_LIBRARY_PATH="{1}:${{LD_LIBRARY_PATH}}"
'''.format(path.list_to_path(paths), path.list_to_path(libs))

        bashrc.write(lines)
예제 #8
0
    def configure_benchbuild(self, cfg):
        config_file = local.path("/.benchbuild.yml")
        paths, libs = \
                uchroot.env(
                    uchroot.mounts(
                        "mnt",
                        cfg["container"]["mounts"].value))

        uchroot_cfg = cfg
        env = uchroot_cfg["env"].value
        env["PATH"] = paths
        env["LD_LIBRARY_PATH"] = libs

        uchroot_cfg["env"] = env
        uchroot_cfg['plugins']['projects'] = [str(self.__module__)]
        uchroot_cfg['plugins']['experiments'] = [
            str(self.experiment.__module__)
        ]
        uchroot_cfg["config_file"] = str(config_file)
        uchroot_cfg["unionfs"]["enable"] = False
        uchroot_cfg["build_dir"] = "/benchbuild/build"
        uchroot_cfg["tmp_dir"] = "/mnt/distfiles"
        uchroot_cfg["clean"] = False

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

        write_sandbox_d("etc/sandbox.conf")
예제 #9
0
def write_sandbox_d(_path):
    path.mkfile_uchroot(local.path('/') / _path)
    with open(_path, 'a') as sandbox_conf:
        lines = '''
SANDBOX_WRITE="/clang.stderr:/clang++.stderr:/clang.stdout:/clang++.stdout"
'''
        sandbox_conf.write(lines)
예제 #10
0
 def write_layout(self, path):
     """Create a layout from the given path."""
     mkdir_uchroot("/etc/portage/metadata")
     mkfile_uchroot("/etc/portage/metadata/layout.conf")
     with open(path, 'w') as layoutconf:
         lines = '''masters = gentoo'''
         layoutconf.write(lines)
예제 #11
0
    def write_makeconfig(self, path):
        """Create the stringed to be written in the settings."""
        mkfile_uchroot("/etc/portage/make.conf")
        with open(path, 'w') as makeconf:
            lines = '''
PORTAGE_USERNAME=root
PORTAGE_GROUPNAME=root
CFLAGS="-O2 -pipe"
CXXFLAGS="${CFLAGS}"
FEATURES="-xattr"

CHOST="x86_64-pc-linux-gnu"
USE="bindist mmx sse sse2"
PORTDIR="/usr/portage"
DISTDIR="${PORTDIR}/distfiles"
PKGDIR="${PORTDIR}/packages"
'''

            makeconf.write(lines)
            hp = CFG["gentoo"]["http_proxy"].value()
            if hp is not None:
                http_s = "http_proxy={0}".format(str(hp))
                https_s = "https_proxy={0}".format(str(hp))
                makeconf.write(http_s + "\n")
                makeconf.write(https_s + "\n")

            fp = CFG["gentoo"]["ftp_proxy"].value()
            if fp is not None:
                fp_s = "ftp_proxy={0}".format(str(fp))
                makeconf.write(fp_s + "\n")

            rp = CFG["gentoo"]["rsync_proxy"].value()
            if rp is not None:
                rp_s = "RSYNC_PROXY={0}".format(str(rp))
                makeconf.write(rp_s + "\n")
예제 #12
0
    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)
예제 #13
0
def write_layout(_path):
    """
    Write a valid gentoo layout file to :path:.

    Args:
        path - The output path of the layout.conf
    """

    path.mkdir_uchroot("/etc/portage/metadata")
    path.mkfile_uchroot("/etc/portage/metadata/layout.conf")
    with open(_path, 'w') as layoutconf:
        lines = '''masters = gentoo'''
        layoutconf.write(lines)
예제 #14
0
def write_layout(_path):
    """
    Write a valid gentoo layout file to :path:.

    Args:
        path - The output path of the layout.conf
    """

    path.mkdir_uchroot("/etc/portage/metadata")
    path.mkfile_uchroot("/etc/portage/metadata/layout.conf")
    with open(_path, 'w') as layoutconf:
        lines = '''masters = gentoo'''
        layoutconf.write(lines)
예제 #15
0
    def redirect(self):
        if not CFG["unionfs"]["enable"]:
            container.unpack(self.container, self.builddir)

        setup_networking()
        setup_benchbuild()
        configure_portage()

        self.configure_benchbuild(CFG)
        path.mkfile_uchroot("/.benchbuild-container")
        benchbuild = find_benchbuild()
        with local.env(BB_VERBOSITY=str(CFG['verbosity'])):
            project_id = "{0}/{1}".format(self.name, self.group)
            run.run(benchbuild["run", "-E", self.experiment.name, project_id])
예제 #16
0
    def redirect(self):
        if not CFG["unionfs"]["enable"]:
            container.unpack(self.container, self.builddir)

        setup_networking()
        setup_benchbuild()
        configure_portage()

        self.configure_benchbuild(CFG)
        path.mkfile_uchroot("/.benchbuild-container")
        benchbuild = find_benchbuild()
        with local.env(BB_VERBOSITY=str(CFG['verbosity'])):
            project_id = "{0}/{1}".format(self.name, self.group)
            run.run(benchbuild["run", "-E", self.experiment.name, project_id])
예제 #17
0
    def write_wgetrc(self, path):
        mkfile_uchroot("/etc/wgetrc")

        with open(path, 'w') as wgetrc:
            hp = CFG["gentoo"]["http_proxy"].value()
            fp = CFG["gentoo"]["ftp_proxy"].value()
            if hp is not None:
                http_s = "http_proxy = {0}".format(str(hp))
                https_s = "https_proxy = {0}".format(str(hp))
                wgetrc.write("use_proxy = on\n")
                wgetrc.write(http_s + "\n")
                wgetrc.write(https_s + "\n")

            if fp is not None:
                fp_s = "ftp_proxy={0}".format(str(fp))
                wgetrc.write(fp_s + "\n")
예제 #18
0
def write_makeconfig(_path):
    """
    Write a valid gentoo make.conf file to :path:.

    Args:
        path - The output path of the make.conf
    """
    http_proxy = str(CFG["gentoo"]["http_proxy"])
    ftp_proxy = str(CFG["gentoo"]["ftp_proxy"])
    rsync_proxy = str(CFG["gentoo"]["rsync_proxy"])

    path.mkfile_uchroot(local.path('/') / _path)
    with open(_path, 'w') as makeconf:
        lines = '''
PORTAGE_USERNAME=root
PORTAGE_GROUPNAME=root
CFLAGS="-O2 -pipe"
CXXFLAGS="${CFLAGS}"
FEATURES="nostrip -xattr"
CHOST="x86_64-pc-linux-gnu"
USE="bindist mmx sse sse2"
PORTDIR="/usr/portage"
DISTDIR="/mnt/distfiles"
PKGDIR="${PORTDIR}/packages"
'''

        makeconf.write(lines)

        mounts = CFG["container"]["mounts"].value
        tmp_dir = str(CFG["tmp_dir"])
        mounts.append({"src": tmp_dir, "tgt": "/mnt/distfiles"})
        CFG["container"]["mounts"] = mounts

        if http_proxy is not None:
            http_s = "http_proxy={0}".format(http_proxy)
            https_s = "https_proxy={0}".format(http_proxy)
            makeconf.write(http_s + "\n")
            makeconf.write(https_s + "\n")

        if ftp_proxy is not None:
            fp_s = "ftp_proxy={0}".format(ftp_proxy)
            makeconf.write(fp_s + "\n")

        if rsync_proxy is not None:
            rp_s = "RSYNC_PROXY={0}".format(rsync_proxy)
            makeconf.write(rp_s + "\n")
예제 #19
0
    def write_wgetrc(path):
        """Wget the project from a specified link."""
        mkfile_uchroot("/etc/wgetrc")

        with open(path, 'w') as wgetrc:
            http_proxy = CFG["gentoo"]["http_proxy"].value()
            ftp_proxy = CFG["gentoo"]["ftp_proxy"].value()
            if http_proxy is not None:
                http_proxy_s = "http_proxy = {0}".format(str(http_proxy))
                https_proxy_s = "https_proxy = {0}".format(str(http_proxy))
                wgetrc.write("use_proxy = on\n")
                wgetrc.write(http_proxy_s + "\n")
                wgetrc.write(https_proxy_s + "\n")

            if ftp_proxy is not None:
                ftp_proxy_s = "ftp_proxy={0}".format(str(ftp_proxy))
                wgetrc.write(ftp_proxy_s + "\n")
예제 #20
0
def write_makeconfig(_path):
    """
    Write a valid gentoo make.conf file to :path:.

    Args:
        path - The output path of the make.conf
    """
    http_proxy = str(CFG["gentoo"]["http_proxy"])
    ftp_proxy = str(CFG["gentoo"]["ftp_proxy"])
    rsync_proxy = str(CFG["gentoo"]["rsync_proxy"])

    path.mkfile_uchroot(local.path('/') / _path)
    with open(_path, 'w') as makeconf:
        lines = '''
PORTAGE_USERNAME=root
PORTAGE_GROUPNAME=root
CFLAGS="-O2 -pipe"
CXXFLAGS="${CFLAGS}"
FEATURES="nostrip -xattr"
CHOST="x86_64-pc-linux-gnu"
USE="bindist mmx sse sse2"
PORTDIR="/usr/portage"
DISTDIR="/mnt/distfiles"
PKGDIR="${PORTDIR}/packages"
'''

        makeconf.write(lines)

        mounts = CFG["container"]["mounts"].value
        tmp_dir = str(CFG["tmp_dir"])
        mounts.append({"src": tmp_dir, "tgt": "/mnt/distfiles"})
        CFG["container"]["mounts"] = mounts

        if http_proxy is not None:
            http_s = "http_proxy={0}".format(http_proxy)
            https_s = "https_proxy={0}".format(http_proxy)
            makeconf.write(http_s + "\n")
            makeconf.write(https_s + "\n")

        if ftp_proxy is not None:
            fp_s = "ftp_proxy={0}".format(ftp_proxy)
            makeconf.write(fp_s + "\n")

        if rsync_proxy is not None:
            rp_s = "RSYNC_PROXY={0}".format(rsync_proxy)
            makeconf.write(rp_s + "\n")
예제 #21
0
파일: gentoo.py 프로젝트: vulder/benchbuild
def write_makeconfig(path):
    """
    Write a valid gentoo make.conf file to :path:.

    Args:
        path - The output path of the make.conf
    """

    mkfile_uchroot("/etc/portage/make.conf")
    with open(path, 'w') as makeconf:
        lines = '''
PORTAGE_USERNAME=root
PORTAGE_GROUPNAME=root
CFLAGS="-O2 -pipe"
CXXFLAGS="${CFLAGS}"
FEATURES="-xattr"
CC="/clang"
CXX="/clang++"

CHOST="x86_64-pc-linux-gnu"
USE="bindist mmx sse sse2"
PORTDIR="/usr/portage"
DISTDIR="${PORTDIR}/distfiles"
PKGDIR="${PORTDIR}/packages"
PYTHON_TARGETS="python2_7 python3_5"
'''

        makeconf.write(lines)
        http_proxy = CFG["gentoo"]["http_proxy"].value()
        if http_proxy is not None:
            http_s = "http_proxy={0}".format(str(http_proxy))
            https_s = "https_proxy={0}".format(str(http_proxy))
            makeconf.write(http_s + "\n")
            makeconf.write(https_s + "\n")

        ftp_proxy = CFG["gentoo"]["ftp_proxy"].value()
        if ftp_proxy is not None:
            fp_s = "ftp_proxy={0}".format(str(ftp_proxy))
            makeconf.write(fp_s + "\n")

        rsync_proxy = CFG["gentoo"]["rsync_proxy"].value()
        if rsync_proxy is not None:
            rp_s = "RSYNC_PROXY={0}".format(str(rsync_proxy))
            makeconf.write(rp_s + "\n")
예제 #22
0
파일: gentoo.py 프로젝트: vulder/benchbuild
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)
예제 #23
0
def write_wgetrc(_path):
    """
    Write a valid gentoo wgetrc file to :path:.

    Args:
        path - The output path of the wgetrc
    """
    http_proxy = str(CFG["gentoo"]["http_proxy"])
    ftp_proxy = str(CFG["gentoo"]["ftp_proxy"])

    path.mkfile_uchroot("/etc/wgetrc")
    with open(_path, 'w') as wgetrc:
        if http_proxy is not None:
            http_s = "http_proxy = {0}".format(http_proxy)
            https_s = "https_proxy = {0}".format(http_proxy)
            wgetrc.write("use_proxy = on\n")
            wgetrc.write(http_s + "\n")
            wgetrc.write(https_s + "\n")

        if ftp_proxy is not None:
            fp_s = "ftp_proxy={0}".format(ftp_proxy)
            wgetrc.write(fp_s + "\n")
예제 #24
0
def write_wgetrc(_path):
    """
    Write a valid gentoo wgetrc file to :path:.

    Args:
        path - The output path of the wgetrc
    """
    http_proxy = str(CFG["gentoo"]["http_proxy"])
    ftp_proxy = str(CFG["gentoo"]["ftp_proxy"])

    path.mkfile_uchroot("/etc/wgetrc")
    with open(_path, 'w') as wgetrc:
        if http_proxy is not None:
            http_s = "http_proxy = {0}".format(http_proxy)
            https_s = "https_proxy = {0}".format(http_proxy)
            wgetrc.write("use_proxy = on\n")
            wgetrc.write(http_s + "\n")
            wgetrc.write(https_s + "\n")

        if ftp_proxy is not None:
            fp_s = "ftp_proxy={0}".format(ftp_proxy)
            wgetrc.write(fp_s + "\n")
예제 #25
0
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")
예제 #26
0
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")