示例#1
0
文件: runner.py 项目: lool/buildbot
def sendchange(config, runReactor=False):
    """Send a single change to the buildmaster's PBChangeSource. The
    connection will be drpoped as soon as the Change has been sent."""
    from buildbot.clients.sendchange import Sender

    user = config.get('username')
    master = config.get('master')
    branch = config.get('branch')
    category = config.get('category')
    revision = config.get('revision')
    properties = config.get('properties', {})
    repository = config.get('repository', '')
    project = config.get('project', '')
    revlink = config.get('revlink', '')
    if config.get('when'):
        when = float(config.get('when'))
    else:
        when = None
    if config.get("revision_file"):
        revision = open(config["revision_file"],"r").read()

    comments = config.get('comments')
    if not comments and config.get('logfile'):
        if config['logfile'] == "-":
            f = sys.stdin
        else:
            f = open(config['logfile'], "rt")
        comments = f.read()
    if comments is None:
        comments = ""

    files = config.get('files', [])

    assert user, "you must provide a username"
    assert master, "you must provide the master location"

    s = Sender(master, user)
    d = s.send(branch, revision, comments, files, category=category, when=when,
               properties=properties, repository=repository, project=project,
               revlink=revlink)
    if runReactor:
        status = [True]
        def failed(res):
            status[0] = False
            s.printFailure(res)
        d.addCallbacks(s.printSuccess, failed)
        d.addBoth(s.stop)
        s.run()
        return status[0]
    return d
示例#2
0
def sendchange(config, runReactor=False):
    """Send a single change to the buildmaster's PBChangeSource. The
    connection will be drpoped as soon as the Change has been sent."""
    from buildbot.clients.sendchange import Sender

    user = config.get('username')
    master = config.get('master')
    branch = config.get('branch')
    category = config.get('category')
    revision = config.get('revision')
    properties = config.get('properties', {})
    repository = config.get('repository', '')
    project = config.get('project', '')
    if config.get('when'):
        when = float(config.get('when'))
    else:
        when = None
    if config.get("revision_file"):
        revision = open(config["revision_file"], "r").read()

    comments = config.get('comments')
    if not comments and config.get('logfile'):
        if config['logfile'] == "-":
            f = sys.stdin
        else:
            f = open(config['logfile'], "rt")
        comments = f.read()
    if comments is None:
        comments = ""

    files = config.get('files', [])

    assert user, "you must provide a username"
    assert master, "you must provide the master location"

    s = Sender(master, user)
    d = s.send(branch,
               revision,
               comments,
               files,
               category=category,
               when=when,
               properties=properties,
               repository=repository,
               project=project)
    if runReactor:
        d.addCallbacks(s.printSuccess, s.printFailure)
        d.addBoth(s.stop)
        s.run()
    return d
示例#3
0
def sendchange(config, runReactor=False):
    """Send a single change to the buildmaster's PBChangeSource. The
    connection will be drpoped as soon as the Change has been sent."""
    from buildbot.clients.sendchange import Sender

    opts = loadOptions()
    user = config.get('username', opts.get('username'))
    master = config.get('master', opts.get('master'))
    branch = config.get('branch', opts.get('branch'))
    category = config.get('category', opts.get('category'))
    revision = config.get('revision')
    properties = config.get('properties', {})
    if config.get('when'):
        when = float(config.get('when'))
    else:
        when = None
    # SVN and P4 use numeric revisions
    if config.get("revision_number"):
        revision = int(config['revision_number'])
    if config.get("revision_file"):
        revision = open(config["revision_file"],"r").read()

    comments = config.get('comments')
    if not comments and config.get('logfile'):
        if config['logfile'] == "-":
            f = sys.stdin
        else:
            f = open(config['logfile'], "rt")
        comments = f.read()
    if comments is None:
        comments = ""

    files = config.get('files', [])

    assert user, "you must provide a username"
    assert master, "you must provide the master location"

    s = Sender(master, user)
    d = s.send(branch, revision, comments, files, category=category, when=when,
               properties=properties)
    if runReactor:
        d.addCallbacks(s.printSuccess, s.printFailure)
        d.addBoth(s.stop)
        s.run()
    return d
