Building Mozilla with Buildbot

From CDOT Wiki
Jump to: navigation, search

How to build Mozilla with Buildbot

master.cfg

# -*- python -*-

# This is a sample buildmaster config file. It must be installed as
# 'master.cfg' in your buildmaster's base directory (although the filename
# can be changed with the --basedir option to 'mktap buildbot master').

# It has one job: define a dictionary named BuildmasterConfig. This
# dictionary has a variety of keys to control different aspects of the
# buildmaster. They are documented in docs/config.xhtml .

import os.path
from buildbot.changes.freshcvs import FreshCVSSource
from buildbot.scheduler import Scheduler, Periodic
from buildbot.process import step, factory
from buildbot.status import html, words
s = factory.s

import mozbuild
reload(mozbuild)
from mozbuild import *

# This is the dictionary that the buildmaster pays attention to. We also use
# a shorter alias to save typing.
c = BuildmasterConfig = {}

##
## Misc Config
##

c['debugPassword'] = "mozilla"
#c['manhole'] = Manhole(9999, "admin", "password")
c['projectName'] = "Firefox"
c['projectURL'] = "http://mozilla.org/projects/firefox"
c['buildbotURL'] = "http://localhost:8010/"
c['slavePortnum'] = 9989

##
## Slaves
##
# (bot-name, bot-password)
c['bots'] = [("linux1", "mozilla"),
             ("linux2", "mozilla"),
             ("linux3", "mozilla"),
             ("linux4", "mozilla"),
             ("linux5", "mozilla"),
             ("linux6", "mozilla"),
             ("linux7", "mozilla"),
             ("linux8", "mozilla"),
             ("linux9", "mozilla"),
             ("linux10", "mozilla"),
             ("linux11", "mozilla"),
             ("win1", "mozilla"),
             ("win2", "mozilla"),
             ("spronk-osx", "mozilla")]

##
## Status
##

c['status'] = []
c['status'].append(html.Waterfall(http_port=2005, css="/home/buildmaster/firefox/waterfall.css"))
#c['status'].append(words.IRC(host="irc.mozilla.org", nick="vvbb",
#                             channels=["#vvbb"]))

# from buildbot.status import mail
# c['status'].append(mail.MailNotifier(fromaddr="buildbot@localhost",
#                                      extraRecipients=["builds@example.com"],
#                                      sendToInterestedUsers=False))

from buildbot.status import tinderbox

#c['status'].append(tinderbox.TinderboxMailNotifier(
#                       fromaddr="buildbot@seneca",
#                       tree="MozillaTest",
#                       extraRecipients=["tinderbox-daemon@tinderbox.mozilla.org","bjhearsu@learn.senecac.on.ca"],
#                       relayhost="learn.senecac.on.ca",
#                       logCompression="bzip2"))

##
## Sources
##

from buildbot.changes import bonsaipoller
c['sources'] = []
#c['sources'].append(bonsaipoller.BonsaiPoller(
#             bonsaiURL = "http://bonsai.mozilla.org",
#             module = "all",
#             branch = "HEAD",
#             pollInterval = 1 * 60))

##
## Schedulers
##

c['schedulers'] = []
#c['schedulers'].append(Scheduler(name="Firefox Test Linux", branch="HEAD",
#                                 treeStableTimer=10*60,
#                                 builderNames=["Seneca Test Linux"]))
#c['schedulers'].append(Scheduler(name="Firefox Test Windows", branch="HEAD",
#                                 treeStableTimer=10*60,
#                                 builderNames=["Seneca Test Windows"]))

from buildbot.scheduler import Try_Userpass

u = [("ben", "mypassword"), ("mike", "hispassword")]

t = Try_Userpass("userpass try", ["Seneca Test Linux", "Seneca Test Windows"],
                 port=5900, userpass=u)
c['schedulers'].append(t)

