Example #1
0
    def excepthook(e_type, e_value, e_traceback):
        """Exception hook wrapper"""
        checkoutRoot = _findCheckoutRoot()
        outputDir = None
        if checkoutRoot:
            #pylint: disable-msg=W0702
            # No exception type(s) specified - a generic handler is
            # warranted as this is in an exception handler.
            try:
                outputDir = checkoutRoot + '/.rbuild/tracebacks'
                if not os.path.exists(outputDir):
                    os.mkdir(outputDir, 0700)
                elif not os.access(outputDir, os.W_OK):
                    outputDir = None
            except:
                # fall back gracefully if we can't create the directory
                outputDir = None

        if outputDir:
            baseHook = util.genExcepthook(error=_ERROR_MESSAGE,
                prefix=outputDir + '/rbuild-error-', *args, **kw)
        else:
            baseHook = util.genExcepthook(error=_ERROR_MESSAGE,
                prefix='rbuild-error-', *args, **kw)

        baseHook(e_type, e_value, e_traceback)
Example #2
0
    def excepthook(e_type, e_value, e_traceback):
        """Exception hook wrapper"""
        checkoutRoot = _findCheckoutRoot()
        outputDir = None
        if checkoutRoot:
            #pylint: disable-msg=W0702
            # No exception type(s) specified - a generic handler is
            # warranted as this is in an exception handler.
            try:
                outputDir = checkoutRoot + '/.rbuild/tracebacks'
                if not os.path.exists(outputDir):
                    os.mkdir(outputDir, 0700)
                elif not os.access(outputDir, os.W_OK):
                    outputDir = None
            except:
                # fall back gracefully if we can't create the directory
                outputDir = None

        if outputDir:
            baseHook = util.genExcepthook(error=_ERROR_MESSAGE,
                prefix=outputDir + '/rbuild-error-', *args, **kw)
        else:
            baseHook = util.genExcepthook(error=_ERROR_MESSAGE,
                prefix='rbuild-error-', *args, **kw)

        baseHook(e_type, e_value, e_traceback)
Example #3
0
def main(argv=None, individual=True, handlerClass=ConaryTestSuiteHandler,
         handlerKw={}):
    global _handler
    global _individual
    _individual = individual
    if argv is None:
        argv = list(sys.argv)
    topdir = testhelp.getTestPath()
    if topdir not in sys.path:
        sys.path.insert(0, topdir)
    cwd = os.getcwd()
    if cwd != topdir and cwd not in sys.path:
        sys.path.insert(0, cwd)

    setup()
    from conary.lib import util
    from conary.lib import coveragehook
    sys.excepthook = util.genExcepthook(True, catchSIGUSR1=False)
    kw = dict(individual=individual, topdir=topdir,
              testPath=testPath, conaryDir=conaryDir)
    kw.update(handlerKw)
    handler = handlerClass(**kw)
    print "This process PID:", os.getpid()
    _handler = handler
    results = handler.main(argv)
    if results is None:
        sys.exit(0)
    sys.exit(not results.wasSuccessful())
Example #4
0
def main(argv=None):
    if argv is None:
        argv = sys.argv
    sys.stdout = util.FileIgnoreEpipe(sys.stdout)
    try:
        argv = list(argv)
        debugAll = '--debug-all' in argv
        if debugAll:
            debuggerException = Exception
            argv.remove('--debug-all')
        else:
            debuggerException = errors.InternalConaryError

        cvcMain = CvcMain()
        ccfg = cvcMain.getConfigFile(argv)
        if debugAll:
            ccfg.debugExceptions = True
            ccfg.debugRecipeExceptions = True

        # reset the excepthook (using cfg values for exception settings)
        sys.excepthook = util.genExcepthook(debug=ccfg.debugExceptions,
                                            debugCtrlC=debugAll)
        return cvcMain.main(argv,
                            debuggerException,
                            debugAll=debugAll,
                            cfg=ccfg)
    except debuggerException:
        raise
    except (errors.ConaryError, errors.CvcError, cfg.CfgError,
            openpgpfile.PGPError), e:
        if str(e):
            log.error(str(e))
            sys.exit(2)
        else:
            raise
