Beispiel #1
0
def getPlatformConfigs(cfgDir):
    platformConfigs = []
    for dname in os.listdir(cfgDir):
        conf = os.path.join(cfgDir, dname, 'updatebotrc')
        if os.path.exists(conf):
            cfg = config.UpdateBotConfig()
            cfg.read(conf)
            platformConfigs.append(cfg)
    return platformConfigs
Beispiel #2
0
def main(argv, workerFunc, configDir='/etc/mirrorball', enableLogging=True):
    if len(argv) < 2 or len(argv) > 3:
        return usage(argv)

    logFile = None
    if len(argv) == 3:
        logFile = argv[2]

    if enableLogging:
        log.addRootLogger(logFile=logFile)

    platform = argv[1]
    if not validatePlatform(platform, configDir):
        return 1

    cfg = config.UpdateBotConfig()
    cfg.read(os.path.join(configDir, platform, 'updatebotrc'))

    rc = workerFunc(cfg)
    return rc
    def __init__(self, cfg, compsfile=None):
        self.compsfile = compsfile
        self.cfg = config.UpdateBotConfig()
        self.cfg.read(mirrorballDir + '/config/%s/updatebotrc' % cfg)
        #self.bot = bot.Bot(self.cfg)
        self.bot = current.Bot(self.cfg)
        #self.pkgSource = self.upbot._pkgSource
        #self.pkgSource.load()

        ui = cmdline.UserInterface()

        self.mgr = groupmgr.GroupManager(self.cfg, ui)

        self.label = self.mgr._helper._ccfg.buildLabel
        self.troves = self.mgr._helper._getLatestTroves()
        self.allTroves = self.mgr._helper._repos.getTroveLeavesByLabel(
            {None: {
                self.label: None
            }})
        self.group_everything = self.groupEverything(self.troves,
                                                     self.allTroves)
Beispiel #4
0
    def initialize(self):
        """
        Setup initial state.
        """

        store, product = self.handle.productStore, self.handle.product
        ui = self.handle.ui
        cny = self.handle.facade.conary
        rmk = self.handle.facade.rmake

        # This happens when we aren't in a rBuild checkout directory. Most
        # common case, probably when "rbuild init" is being run. Bail since we
        # can't do anyhthing anyway.
        if not store:
            return

        activeStage = store.getActiveStageName()
        activeLabel = product.getLabelForStage(activeStage)
        #nextStage = store.getNextStageName(activeStage)
        #nextLabel = product.getLabelForStage(nextStage)

        self.conarycfg = cny.getConaryConfig()
        self.rmakecfg, contextNames = rmk._getRmakeConfigWithContexts()
        self.updatebotcfg = config.UpdateBotConfig()

        self.updatebotcfg.archContexts = [(x, None)
                                          for x in contextNames.itervalues()]

        self.conarycfg.buildLabel = cny._getLabel(activeLabel)

        self.builder = build.Builder(self.updatebotcfg,
                                     ui,
                                     conaryCfg=self.conarycfg,
                                     rmakeCfg=self.rmakecfg)

        log.addRootLogger()
                        # Reqs between subpackages of the same source aren't
                        # interesting for build requirements, because neither has been
                        # built yet.
                        continue

                    reqTroves.add(provTup[0])

        reqTroves.discard('perl:rpm')
        reqTroves.discard('python:rpm')
        reqTroves.discard('python-test:rpm')
        if reqTroves:
            buildRequiresMap[name] = reqTroves

    print 'buildRequiresMap = ',
    pprint.PrettyPrinter().pprint(buildRequiresMap)

    #import epdb;epdb.st()

if __name__ == '__main__':
    from conary.lib import util
    sys.excepthook = util.genExcepthook()

    cfg = config.UpdateBotConfig()
    cfg.read(os.path.abspath('../') + '/config/%s/updatebotrc' % sys.argv[1])
    if cfg.updateMode == 'current':
        obj = current.Bot(cfg)
    if cfg.updateMode == 'latest':
        obj = bot.Bot(cfg)

    main(obj)
Beispiel #6
0
def getBot(botClass=CurrentBot, *args, **kwargs):
    from updatebot import config
    cfg = config.UpdateBotConfig()
    cfg.read(os.path.join(mirrorballDir, 'config', sys.argv[1], 'updatebotrc'))
    return botClass(cfg, *args, **kwargs)