# the 'builders' list defines the Builders. Each one is configured with a
# dictionary, using the following keys:
#  name (required): the name used to describe this bilder
#  slavename (required): which slave to use, must appear in c['bots']
#  builddir (required): which subdirectory to run the builder in
#  factory (required): a BuildFactory to define how the build is run
#  periodicBuildTime (optional): if set, force a build every N seconds

builders = []

##
## Unix steps
##
firefox_trunk_unix_steps = [
    s(MozillaCheckoutClientMk, workdir="."),
    s(MozillaClientMkPull, workdir="mozilla"),
    s(step.Configure,
      workdir='mozilla',
      command=["./configure",
               "--enable-application=browser",
               "--enable-default-toolkit=cairo-gtk2",
               "--enable-glitz",
               "--enable-canvas",
               "--enable-svg",
               "--enable-pango",
               "--enable-static",
               "--disable-shared"]),
    s(step.Compile, workdir='mozilla'),
    s(MozillaPackage, workdir='mozilla/browser/installer')
    ]

firefox_trunk_unix_builder = {
    'name': "Seneca Test Linux",
    'slavenames': ['linux1','linux2','linux3','linux4','linux5','linux6',
                   'linux7','linux8','linux9','linux10','linux11'],
    'builddir': "firefox-seneca-unix-trunk",
    'factory': factory.BuildFactory(firefox_trunk_unix_steps),
    'category': "Firefox",
    }
builders.append(firefox_trunk_unix_builder)

##
## Mac
##
firefox_trunk_osx_steps = [
    s(MozillaCheckoutClientMk, workdir="."),
    s(MozillaClientMkPull, workdir="mozilla"),
    s(step.Configure,
      workdir='mozilla',
      command=["./configure",
               "--enable-application=browser",
               "--enable-default-toolkit=cairo-cocoa",
               "--enable-canvas",
               "--enable-svg"]),
    s(step.Compile, workdir='mozilla'),
    s(MozillaPackage, workdir='mozilla/browser/installer')
    ]

firefox_trunk_osx_builder = {
    'name': "firefox-seneca-osx-trunk",
    'slavename': "spronk-osx",
    'builddir': "firefox-seneca-osx-trunk",
    'factory': factory.BuildFactory(firefox_trunk_osx_steps),
    'category': "Firefox",
    }
builders.append(firefox_trunk_osx_builder)

##
## Win2k
##
firefox_trunk_win2k_vc8_steps = [
    s(MozillaCheckoutClientMk, workdir=".", env=MozillaEnvironments['vc8_express']),
    s(MozillaClientMkPull, workdir="mozilla", env=MozillaEnvironments['vc8_express']),
    s(step.Configure,
      workdir='mozilla',
      env=MozillaEnvironments['vc8_express'],
      command=["bash", "-f", "configure",
               "--enable-application=browser",
               "--enable-default-toolkit=cairo-windows",
               "--enable-glitz",
               "--enable-canvas",
               "--enable-svg",
               "--enable-static",
               "--disable-shared",
               # these are due to the box using VC8 Express
               "--disable-crypto",
               "--disable-activex",
               "--disable-activex-scripting",
               "--disable-xpconnect-idispatch",
               "--disable-accessibility",
               "--disable-tests"]),
    s(step.Compile, workdir='mozilla', env=MozillaEnvironments['vc8_express']),
    s(MozillaPackage, workdir='mozilla/browser/installer', env=MozillaEnvironments['vc8_express'])
]

firefox_trunk_win2k_builder = {
    'name': "Seneca Test Windows",
    'slavenames': ['win1','win2'],
    'builddir': "firefox-seneca-win2k-trunk",
    'factory': factory.BuildFactory(firefox_trunk_win2k_vc8_steps),
    'category': "Firefox",
    }
builders.append(firefox_trunk_win2k_builder)

c['builders'] = builders

mozbuild.py

# -*- Python -*-

from buildbot.process import step
from buildbot.process.step import ShellCommand

MozillaEnvironments = { }