Example #5
0
    def setupCoverageHooks(self):
        from conary.lib import util
        sys.excepthook = util.genExcepthook(True,
            catchSIGUSR1 = self.catchSIGUSR1)

        # Coverage hooks
        from conary.lib import coveragehook
Example #6
0
    def excepthook(e_type, e_value, e_traceback):
        """Exception hook wrapper"""
        logger.error("An exception has occurred: %s", e_value)
        logger.error("%s", "".join(traceback.format_tb(e_traceback)))
        baseHook = util.genExcepthook(error=_ERROR_MESSAGE, prefix="forester-error-", *args, **kw)

        baseHook(e_type, e_value, e_traceback)
Example #7
0
def main(argv=None):
    if argv is None:
        argv = sys.argv
    sys.stdout = util.FileIgnoreEpipe(sys.stdout)
    try:
        argv = list(argv)
        debugAll = '--debug-all' in argv
        if debugAll:
            debuggerException = Exception
            argv.remove('--debug-all')
        else:
            debuggerException = errors.InternalConaryError

        cvcMain = CvcMain()
        ccfg = cvcMain.getConfigFile(argv)
        if debugAll:
            ccfg.debugExceptions = True
            ccfg.debugRecipeExceptions = True

        # reset the excepthook (using cfg values for exception settings)
        sys.excepthook = util.genExcepthook(debug=ccfg.debugExceptions,
                                            debugCtrlC=debugAll)
        return cvcMain.main(argv, debuggerException, debugAll=debugAll,
                            cfg=ccfg)
    except debuggerException:
        raise
    except (errors.ConaryError, errors.CvcError, cfg.CfgError,
            openpgpfile.PGPError), e:
        if str(e):
            log.error(str(e))
            sys.exit(2)
        else:
            raise
Example #8
0
    def excepthook(e_type, e_value, e_traceback):
        """Exception hook wrapper"""
        logger.error("An exception has occurred: %s" % e_value)
        logger.error(''.join(traceback.format_tb(e_traceback)))
        baseHook = util.genExcepthook(error=_ERROR_MESSAGE,
            prefix='rpath-tools-error-', *args, **kw)

        baseHook(e_type, e_value, e_traceback)
Example #9
0
    def runCommand(self, thisCommand, cfg, argSet, args, debugAll=False):
        client = conaryclient.ConaryClient(cfg)
        repos = client.getRepos()
        callback = commit.CheckinCallback(cfg)

        if not cfg.buildLabel and cfg.installLabelPath:
            cfg.buildLabel = cfg.installLabelPath[0]

        sys.excepthook = util.genExcepthook(debug=cfg.debugExceptions,
                                            debugCtrlC=debugAll)

        if cfg.installLabelPath:
            cfg.installLabel = cfg.installLabelPath[0]
        else:
            cfg.installLabel = None

        cfg.initializeFlavors()
        log.setMinVerbosity(log.INFO)
        log.resetErrorOccurred()

        # set the build flavor here, just to set architecture information
        # which is used when initializing a recipe class
        use.setBuildFlagsFromFlavor(None, cfg.buildFlavor, error=False)

        profile = False
        if argSet.has_key('lsprof'):
            import cProfile
            prof = cProfile.Profile()
            prof.enable()
            profile = 'lsprof'
            del argSet['lsprof']

        keyCache = openpgpkey.getKeyCache()
        keyCache.setPublicPath(cfg.pubRing)
        repos = conaryclient.ConaryClient(cfg).getRepos()
        keyCacheCallback = openpgpkey.KeyCacheCallback(repos, cfg)
        keyCache.setCallback(keyCacheCallback)

        try:
            rv = options.MainHandler.runCommand(self,
                                                thisCommand,
                                                cfg,
                                                argSet,
                                                args,
                                                callback=callback,
                                                repos=client.getRepos(),
                                                profile=profile)
        finally:
            if profile == 'lsprof':
                prof.disable()
                prof.dump_stats('cvc.lsprof')
                prof.print_stats()
            elif profile:
                prof.stop()

        if log.errorOccurred():
            sys.exit(2)
        return rv
