예제 #1
0
    def useExistingChroot(self, chrootPath, useChrootUser=True, 
                          buildTrove = None):
        if chrootPath.startswith('archive/'):
            chrootPath = self.archiveDir + chrootPath[len('archive'):]
        elif not chrootPath.startswith(self.baseDir):
            chrootPath = self.baseDir + '/' +  chrootPath
        if not os.path.exists(chrootPath):
            raise errors.ServerError("No such chroot exists")
        chrootPath = os.path.realpath(chrootPath)
        assert(chrootPath.startswith(self.baseDir) or chrootPath.startswith(self.archiveDir))
        targetArch = None
        if buildTrove:
            setArch, targetArch = flavorutil.getTargetArch(buildTrove.flavor)

            if not setArch:
                targetArch = None

        chroot = rootfactory.ExistingChroot(chrootPath, self.logger,
                                            self.chrootHelperPath)
        chrootServer = rMakeChrootServer(chroot, targetArch=targetArch,
                chrootQueue=self.queue, useTmpfs=self.serverCfg.useTmpfs,
                buildLogPath=None, reuseRoots=True,
                useChrootUser=useChrootUser, logger=self.logger,
                runTagScripts=False, root=chrootPath,
                chrootCaps=self.serverCfg.chrootCaps)
        return chrootServer
예제 #2
0
    def getRootFactory(self, cfg, buildReqList, crossReqList, bootstrapReqs,
            buildTrove):
        cfg = copy.deepcopy(cfg)
        cfg.threaded = False

        cfg.logFile = '/var/log/conary'
        cfg.dbPath = '/var/lib/conarydb'

        setArch, targetArch = flavorutil.getTargetArch(buildTrove.flavor)

        if not setArch:
            targetArch = None

        chrootClass = rootfactory.FullRmakeChroot
        util.mkdirChain(self.baseDir)
        copyInConary = (not targetArch
                        and not cfg.strictMode
                        and cfg.copyInConary)

        chroot = chrootClass(buildTrove,
                             self.chrootHelperPath,
                             cfg, self.serverCfg, buildReqList, crossReqList,
                             bootstrapReqs, self.logger,
                             csCache=self.csCache,
                             chrootCache=self.chrootCache,
                             copyInConary=copyInConary)
        buildLogPath = self.serverCfg.getBuildLogPath(buildTrove.jobId)
        chrootServer = rMakeChrootServer(chroot, targetArch,
                chrootQueue=self.queue, useTmpfs=self.serverCfg.useTmpfs,
                buildLogPath=buildLogPath, reuseRoots=cfg.reuseRoots,
                strictMode=cfg.strictMode, logger=self.logger,
                buildTrove=buildTrove, chrootCaps=self.serverCfg.chrootCaps)

        return chrootServer