# standard vc8 express build env; vc8 normal will be very similar, just different
# platform SDK location.  we can build both from one generic template.
MozillaEnvironments['vc8_express'] = {
    "MOZ_TOOLS": '/cygdrive/c/proj/vc8-moztools',
    "VSINSTALLDIR": 'C:\\Program Files\\Microsoft Visual Studio 8',
    "VS80COMMTOOLS": 'C:\\Program Files\\Microsoft Visual Studio 8\\Common7\\Tools\\',
    "VCINSTALLDIR": 'C:\\Program Files\\Microsoft Visual Studio 8\\VC',
    "FrameworkDir": 'C:\\WINDOWS\\Microsoft.NET\\Framework',
    "FrameworkVersion": 'v2.0.50727',
    "FrameworkSDKDir": 'C:\\Program Files\\Microsoft Visual Studio 8\\SDK\\v2.0',
    "DevEnvDir": "C:\\Program Files\\Microsoft Visual Studio 8\\VC\\Common7\\IDE",
    "MSVCDir": 'C:\\Program Files\\Microsoft Visual Studio 8\\VC',
    "PATH": 'C:\\Program Files\\Microsoft Visual Studio 8\\Common7\\IDE;' + \
            'C:\\Program Files\\Microsoft Visual Studio 8\\VC\\bin;' + \
            'C:\\Program Files\\Microsoft Platform SDK\\bin;' + \
            'C:\\Program Files\\Microsoft Visual Studio 8\\VC;' + \
            'C:\\Program Files\\Microsoft Visual Studio 8\\Common7\\Tools;' + \
            'C:\\Program Files\\Microsoft Visual Studio 8\\Common7\\Tools\\bin;' + \
            'C:\\proj\\vc8-moztools\\bin;' + \
            'C:\\cygwin\\bin;' + \
            'C:\\WINNT\\system32',
    "INCLUDE": 'C:\\Program Files\\Microsoft Visual Studio 8\\VC\\ATLMFC\\INCLUDE;' + \
               'C:\\Program Files\\Microsoft Visual Studio 8\\VC\\INCLUDE;' + \
               'C:\\Program Files\\Microsoft Platform SDK\\include',
    "LIB": 'C:\\Program Files\\Microsoft Visual Studio 8\\VC\\ATLMFC\\LIB;' + \
           'C:\\Program Files\\Microsoft Visual Studio 8\\VC\\LIB;' + \
           'C:\\Program Files\\Microsoft Platform SDK\\lib'
}

class MozillaCheckoutClientMk(ShellCommand):
    haltOnFailure = True
    cvsroot = ":pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot"
    
    def __init__(self, **kwargs):
        if 'cvsroot' in kwargs:
            self.cvsroot = kwargs['cvsroot']
        if not 'command' in kwargs:
            kwargs['command'] = ["cvs", "-d", self.cvsroot, "co", "mozilla/client.mk"]
        ShellCommand.__init__(self, **kwargs)

    def describe(self, done=False):
        return ["client.mk update"]

class MozillaClientMkPull(ShellCommand):
    haltOnFailure = True
    def __init__(self, **kwargs):
        if not 'project' in kwargs or kwargs['project'] is None:
            self.project = "browser"
        else:
            self.project = kwargs['project']
            del kwargs['project']
        if not 'workdir' in kwargs:
            kwargs['workdir'] = "mozilla"
        if not 'command' in kwargs:
            kwargs['command'] = ["make", "-f", "client.mk", "pull_all"]
        env = {}
        if 'env' in kwargs:
            env = kwargs['env'].copy()
        env['MOZ_CO_PROJECT'] = self.project
        kwargs['env'] = env
        ShellCommand.__init__(self, **kwargs)

    def describe(self, done=False):
        if not done:
            return ["pulling (" + self.project + ")"]
        return ["pull (" + self.project + ")"]

class MozillaPackage(ShellCommand):
    name = "package"
    warnOnFailure = True
    description = ["packaging"]
    descriptionDone = ["package"]
    command = ["make"]