Example #10
0
    def runCommand(self, thisCommand, cfg, argSet, args, debugAll=False):
        client = conaryclient.ConaryClient(cfg)
        repos = client.getRepos()
        callback = commit.CheckinCallback(cfg)

        if not cfg.buildLabel and cfg.installLabelPath:
            cfg.buildLabel = cfg.installLabelPath[0]

        sys.excepthook = util.genExcepthook(debug=cfg.debugExceptions,
                                            debugCtrlC=debugAll)

        if cfg.installLabelPath:
            cfg.installLabel = cfg.installLabelPath[0]
        else:
            cfg.installLabel = None

        cfg.initializeFlavors()
        log.setMinVerbosity(log.INFO)
        log.resetErrorOccurred()

        # set the build flavor here, just to set architecture information
        # which is used when initializing a recipe class
        use.setBuildFlagsFromFlavor(None, cfg.buildFlavor, error=False)

        profile = False
        if argSet.has_key('lsprof'):
            import cProfile
            prof = cProfile.Profile()
            prof.enable()
            profile = 'lsprof'
            del argSet['lsprof']

        keyCache = openpgpkey.getKeyCache()
        keyCache.setPublicPath(cfg.pubRing)
        repos = conaryclient.ConaryClient(cfg).getRepos()
        keyCacheCallback = openpgpkey.KeyCacheCallback(repos,
                                                       cfg)
        keyCache.setCallback(keyCacheCallback)

        try:
            rv = options.MainHandler.runCommand(self, thisCommand,
                                                cfg, argSet, args,
                                                callback=callback,
                                                repos=client.getRepos(),
                                                profile=profile)
        finally:
            if profile == 'lsprof':
                prof.disable()
                prof.dump_stats('cvc.lsprof')
                prof.print_stats()
            elif profile:
                prof.stop()

        if log.errorOccurred():
            sys.exit(2)
        return rv
Example #11
0
def main(argv=[], individual=True, handlerClass=TestSuiteHandler):
    from conary.lib import util
    sys.excepthook = util.genExcepthook(True, catchSIGUSR1=False)
    handler = handlerClass(individual=individual, topdir=getTestPath(),
                           testPath=getTestPath(), conaryDir=getConaryDir())
    print "This process PID:", os.getpid()
    results = handler.main(argv)
    if results is None:
        sys.exit(0)
    sys.exit(not results.wasSuccessful())
Example #12
0
def main(argv):
    d = rMakeDaemon()
    if '--debug-all' or '-d' in argv:
        sys.excepthook = util.genExcepthook(debug=True, debugCtrlC=True)
    try:
        compat.checkRequiredVersions()
        rc = d.mainWithExceptionHandling(argv)
        return rc
    except options.OptionError, err:
        d.usage()
        d.logger.error(err)
        return 1
Example #13
0
def main(argv):
    d = rMakeDaemon()
    if '--debug-all' or '-d' in argv:
        sys.excepthook = util.genExcepthook(debug=True, debugCtrlC=True)
    try:
        compat.checkRequiredVersions()
        rc = d.mainWithExceptionHandling(argv)
        return rc
    except options.OptionError, err:
        d.usage()
        d.logger.error(err)
        return 1
