thunderbird/mozillabuild.py
author Ben Hearsum <bhearsum@mozilla.com>
Wed, 14 Mar 2012 09:03:29 -0400
branchproduction
changeset 5621 53bfbe81c13af8eec4791d170c5fb1c475d0716b
parent 3369 1410cd562df6eb18f7ec02c4aab0869920b1dc5d
permissions -rw-r--r--
Added tag FENNEC_12_0b1_RELEASE, FENNEC_12_0b1_BUILD1 for changeset fc8d6714880f

def getConfig(defaults, branch, value, default=None):
    return branch.get(value, defaults.get(value, default))

import buildbotcustom.changes.hgpoller
from buildbotcustom.changes.hgpoller import HgAllLocalesPoller, HgPoller

def setupHGPollersFromBranches(defaults, branches, change_source):
    # Figure out the unique pushlogs we should be polling
    
    sources = {}
    l10n = False 
    for name in branches.keys():
        branch = branches[name]
        hgurl = getConfig(defaults, branch, 'hgurl')
        if getConfig(defaults, branch, 'l10n'):
            l10n = True
        
        #Make sure the hg url doesn't have a trailing '/', we'll be adding one
        if hgurl[-1:] == '/':
            hgurl = hgurl[:-1]
        poll_branch = getConfig(defaults, branch, 'hg_branch')
        for b in [poll_branch] + [getConfig(defaults, branch, 'mozilla_central_branch')] + getConfig(defaults, branch, 'add_poll_branches'):
            if not sources.get(poll_branch):
                sources[poll_branch] = {}
            sources[poll_branch][b] = 1

    for branch in sorted(sources.keys()):
        for poll in sorted(sources[branch].keys()):
            pushlog = "%s/%s/json-pushes?full=1" % (hgurl, poll)
            change_source.append(HgPoller(
                hgURL="%s/" % hgurl,
                pushlogUrlOverride=pushlog,
                branch=branch,
                pollInterval=1*60
            ))
        
from buildbot.steps.shell import ShellCommand, WithProperties
def uploadUpdateSnippet(f, aus, platform):
    full_upload_dir = '%s/%s/%%(buildid)s/en-US' % \
        ( aus['base_upload_dir'],
          platform['update_platform'])

    f.addStep(ShellCommand(
        name='create aus2 upload dir',
        command=['ssh', '-l', aus['user'], aus['host'],
             WithProperties('mkdir -p %s' % full_upload_dir)],
        description=['create', 'aus2', 'upload', 'dir'],
        haltOnFailure=False,
        flunkOnFailure=False,
    ))

    f.addStep(ShellCommand(
        name='upload complete snippet',
        command=['scp', '-o', 'User=%s' % aus['user'],
             'dist/update/complete.update.snippet',
             WithProperties('%s:%s/complete.txt' % \
               (aus['host'], full_upload_dir))],
        workdir='build/%s/mozilla' % platform['platform_objdir'],
        description=['upload', 'complete', 'snippet'],
        haltOnFailure=False,
        flunkOnFailure=False,
    ))