Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tag: FIREFOX_3_6_3_…
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 79 lines (66 sloc) 2.256 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
import re
import os.path

def buildTryCompleteMessage(attrs, packageDir, tinderboxTree):
    platform = ''
    task = ''
    identifier = ''
    who = ''
    builder = attrs['builderName']

    try:
        identifier = attrs['buildProperties']['identifier']
    except KeyError:
        identifier = 'unknown'
    try:
        who = attrs['buildProperties']['who']
    except KeyError:
        who = 'unknown'

    if 'Linux' in builder:
        platform = 'linux'
    elif 'OS X' in builder:
        platform = 'mac'
    elif 'WINNT' in builder:
        platform = 'win32'
    elif 'Maemo' in builder:
        platform = 'maemo'

    if 'unit test' in builder:
        task = 'unit test'
    elif 'talos' in builder:
        task = 'talos'
    else:
        task = 'build'

    url = packageDir % locals()

    if attrs['result'] == 'success':
        text = """\
Your Try Server %(task)s (%(identifier)s) was successfully completed on \
%(platform)s. """ % locals()
    elif attrs['result'] == 'warnings':
        text = """\
Your Try Server %(task)s (%(identifier)s) completed with warnings on \
%(platform)s. """ % locals()
    else:
        text = """\
Your Try Server %(task)s (%(identifier)s) failed to complete on \
%(platform)s.\n\n""" % locals()

    if attrs['result'] in ('success', 'warnings') and packageDir:
        text += "It should be available for download at %(url)s\n\n" % locals()

    if task == 'unit test':
        text += "Summary of unittest results:\n"
        for log in attrs['logs']:
            if 'summary' not in log[0]:
                continue
            summary = ''.join(log[2]).replace('TinderboxPrint: ', '')
            summary = summary.replace('<br/>', ': ')
            text += '%s\n' % summary
        text += '\n'

    elif task == 'talos':
        text += "Summary of talos results:\n"
        for log in attrs['logs']:
            if 'summary' not in log[0]:
                continue
            for line in summary:
                if '"test"' in line:
                    test = re.findall('>t[a-zA-Z]+: \d+\.[0-9a-zA-Z]+', line)[0]
                    text += '%s\n' % test
        text += '\n'

    text += """Visit %(tinderboxTree)s to view the full logs.""" % locals()

    return (text, 'plain')

Something went wrong with that request. Please try again.