Example #14
0
def main(args=sys.argv[1:]):
    banner()

    parser = optparse.OptionParser(
            usage='Usage: %prog <plan file or URI> [options]',
            version='%prog ' + bob_version.version
            )
    parser.add_option('--set-tag', action='append',
            help='tree=revision')
    parser.add_option('--set-version', action='append',
            help='package=version')
    parser.add_option('--debug', action='store_true')
    options, args = parser.parse_args(args)

    msg = """
%(filename)s:%(lineno)s
%(errtype)s: %(errmsg)s

The complete related traceback has been saved as %(stackfile)s
"""
    cny_hook = cny_util.genExcepthook(
            debug=options.debug,
            prefix='bob-error-',
            error=msg,
            )
    def excepthook(e_class, e_val, e_tb):
        if not options.debug:
            cny_util.formatTrace(e_class, e_val, e_tb, withLocals=False)
        return cny_hook(e_class, e_val, e_tb)
    sys.excepthook = excepthook

    if not args:
        parser.error('A plan file or URI is required')
    planFile = args[0]
    plan = config.openPlan(planFile)

    for val in (options.set_tag or ()):
        name, tag = val.split('=', 1)
        scm = plan.scm.get(name)
        if not scm:
            raise KeyError("scm %r is not in the plan file" % (name,))
        kind, uri = scm.split(' ', 1)
        if ' ' in uri:
            uri = uri.split(' ')[0]
        plan.scm[name] = ' '.join((kind, uri, tag))

    for val in (options.set_version or ()):
        name, version = val.split('=', 1)
        section = plan.setSection('target:' + name)
        section.version = version

    return _main(plan)
Example #15
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 #16
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 #17
0
def main(argv=None, individual=True):
    if argv is None:
        argv = list(sys.argv)

    from conary.lib import util
    from conary.lib import coveragehook  # pyflakes=ignore
    sys.excepthook = util.genExcepthook(True, catchSIGUSR1=False)

    from robj.lib import log
    log.setupLogging()

    handlerClass = testhelp.getHandlerClass(testhelp.ConaryTestSuite,
            lambda handler, environ: os.getenv('ROBJ_PATH'),
            lambda handler, environ: EXCLUDED_PATHS)

    handler = handlerClass(individual=individual)
    results = handler.main(argv)
    return results.getExitCode()
Example #18
0
    def main(self,
             argv=None,
             debuggerException=Exception,
             cfg=None,
             debugAll=False,
             **kw):
        """
            Process argv and execute commands as specified.
        """
        if argv is None:
            argv = sys.argv
        from conary import versions
        supportedCommands = self._supportedCommands

        if '--version' in argv:
            print self.version
            return

        if cfg is None:
            cfg = self.getConfigFile(argv)

        # get the default setting for exception debugging from the
        # config object (if it has a setting).
        debug = getattr(cfg, 'debugExceptions', False)
        if debugAll:
            if hasattr(cfg, 'debugExceptions'):
                cfg.debugExceptions = True
            debug = True
        if self.setSysExcepthook:
            sys.excepthook = util.genExcepthook(debug=debug,
                                                debugCtrlC=debugAll)

        try:
            argSet, argv = self._getPreCommandOptions(argv, cfg)
        except debuggerException:
            raise
        except options.OptionError, e:
            self.usage()
            print >> sys.stderr, e
            sys.exit(e.val)
Example #19
0
    def main(self, argv=None, debuggerException=Exception, cfg=None,
             debugAll=False, **kw):
        """
            Process argv and execute commands as specified.
        """
        if argv is None:
            argv=sys.argv
        from conary import versions
        supportedCommands = self._supportedCommands

        if '--version' in argv:
            print self.version
            return

        if cfg is None:
            cfg = self.getConfigFile(argv)

        # get the default setting for exception debugging from the
        # config object (if it has a setting).
        debug = getattr(cfg, 'debugExceptions', False)
        if debugAll:
            if hasattr(cfg, 'debugExceptions'):
                cfg.debugExceptions = True
            debug = True
        if self.setSysExcepthook:
            sys.excepthook = util.genExcepthook(debug=debug,
                                                debugCtrlC=debugAll)

        try:
            argSet, argv = self._getPreCommandOptions(argv, cfg)
        except debuggerException:
            raise
        except options.OptionError, e:
            self.usage()
            print >>sys.stderr, e
            sys.exit(e.val)
