Esempio n. 1
0
 def resetLogging(self, quiet=False, verbose=False, fileLevel=logging.DEBUG):
     if self.newLogger:
         if verbose:
             level = logging.DEBUG
         elif quiet:
             level = logging.ERROR
         else:
             level = logging.INFO
         mintutils.setupLogging(self.logPath, consoleLevel=level,
                 fileLevel=fileLevel)
         # Set the conary logger to not eat messages
         logger.setLevel(logging.NOTSET)
     else:
         self._resetLogging()
Esempio n. 2
0
def process(repos, cfg, commitList, srcMap, pkgMap, grpMap, argv, otherArgs):
    coveragehook.install()
    if not len(argv) and not len(otherArgs):
        return 1

    mintutils.setupLogging(consoleLevel=logging.WARNING,
            consoleFormat='apache')
    
    argDef = {
        'config' : options.ONE_PARAM,
        'user': options.ONE_PARAM,
        'hostname': options.ONE_PARAM,
    }

    # create an argv[0] for processArgs to ignore
    argv[0:0] = ['']
    argSet, someArgs = options.processArgs(argDef, {}, cfg, '', argv=argv)
    # and now remove argv[0] again
    argv.pop(0)
    if len(someArgs):
        someArgs.pop(0)
    otherArgs.extend(someArgs)

    # Double-fork so the commit hook doesn't block the caller.
    if os.fork():
        return 0

    try:
        if not os.fork():
            try:
                registerCommits(argSet, commitList)
            except:
                e_type, e_value, e_tb = sys.exc_info()
                logErrorAndEmail(None, e_type, e_value, e_tb, 'commit hook',
                        argSet)
    finally:
        os._exit(0)