Exemple #1
0
 def _getRmakeHelper(self):
     """
     @return: an rMakeHelper object suitable for use with the current
     product (without any contexts for use in starting a build)
     """
     cfg = self._getRmakeConfig()
     return helper.rMakeHelper(buildConfig=cfg)
Exemple #2
0
 def _getRmakeHelper(self):
     """
     @return: an rMakeHelper object suitable for use with the current
     product (without any contexts for use in starting a build)
     """
     cfg = self._getRmakeConfig()
     return helper.rMakeHelper(buildConfig=cfg)
Exemple #3
0
 def _getRmakeHelperWithContexts(self):
     """
     @return: an rMakeHelper object suitable for use with the current
     product, and a dictionary of {flavor : contextName} lists that match the
     flavors in the current product's build definitions.
     """
     cfg, contextDict = self._getRmakeConfigWithContexts()
     client = helper.rMakeHelper(buildConfig=cfg, plugins=self._plugins)
     return client, contextDict
Exemple #4
0
 def _getRmakeHelperWithContexts(self):
     """
     @return: an rMakeHelper object suitable for use with the current
     product, and a dictionary of {flavor : contextName} lists that match the
     flavors in the current product's build definitions.
     """
     cfg, contextDict = self._getRmakeConfigWithContexts()
     client = helper.rMakeHelper(buildConfig=cfg, plugins=self._plugins)
     return client, contextDict
Exemple #5
0
    def __init__(self, cfg, ui, rmakeCfgFn=None, conaryCfg=None, rmakeCfg=None):
        self._cfg = cfg
        self._ui = ui

        if conaryCfg:
            self._ccfg = conaryCfg
        else:
            self._ccfg = conarycfg.ConaryConfiguration(readConfigFiles=False)
            self._ccfg.read(util.join(self._cfg.configPath, 'conaryrc'))
            self._ccfg.dbPath = ':memory:'
            self._ccfg.initializeFlavors()

        self._client = conaryclient.ConaryClient(self._ccfg)

        if self._cfg.saveChangeSets or self._cfg.sanityCheckChangesets:
            self._saveChangeSets = tempfile.mkdtemp(
                prefix=self._cfg.platformName,
                suffix='-import-changesets')
        else:
            self._saveChangeSets = False

        self._sanityCheckChangesets = self._cfg.sanityCheckChangesets
        self._sanityCheckCommits = self._cfg.sanityCheckCommits

        if rmakeCfg:
            self._rmakeCfg = rmakeCfg
        else:
            self._rmakeCfg = self._getRmakeConfig(rmakeCfgFn=rmakeCfgFn)

        self._helper = helper.rMakeHelper(buildConfig=self._rmakeCfg)

        self.cvc = Cvc(self._cfg, self._ccfg, self._formatInput,
                       LocalDispatcher(self, 12))

        self._asyncDispatcher = OrderedCommitDispatcher(self, 30)

        self._conaryhelper = ConaryHelper(self._cfg)
Exemple #6
0
 def getrMakeHelper(self):
     '''Get a rMakeHelper'''
     if not self._rmakeHelper:
         self._rmakeHelper = helper.rMakeHelper(buildConfig=self.cfg,
                                                promptPassword=True)
     return self._rmakeHelper
Exemple #7
0
class RmakeMain(options.MainHandler):
    name = 'rmake'
    version = constants.version

    abstractCommand = command.rMakeCommand
    configClass = buildcfg.BuildConfiguration

    useConaryOptions = False

    commandList = command._commands

    def usage(self, rc=1, showAll=False):
        print 'rmake: front end to rMake build tool'
        if not showAll:
            print
            print 'Common Commands (use "rmake help" for the full list)'
        return options.MainHandler.usage(self, rc, showAll=showAll)

    def initializePlugins(self, argv):
        p = plugins.getPluginManager(argv, buildcfg.BuildConfiguration)
        p.callClientHook('client_preInit', self, argv)
        return p

    def getConfigFile(self, argv):
        pluginManager = self.initializePlugins(argv)
        if '--skip-default-config' in argv:
            argv.remove('--skip-default-config')
            read = False
        else:
            read = True

        buildConfig = buildcfg.BuildConfiguration(readConfigFiles=read)
        conaryConfig = conarycfg.ConaryConfiguration(readConfigFiles=read)
        return buildConfig, conaryConfig, pluginManager

    def runCommand(self, thisCommand, (buildConfig, conaryConfig,
                                       pluginManager), argSet, args):
        pluginManager.callClientHook('client_preCommand', self, thisCommand,
                                     (buildConfig, conaryConfig), argSet, args)
        compat.checkRequiredVersions()
        thisCommand.verbose = (log.getVerbosity() <= log.INFO)
        if args[1] != 'help':
            # NOTE: the help system assumes that the base level of output
            # you want is "warning", but rmake is more verbose than that.
            # Due to limitations in how configurable the help system is,
            # I can't easily fix that.  Someday I should though.  For now,
            # if we're running help, we make log.WARNING the default level,
            # and otherwise log.INFO is the default.
            log.setMinVerbosity(log.INFO)

        # don't let the buildFlavor be overridden yet
        client = helper.rMakeHelper(buildConfig=buildConfig,
                                    promptPassword=True)

        pluginManager.callClientHook('client_preCommand2', self, client,
                                     thisCommand)

        try:
            return options.MainHandler.runCommand(self, thisCommand, client,
                                                  buildConfig, argSet, args)
        except errors.BadParameters:
            if not thisCommand.verbose:
                log.setVerbosity(log.WARNING)
            thisCommand.usage()
            raise