Example #20
0
            if argSet.has_key(arg):
                cfg.configLine("%s %s" % (name, argSet[arg]))
                del argSet[arg]

    if addVerboseOptions:
        if 'verbose' in argSet:
            if argSet['verbose'] is True:
                log.setVerbosity(log.INFO)
            del argSet['verbose']

    if addDebugOptions:
        if argSet.has_key('debugger'):
            del argSet['debugger']
            from conary.lib import debugger
            debugger.set_trace()
            sys.excepthook = util.genExcepthook(debug=cfg.debugExceptions,
                                                debugCtrlC=True)

        if 'debug' in argSet:
            if argSet['debug'] is True:
                log.setVerbosity(log.DEBUG)
            else:
                log.setVerbosity(log.LOWLEVEL)
            del argSet['debug']
        else:
            if log.getVerbosity() > log.WARNING:
                log.setVerbosity(log.WARNING)

    return argSet, otherArgs, parser, options


def getOptionParser(params,
Example #21
0
            self.storagePath).latest(filter=self.latestFilter)
        if latest is None:
            raise NoUpdatesFound
        return latest

    def load(self, key):
        update = self.factory(self.storagePath).load(key)
        if update is None:
            raise NoUpdatesFound
        return update

    def _getUpdateJobDir(self):
        return self.updateSet.updateJobDir

    updateJobDir = property(_getUpdateJobDir)


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

    fileName = sys.argv[1]
    try:
        with open(fileName) as f:
            blob = f.read()
    except EnvironmentError:
        print 'oops'

    sysmod = UpdateModel(blob)
    sysmod.debug()
Example #22
0
def main(argv):
    if not len(argv) > 1:
        usage()

    sys.excepthook = util.genExcepthook(prefix='commitaction-stack-')

    argDef = {
        'module': options.MULT_PARAM,
        'config-file': options.ONE_PARAM,
        'config': options.MULT_PARAM,
        'username': options.OPT_PARAM,
        'password': options.OPT_PARAM,
        'repmap': options.OPT_PARAM,
    }

    cfgMap = {
        'build-label': 'buildLabel',
    }

    cfg = conarycfg.ConaryConfiguration()
    cfg.root = ":memory:"
    cfg.dbPath = ":memory:"
    argSet, otherArgs = options.processArgs(argDef, cfgMap, cfg, usageMessage,
                                            argv=argv)


    # remove argv[0]
    otherArgs = otherArgs[1:]

    if 'module' not in argSet:
        usage()

    for line in argSet.pop('config', []):
        cfg.configLine(line)

    if 'repmap' in argSet:
        # this is ONLY for accessing the committing repository
        host, url = argSet['repmap'].split(" ")
        cfg.repositoryMap.update({host: url})
        
        if 'username' in argSet and 'password' in argSet:
            cfg.user.addServerGlob(host, argSet['username'], argSet['password'])

    repos = ConaryClient(cfg).getRepos()

    data = [x[:-1] for x in sys.stdin.readlines()]

    # { 'pkg:source': [(version, shortversion), ...] }
    srcMap = {}
    # { 'pkg' { version: { flavor: [ component, ...] } } }
    pkgMap = {}
    # { 'group-foo' { version: set(flavor, ...) } }
    grpMap = {}

    # [1,2,3,4,5,6,...] -> [(1,2,3), (4,5,6), ...]
    commitList = zip(data, data[1:], data[2:])[::3]

    for name, version, flavor in commitList:
        if name[-7:] == ':source':
            # get full trailing version
            trailingVersion = versions.VersionFromString(
                version).trailingRevision().asString()
            # sources are not flavored
            l = srcMap.setdefault(name, [])
            l.append((version, trailingVersion))
        elif ':' in name:
            package, component = name.split(':')
            d = pkgMap.setdefault(package, {})
            d = d.setdefault(version, {})
            l = d.setdefault(flavor, [])
            l.append(component)
        elif name.startswith('group-'):
            d = grpMap.setdefault(name, {})
            s = d.setdefault(version, set())
            s.add(flavor)

    ret = 0
    for module in argSet['module']:
        argv = shlex.split(module)
        path = argv[0]
        dirname, name = os.path.split(path)
        if name.endswith('.py'):
            name = name[:-3]
        if dirname:
            searchPath = [dirname]
            try:
                f, pathName, description = imp.find_module(name, searchPath)
            except:
                break
            try:
                mod = imp.load_module(name, f, pathName, description)
            finally:
                f.close()
        else:
            try:
                mod = __import__(name)
                names = name.split('.')[1:]
                for subname in names:
                    mod = getattr(mod, subname)
            except:
                break

        # pass repos, cfg, and all otherArgs to all modules
        if 'process' in mod.__dict__:
            ret |= mod.process(repos, cfg, commitList, srcMap, pkgMap, grpMap,
                    argv[1:], otherArgs)

    return ret
