Example #1
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
Example #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
Example #3
0
def main(argv):
    rootLogger = logger.addRootLogger()
    log = logging.getLogger('updatebot.main')
    try:
        argv = list(argv)
        debugAll = '--debug-all' in argv
        debuggerException = errors.UpdateBotError
        if debugAll:
            debuggerException = Exception
            argv.remove('--debug-all')
        sys.excepthook = util.genExcepthook(debug=debugAll,
                                            debugCtrlC=debugAll)
        return BotMain().main(argv, debuggerException=debuggerException)
    except debuggerException, err:
        raise
Example #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()
Example #5
0
def main(argv):
    rootLogger = logger.addRootLogger()
    log = logging.getLogger('updatebot.main')
    try:
        argv = list(argv)
        debugAll = '--debug-all' in argv
        debuggerException = errors.UpdateBotError
        if debugAll:
            debuggerException = Exception
            argv.remove('--debug-all')
        sys.excepthook = util.genExcepthook(debug=debugAll,
                                            debugCtrlC=debugAll)
        return BotMain().main(argv, debuggerException=debuggerException)
    except debuggerException, err:
        raise
Example #6
0
    import rmake
    import conary
    import updatebot

    print >>sys.stderr, "using conary from", os.path.dirname(conary.__file__)
    print >>sys.stderr, "using rmake from", os.path.dirname(rmake.__file__)
    print >>sys.stderr, "using updatebot from", os.path.dirname(updatebot.__file__)

    from conary.lib import util

    sys.excepthook = util.genExcepthook()

    from updatebot import log as logSetup

    logSetup.addRootLogger()

import logging

from updatebot import OrderedBot

log = logging.getLogger("scripts.testgroup")


class Bot(OrderedBot):
    def generateInitialGroup(self):
        """
        Generate config for standard group contents based on repository history.
        """

        #        self._pkgSource.load()
Example #7
0
from updatebot import config
from updatebot import bot
from updatebot import current
from updatebot import log


# These dep classes will be inspected, all others will be ignored for buildreq
# generation purposes.
#DEP_CLASSES = (deps.PythonDependencies, deps.PerlDependencies)
DEP_CLASSES = (deps.PythonDependencies, deps.PerlDependencies, deps.RpmDependencies, deps.RpmLibDependencies)

#import epdb;epdb.st()

logfile = '%s_%s.log' % (sys.argv[0], time.strftime('%Y-%m-%d_%H%M%S'))

log.addRootLogger(logfile)


def main(obj):
    helper = obj._updater._conaryhelper

    print "Collecting RPM list"
    rpmBins = set()
    for name, verDict in helper._getLatestTroves().iteritems():
        if not name.endswith(':rpm'):
            continue
        for version, flavors in verDict.iteritems():
            for flavor in flavors:
                rpmBins.add((name, version, flavor))
    rpmBins = sorted(rpmBins)
Example #8
0
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
"""
Script for walking a tree of rpms and building the metadata needed to detect
repository state based on the contents of such a directory.
"""

from header import *

from updatebot import log as logger
from updatebot.pkgsource import rpmSource

log = logger.addRootLogger()

path = sys.argv[2]

obj = RpmDirectoryIndexer(cfg, path)
obj.loadFromUrl(sys.argv[2], basePath=sys.argv[3])

nv = [x for x in obj.iterPackageSet()]

import epdb

epdb.st()
Example #9
0
        sys.path.insert(0, os.environ['CONARY_PATH'])

    import rmake
    import conary
    import updatebot

    print >> sys.stderr, 'using conary from', os.path.dirname(conary.__file__)
    print >> sys.stderr, 'using rmake from', os.path.dirname(rmake.__file__)
    print >> sys.stderr, 'using updatebot from', os.path.dirname(
        updatebot.__file__)

    from conary.lib import util
    sys.excepthook = util.genExcepthook()

    from updatebot import log as logSetup
    logSetup.addRootLogger()

import logging

from updatebot import OrderedBot

log = logging.getLogger('scripts.testgroup')


class Bot(OrderedBot):
    def generateInitialGroup(self):
        """
        Generate config for standard group contents based on repository history.
        """

        #        self._pkgSource.load()