def sendchange(config, runReactor=False):
    """Send a single change to the buildmaster's PBChangeSource. The
    connection will be drpoped as soon as the Change has been sent."""
    from buildbot.clients.sendchange import Sender

    opts = loadOptions()
    user = config.get('username', opts.get('username'))
    master = config.get('master', opts.get('master'))
    branch = config.get('branch', opts.get('branch'))
    revision = config.get('revision')
    # SVN and P4 use numeric revisions
    if config.get("revision_number"):
        revision = int(config['revision_number'])
    if config.get("revision_file"):
        revision = open(config["revision_file"],"r").read()

    comments = config.get('comments')
    if not comments and config.get('logfile'):
        if config['logfile'] == "-":
            f = sys.stdin
        else:
            f = open(config['logfile'], "rt")
        comments = f.read()
    if comments is None:
        comments = ""

    files = config.get('files', [])

    assert user, "you must provide a username"
    assert master, "you must provide the master location"

    s = Sender(master, user)
    d = s.send(branch, revision, comments, files)
    if runReactor:
        d.addCallbacks(s.printSuccess, s.printFailure)
        d.addBoth(s.stop)
        s.run()
    return d
示例#5
0
def sendchange(config, runReactor=False):
    """Send a single change to the buildmaster's PBChangeSource. The
    connection will be drpoped as soon as the Change has been sent."""
    from buildbot.clients.sendchange import Sender

    who = config.get('who')
    if not who and config.get('username'):
        print "NOTE: --username/-u is deprecated: use --who/-W'"
        who = config.get('username')
    auth = config.get('auth')
    master = config.get('master')
    branch = config.get('branch')
    category = config.get('category')
    revision = config.get('revision')
    properties = config.get('properties', {})
    repository = config.get('repository', '')
    project = config.get('project', '')
    revlink = config.get('revlink', '')
    if config.get('when'):
        when = float(config.get('when'))
    else:
        when = None
    if config.get("revision_file"):
        revision = open(config["revision_file"], "r").read()

    comments = config.get('comments')
    if not comments and config.get('logfile'):
        if config['logfile'] == "-":
            f = sys.stdin
        else:
            f = open(config['logfile'], "rt")
        comments = f.read()
    if comments is None:
        comments = ""

    files = config.get('files', [])

    # fix up the auth with a password if none was given
    if not auth:
        auth = 'change:changepw'
    if ':' not in auth:
        import getpass
        pw = getpass.getpass("Enter password for '%s': " % auth)
        auth = "%s:%s" % (auth, pw)
    auth = auth.split(':', 1)

    assert who, "you must provide a committer (--who)"
    assert master, "you must provide the master location"

    s = Sender(master, auth)
    d = s.send(branch,
               revision,
               comments,
               files,
               who=who,
               category=category,
               when=when,
               properties=properties,
               repository=repository,
               project=project,
               revlink=revlink)
    if runReactor:
        status = [True]

        def failed(res):
            status[0] = False
            s.printFailure(res)

        d.addCallbacks(s.printSuccess, failed)
        d.addBoth(s.stop)
        s.run()
        return status[0]
    return d
示例#6
0
def sendchange(config, runReactor=False):
    """Send a single change to the buildmaster's PBChangeSource. The
    connection will be drpoped as soon as the Change has been sent."""
    from buildbot.clients.sendchange import Sender

    who = config.get('who')
    if not who and config.get('username'):
        print "NOTE: --username/-u is deprecated: use --who/-W'"
        who = config.get('username')
    auth = config.get('auth')
    master = config.get('master')
    branch = config.get('branch')
    category = config.get('category')
    revision = config.get('revision')
    properties = config.get('properties', {})
    repository = config.get('repository', '')
    project = config.get('project', '')
    revlink = config.get('revlink', '')
    if config.get('when'):
        when = float(config.get('when'))
    else:
        when = None
    if config.get("revision_file"):
        revision = open(config["revision_file"],"r").read()

    comments = config.get('comments')
    if not comments and config.get('logfile'):
        if config['logfile'] == "-":
            f = sys.stdin
        else:
            f = open(config['logfile'], "rt")
        comments = f.read()
    if comments is None:
        comments = ""

    files = config.get('files', [])

    # fix up the auth with a password if none was given
    if not auth:
        auth = 'change:changepw'
    if ':' not in auth:
        import getpass
        pw = getpass.getpass("Enter password for '%s': " % auth)
        auth = "%s:%s" % (auth, pw)
    auth = auth.split(':', 1)

    assert who, "you must provide a committer (--who)"
    assert master, "you must provide the master location"

    s = Sender(master, auth)
    d = s.send(branch, revision, comments, files, who=who, category=category, when=when,
               properties=properties, repository=repository, project=project,
               revlink=revlink)
    if runReactor:
        status = [True]
        def failed(res):
            status[0] = False
            s.printFailure(res)
        d.addCallbacks(s.printSuccess, failed)
        d.addBoth(s.stop)
        s.run()
        return status[0]
    return d