Пример #1
0
    def init(self):
        self.clean_cache()

        if os.path.isdir(self.gitdir):
            util.cmd('git reset --hard HEAD',   env=self.env, chdir=self.cachedir)
            util.cmd('git clean -f -d -x',      env=self.env, chdir=self.cachedir)
            util.cmd('git checkout master',     env=self.env, chdir=self.cachedir)
            util.cmd('git pull',                env=self.env, chdir=self.cachedir)
        else:
            util.cmd('git clone %s %s' % (self.src, self.cachedir))

        _, branches = util.cmd_out('git branch -l', env=self.env, chdir=self.cachedir)
        if 'inhibitor' in branches:
            util.cmd('git branch -D inhibitor', env=self.env, chdir=self.cachedir)

        if self.rev != 'HEAD':
            util.cmd('git checkout -b inhibitor %s' % self.rev, env=self.env, chdir=self.cachedir)
        else:
            _, self.rev = util.cmd_out('git rev-parse HEAD', env=self.env)
            self.rev = self.rev[:7]
Пример #2
0
 def _get_remote_fetch(self):
     """
     Returns a list of origins we fetch from
     """
     _, out = util.cmd_out('git remote -v', env=self.env)
     remotes = []
     for line in out.splitlines():
         _, tmp = line.split('\t')
         url, what = tmp.split(' ')
         if 'fetch' in what:
             remotes.append(url)
     return remotes
Пример #3
0
    def _ldlibs(self, binp):
        if binp in self.checked_ldd:
            return []
        self.checked_ldd.append(binp)

        cmdline = 'ldd %s' % (binp,)

        rc, output = util.cmd_out( cmdline, raise_exception=False)

        if rc != 0:
            return []
        libs = []
        for line in output.splitlines():
            try:
                lib = self.lddre.search(line).group(1)
            except (IndexError, AttributeError):
                continue
            if not lib in self.copied_libs:
                self.copied_libs.append(lib)
                libs.append( lib )
                util.dbg("Adding required library %s" % lib)
        return libs
Пример #4
0
    def post_conf(self, inhibitor_state):
        super(BaseGentooStage, self).post_conf(inhibitor_state, run_finish=False)
        if not self.pkgcache:
            self.pkgcache = source.create_source(
                "file://%s" % util.mkdir(self.istate.paths.pkgs.pjoin(self.build_name))
            )
        self.pkgcache.keep = False
        self.pkgcache.dest = self.env["PKGDIR"]
        self.sources.append(self.pkgcache)

        distcache = source.create_source(
            "file://%s" % util.mkdir(self.istate.paths.dist), keep=False, dest=self.env["DISTDIR"]
        )
        self.sources.append(distcache)

        if self.conf.has("kernel"):
            self.kernel = self.conf.kernel
            if not self.kernel.has("kconfig"):
                raise util.InhibitorError("No kernel config (kconfig) specified.")
            else:
                self.kernel.kconfig.keep = False
                self.kernel.kconfig.dest = util.Path("/tmp/inhibitor/kconfig")
                self.kernel.kconfig.post_conf(inhibitor_state)
                self.sources.append(self.kernel.kconfig)
            if not self.kernel.has("kernel_pkg"):
                raise util.InhibitorError("No kernel package (kernel_pkg) specified.")

            kerncache = source.create_source(
                "file://%s" % util.mkdir(inhibitor_state.paths.kernel.pjoin(self.build_name)),
                keep=False,
                dest="/tmp/inhibitor/kerncache",
            )
            self.sources.append(kerncache)

        if self.conf.has("snapshot"):
            self.conf.snapshot.keep = False
            self.conf.snapshot.dest = util.Path(self.env["PORTDIR"])
            self.sources.append(self.conf.snapshot)
        else:
            _, portdir = util.cmd_out("portageq portdir", raise_exception=True)
            self.sources.append(
                source.create_source("file://" + portdir, keep=False, dest=util.Path(self.env["PORTDIR"]))
            )

        if self.conf.has("overlays"):
            i = 0
            for overlay in self.conf.overlays:
                overlay.keep = False
                overlay.dest = util.Path("/tmp/inhibitor/overlays/%d" % i)
                self.sources.append(overlay)
                self.env["PORTDIR_OVERLAY"] += " /tmp/inhibitor/overlays/%d" % i
                i += 1

        if self.conf.has("profile"):
            self.profile = self.conf.profile
        else:
            self.profile = os.readlink("/etc/make.profile")
            self.profile = re.sub(".*/profiles/", "", self.profile)

        if self.conf.has("make_conf"):
            mc = self.conf.make_conf
        else:
            mc = source.create_source(make_conf_source, source="/etc/make.conf")
        mc.dest = self.portage_cr.pjoin("etc/make.conf")
        mc.keep = True
        self.sources.append(mc)

        if self.conf.has("portage_conf"):
            self.conf.portage_conf.dest = self.portage_cr.pjoin("etc/portage")
            self.conf.portage_conf.keep = True
            self.sources.append(self.conf.portage_conf)

        self.post_conf_finish()