pypy-effect-analysis / pypy / tool / release /


Force the PyPy buildmaster to run a builds on all builders that produce
nightly builds for a particular branch.

Taken from

modified by PyPy team

import os, sys, pwd, urllib

from twisted.internet import reactor, defer
from twisted.python import log
from twisted.web import client
from twisted.web.error import PageRedirect

#    'own-macosx-x86-32',
#    'pypy-c-app-level-linux-x86-32',
#    'pypy-c-app-level-linux-x86-64',
#    'pypy-c-jit-macosx-x86-32',

def main():
    branch = sys.argv[1]
    if (not branch.startswith('/branch/') and not branch.startswith('/tag/') and
        not branch.startswith('/release/')):
        branch = '/branch/' + branch

    lock = defer.DeferredLock()
    requests = []
    def ebList(err):
        if err.check(PageRedirect) is not None:
            return None
        log.err(err, "Build force failure")

    for builder in BUILDERS:
        print 'Forcing', builder, '...'
        url = "" + builder + "/force"
        args = [
            ('username', pwd.getpwuid(os.getuid())[0]),
            ('revision', ''),
            ('submit', 'Force Build'),
            ('branch', branch),
            ('comments', "Forced by command line script")]
        url = url + '?' + '&'.join([k + '=' + urllib.quote(v) for (k, v) in args])
  , url, followRedirect=False).addErrback(ebList))

    d = defer.gatherResults(requests)
    d.addCallback(lambda ign: reactor.stop())
    print 'See after a while'

if __name__ == '__main__':