Example #23
0
    for fd in fds.iterkeys():
        p.register(fd, select.POLLIN)

    logMe(1, "Server ready for requests")

    while True:
        try:
            events = p.poll()
            for (fd, event) in events:
                fds[fd].handle_request()
        except select.error:
            pass
        except:
            if profiler:
                profiler.disable()
                profiler.dump_stats('server.lsprof')
                print "exception happened, exiting"
                sys.exit(1)
            else:
                raise


def main():
    server, profiler = getServer()
    serve(server, profiler)


if __name__ == '__main__':
    sys.excepthook = util.genExcepthook(debug=True)
    main()
Example #24
0
def genExcepthook(*args, **kw):
    return util.genExcepthook(error=errorMessage,
                              prefix='rmake-error-',
                              *args,
                              **kw)
Example #25
0
            if argSet.has_key(arg):
                cfg.configLine("%s %s" % (name, argSet[arg]))
                del argSet[arg]

    if addVerboseOptions:
        if 'verbose' in argSet:
            if argSet['verbose'] is True:
                log.setVerbosity(log.INFO)
            del argSet['verbose']

    if addDebugOptions:
        if argSet.has_key('debugger'):
            del argSet['debugger']
            from conary.lib import debugger
            debugger.set_trace()
            sys.excepthook = util.genExcepthook(debug=cfg.debugExceptions,
                                                debugCtrlC=True)

        if 'debug' in argSet:
            if argSet['debug'] is True:
                log.setVerbosity(log.DEBUG)
            else:
                log.setVerbosity(log.LOWLEVEL)
            del argSet['debug']
        else:
            if log.getVerbosity() > log.WARNING:
                log.setVerbosity(log.WARNING)


    return argSet, otherArgs, parser, options