Example #10
0
sys.path.insert(0, os.environ['HOME'] + '/hg/conary')
sys.path.insert(0, os.environ['HOME'] + '/hg/xobj/py')
sys.path.insert(0, os.environ['HOME'] + '/hg/rbuilder-trunk/rpath-xmllib')

from conary.lib import util
sys.excepthook = util.genExcepthook()

from conary.deps import deps

mbdir = os.path.abspath('../')
sys.path.insert(0, mbdir)

from updatebot import log
from updatebot import groupmgr

slog = log.addRootLogger()

def toxml(pkgList, toFile):
    groupName = 'group-rhel-standard'
    byDefault = True
    depCheck = True

    contents = groupmgr.GroupContentsModel(groupName,
                                           byDefault=byDefault,
                                           depCheck=depCheck)

    for pkg in pkgList:
        slog.info('adding %s' % (pkg, ))
        if type(pkg) == tuple:
            pkg, flavor = pkg
            contents.add(pkg, flavor=deps.parseFlavor(flavor))
Example #11
0
            cfg = config.UpdateBotConfig()
            cfg.read(conf)
            platformConfigs.append(cfg)
    return platformConfigs


def display(cfg, pkg, nvfs):
    print cfg.platformName, cfg.upstreamProductVersion
    for nvf in nvfs:
        print '  %s=%s[%s]' % nvf


if len(sys.argv) != 2:
    usage()

log.addRootLogger()

pkgName = sys.argv[1]
platforms = getPlatformConfigs(os.path.join(mirrorballDir, 'config'))

results = []
for cfg in platforms:
    helper = conaryhelper.ConaryHelper(cfg)
    spec = (pkgName, cfg.targetLabel, None)

    try:
        nvf = helper.findTrove(spec)
    except:
        nvf = []

    if nvf:
Example #12
0
        conf = os.path.join(cfgDir, dname, 'updatebotrc')
        if os.path.exists(conf):
            cfg = config.UpdateBotConfig()
            cfg.read(conf)
            platformConfigs.append(cfg)
    return platformConfigs

def display(cfg, pkg, nvfs):
    print cfg.platformName, cfg.upstreamProductVersion
    for nvf in nvfs:
        print '  %s=%s[%s]' % nvf

if len(sys.argv) != 2:
    usage()

log.addRootLogger()

pkgName = sys.argv[1]
platforms = getPlatformConfigs(os.path.join(mirrorballDir, 'config'))

results = []
for cfg in platforms:
    helper = conaryhelper.ConaryHelper(cfg)
    spec = (pkgName, cfg.targetLabel, None)

    try:
        nvf = helper.findTrove(spec)
    except:
        nvf = []

    if nvf:
Example #13
0
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#


"""
Script for walking a tree of rpms and building the metadata needed to detect
repository state based on the contents of such a directory.
"""

from header import *

from updatebot import log as logger
from updatebot.pkgsource import rpmSource

log = logger.addRootLogger()

path = sys.argv[2]

obj = RpmDirectoryIndexer(cfg, path)
obj.loadFromUrl(sys.argv[2], basePath=sys.argv[3])

nv = [ x for x in obj.iterPackageSet() ]

import epdb; epdb.st()
Example #14
0
from conary.lib import util
sys.excepthook = util.genExcepthook()

mbdir = os.path.abspath('../')
sys.path.insert(0, mbdir)

confDir = os.path.join(mbdir, 'config', sys.argv[1])

from updatebot import log
from updatebot import Bot
from updatebot import UpdateBotConfig

import time
import logging

slog = log.addRootLogger()
cfg = UpdateBotConfig()
cfg.read(os.path.join(confDir, 'updatebotrc'))

bot = Bot(cfg)

from updatebot import groupmgr

versionFactory = groupmgr.VersionFactory(cfg)
pkgset = bot._updater.getSourceVersionMap()
sources = set([ (x, y.trailingRevision().getVersion())
                for x, y in pkgset.iteritems() ])

match = versionFactory.getVersions(sources)

import epdb; epdb.st()