def getOptionParser(params, usage, version=None, useHelp=False,
Example #26
0
def main(argv):
    if not len(argv) > 1:
        usage()

    sys.excepthook = util.genExcepthook(prefix='commitaction-stack-')

    argDef = {
        'module': options.MULT_PARAM,
        'config-file': options.ONE_PARAM,
        'config': options.MULT_PARAM,
        'username': options.OPT_PARAM,
        'password': options.OPT_PARAM,
        'repmap': options.OPT_PARAM,
    }

    cfgMap = {
        'build-label': 'buildLabel',
    }

    cfg = conarycfg.ConaryConfiguration()
    cfg.root = ":memory:"
    cfg.dbPath = ":memory:"
    argSet, otherArgs = options.processArgs(argDef,
                                            cfgMap,
                                            cfg,
                                            usageMessage,
                                            argv=argv)

    # remove argv[0]
    otherArgs = otherArgs[1:]

    if 'module' not in argSet:
        usage()

    for line in argSet.pop('config', []):
        cfg.configLine(line)

    if 'repmap' in argSet:
        # this is ONLY for accessing the committing repository
        host, url = argSet['repmap'].split(" ")
        cfg.repositoryMap.update({host: url})

        if 'username' in argSet and 'password' in argSet:
            cfg.user.addServerGlob(host, argSet['username'],
                                   argSet['password'])

    repos = ConaryClient(cfg).getRepos()

    data = [x[:-1] for x in sys.stdin.readlines()]

    # { 'pkg:source': [(version, shortversion), ...] }
    srcMap = {}
    # { 'pkg' { version: { flavor: [ component, ...] } } }
    pkgMap = {}
    # { 'group-foo' { version: set(flavor, ...) } }
    grpMap = {}

    # [1,2,3,4,5,6,...] -> [(1,2,3), (4,5,6), ...]
    commitList = zip(data, data[1:], data[2:])[::3]

    for name, version, flavor in commitList:
        if name[-7:] == ':source':
            # get full trailing version
            trailingVersion = versions.VersionFromString(
                version).trailingRevision().asString()
            # sources are not flavored
            l = srcMap.setdefault(name, [])
            l.append((version, trailingVersion))
        elif ':' in name:
            package, component = name.split(':')
            d = pkgMap.setdefault(package, {})
            d = d.setdefault(version, {})
            l = d.setdefault(flavor, [])
            l.append(component)
        elif name.startswith('group-'):
            d = grpMap.setdefault(name, {})
            s = d.setdefault(version, set())
            s.add(flavor)

    ret = 0
    for module in argSet['module']:
        argv = shlex.split(module)
        path = argv[0]
        dirname, name = os.path.split(path)
        if name.endswith('.py'):
            name = name[:-3]
        if dirname:
            searchPath = [dirname]
            try:
                f, pathName, description = imp.find_module(name, searchPath)
            except:
                break
            try:
                mod = imp.load_module(name, f, pathName, description)
            finally:
                f.close()
        else:
            try:
                mod = __import__(name)
                names = name.split('.')[1:]
                for subname in names:
                    mod = getattr(mod, subname)
            except:
                break

        # pass repos, cfg, and all otherArgs to all modules
        if 'process' in mod.__dict__:
            ret |= mod.process(repos, cfg, commitList, srcMap, pkgMap, grpMap,
                               argv[1:], otherArgs)

    return ret
Example #27
0
def genExcepthook(*args, **kw):
    return util.genExcepthook(error=errorMessage,
                              prefix='rmake-error-', *args, **kw)
Example #28
0
resolveTroves \\
    conary-testenv=testbits.rb.rpath.com@rpath:conary-common \\
    info-bin=conary.rpath.com@rpl:2 \\
    info-daemon=conary.rpath.com@rpl:2 \\
    info-rmake-chroot=conary.rpath.com@rpl:2 \\
    info-sys=conary.rpath.com@rpl:2 \\
    testutils=%(testutils_label)s \\
    mod_python=%(contrib_py_label)s \\
    python-webunit=%(contrib_py_label)s \\
    python-conary=%(common_label)s

resolveTroves group-rpath-packages=%(common_label)s

resolveTroves group-os=%(distro_label)s

autoLoadRecipes group-superclasses=%(common_label)s[is:x86_64]

rpmRequirements trove: rpm-rhel-6:lib(RPM-RHEL-6)

installLabelpath %(distro_label)s %(common_label)s %(testutils_label)s %(testbits_label)s %(rndplat_label)s

defaultBuildReqs []
'''



if __name__ == '__main__':
    import sys
    sys.excepthook = conary_util.genExcepthook()

Example #29
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.
#


import os
import sys
import tempfile

from _scriptsetup import mirrorballDir

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

from updatebot import build
from updatebot import config

def usage():
    print 'usage: %s <platform> [pkg1, pkg2, ...]' % sys.argv[0]
    sys.exit(1)

if len(sys.argv) < 2 or sys.argv[1] not in os.listdir(mirrorballDir + '/config'):
    usage()

cfg = config.UpdateBotConfig()
cfg.read(mirrorballDir + '/config/%s/updatebotrc' % sys.argv[1])

from updatebot.cmdline import UserInterface
Example #30
0
    p = select.poll()
    for fd in fds.iterkeys():
        p.register(fd, select.POLLIN)

    logMe(1, "Server ready for requests")

    while True:
        try:
            events = p.poll()
            for (fd, event) in events:
                fds[fd].handle_request()
        except select.error:
            pass
        except:
            if profiler:
                profiler.disable()
                profiler.dump_stats('server.lsprof')
                print "exception happened, exiting"
                sys.exit(1)
            else:
                raise

def main():
    server, profiler = getServer()
    serve(server, profiler)

if __name__ == '__main__':
    sys.excepthook = util.genExcepthook(debug=True)
    main()