master.cfg and mozbuild.py for buildbot tryserver b=387958 p=bhearsum r=rhelmer hallelujah=preed

git-svn-id: svn://10.0.0.236/trunk@229937 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
rhelmer%mozilla.com
2007-07-14 00:46:26 +00:00
parent 6a45662f0f
commit d9dab1ef30
2 changed files with 307 additions and 0 deletions

View File

@@ -0,0 +1,186 @@
# -*- 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 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['projectName'] = "Mozilla CVS trunk patch uploader"
c['projectURL'] = "http://www.mozilla.org"
c['buildbotURL'] = "http://test1-linux-buildbot.build.mozilla.org:8010"
c['slavePortnum'] = 9989
##
## Slaves
##
# (bot-name, bot-password)
c['bots'] = [("linux1", "*********"),
("win1", "*********"),
("mac1", "********")]
##
## Status
##
from buildbot.status.html import Waterfall
c['status'] = []
c['status'].append(Waterfall(http_port=8010,
css="/builds/buildbot/master/waterfall.css",
allowForce=False))
##
## Sources
##
from buildbot.changes.pb import PBChangeSource
c['sources'] = []
c['sources'].append(PBChangeSource())
##
## Schedulers
##
c['schedulers'] = []
# scheduler for sendchange
from buildbot.scheduler import Scheduler
c['schedulers'].append(Scheduler(name="Sendchange test scheduler",
branch="HEAD_TRY",
treeStableTimer=3,
builderNames=["Sendchange linux builder",
"Sendchange mac builder",
"Sendchange win32 builder"]))
# 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 = []
CVSROOT = ":pserver:anonymous@cvs.mozilla.org:/cvsroot"
from buildbot.process import factory
s = factory.s
from buildbot.steps.shell import ShellCommand
firefox_sendchange_unix_steps = [
s(ShellCommand, name="remove source and obj dirs",
command=["rm", "-rf", "mozilla"],
workdir="."),
s(ShellCommand, name="checkout client.mk",
description=["fetching client.mk"],
descriptionDone=["client.mk"],
command=["cvs", "-d", CVSROOT, "co",
"mozilla/client.mk"],
workdir="."),
# TODO: when we support the upload of a mozconfig
# there should be a FileDownload step here
s(ShellCommand, name="source checkout",
description=["fetching source"],
descriptionDone=["source"],
command=["make", "-f", "client.mk", "checkout"],
workdir="mozilla"),
s(MozillaPatchDownload, patchDir="patchstore", workdir="mozilla"),
s(MozillaCustomPatch, workdir="mozilla"),
s(ShellCommand, name="mozconfig contents",
command=["cat",".mozconfig"],
workdir="mozilla"),
s(ShellCommand, name="building",
description=["building"],
descriptionDone=["compile"],
command=["make", "-f", "client.mk", "build"],
workdir="mozilla")
]
firefox_sendchange_unix_builder = {
'name': "Sendchange linux builder",
'slavenames': ['linux1'],
'builddir': "sendchange-linux",
'factory': factory.BuildFactory(firefox_sendchange_unix_steps),
'category': "Sendchange"
}
builders.append(firefox_sendchange_unix_builder)
# we can just use the same steps for mac
firefox_sendchange_mac_builder = {
'name': "Sendchange mac builder",
'slavenames': ['mac1'],
'builddir': "sendchange-mac",
'factory': factory.BuildFactory(firefox_sendchange_unix_steps),
'category': "Sendchange"
}
builders.append(firefox_sendchange_mac_builder)
firefox_sendchange_win32_steps = [
s(ShellCommand, name="remove source and obj dirs",
command=["rmdir", "/s", "/q", "mozilla"],
workdir=".",
env=MozillaEnvironments['win32-buildbotref-v4']),
s(ShellCommand, name="checkout client.mk",
description=["fetching client.mk"],
descriptionDone=["client.mk"],
command=["cvs", "-d", CVSROOT, "co",
"mozilla/client.mk"],
workdir=".",
env=MozillaEnvironments['win32-buildbotref-v4']),
# TODO: when we support the upload of a mozconfig
# there should be a FileDownload step here
s(ShellCommand, name="source checkout",
description=["fetching source"],
descriptionDone=["source"],
command=["make", "-f", "client.mk", "checkout"],
workdir="mozilla",
env=MozillaEnvironments['win32-buildbotref-v4']),
s(MozillaPatchDownload, patchDir="patchstore", workdir="mozilla"),
s(MozillaCustomPatch, workdir="mozilla"),
s(ShellCommand, name="mozconfig contents",
command=["cat",".mozconfig"],
workdir="mozilla",
env=MozillaEnvironments['win32-buildbotref-v4']),
s(ShellCommand, name="building",
description=["building"],
descriptionDone=["compile"],
command=["make", "-f", "client.mk", "build"],
workdir="mozilla",
env=MozillaEnvironments['win32-buildbotref-v4']),
]
firefox_sendchange_win32_builder = {
'name': "Sendchange win32 builder",
'slavenames': ['win1'],
'builddir': "sendchange-win32",
'factory': factory.BuildFactory(firefox_sendchange_win32_steps),
'category': "Sendchange"
}
builders.append(firefox_sendchange_win32_builder)
c['builders'] = builders

View File

@@ -0,0 +1,121 @@
from buildbot.steps.transfer import FileDownload
MozillaEnvironments = {}
MozillaEnvironments['win32-buildbotref-v4'] = {
"'MOZ_TOOLS": 'd:\\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',
"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;' + \
'd:\\moztools\\bin;' + \
'd:\\cygwin\\bin;' + \
'd:\\buildtools\\7zip;' + \
'd:\\buildtools\\upx;' + \
'd:\\buildtools\\python24;' + \
'd:\\buildtools\\nsis;',
"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 MozillaPatchDownload(FileDownload):
"""This step reads a Change for a filename and downloads it to the slave.
It is typically used in conjunction with the MozillaCustomPatch step.
"""
haltOnFailure = True
def __init__(self, patchDir=".", **kwargs):
"""arguments:
@type patchDir: string
@param patchDir: The directory on the master that holds the patches
This directory is relative to the base buildmaster
directory.
ie. /home/buildmaster/project
Defaults to '.'
'workdir' is assumed to be 'build' and should be passed if it is anything
else.
"""
self.patchDir = patchDir
# mastersrc and slavedest get overriden in start()
if not 'workdir' in kwargs:
kwargs['workdir'] = "build"
FileDownload.__init__(self, mastersrc=".", slavedest=".", **kwargs)
def start(self):
changes = self.step_status.build.getChanges()
if len(changes) < 1:
return
file = changes[0].getFileContents().split(": ")[1].rstrip()
# strip the path from the filename
file = file.split("/")[-1]
self.mastersrc = "%s/%s" % (self.patchDir, file)
self.slavedest = "%s" % (file)
# now that everything is set-up, download the file
FileDownload.start(self)
from twisted.python import log
from buildbot.steps.shell import ShellCommand
from buildbot.status.builder import WARNINGS
class MozillaCustomPatch(ShellCommand):
"""This step looks at a Change to find the name of a diff.
The diff is applied to the current tree.
This step is typically used in conjunction with the MozillaPatchDownload
step.
"""
haltOnFailure = True
def __init__(self, stripDirs=0, **kwargs):
"""
@type stripDirs: int
@param stripDirs: The '-p' option to pass to patch. Defaults to 0
'workdir' is assumed to be 'build' and should be passed if it is
anything else.
"""
self.stripDirs = stripDirs
if not 'workdir' in kwargs:
kwargs['workdir'] = "build"
ShellCommand.__init__(self, **kwargs)
def start(self):
changes = self.step_status.build.getChanges()
if len(changes) < 1:
log.msg("No changes, not doing anything")
self.step_status.setColor("yellow")
self.step_status.setText(["Skipped patch step:", "no patch"])
self.finished(WARNINGS)
return
if len(changes) > 1:
log.msg("Ignoring all but the first change...")
file = changes[0].getFileContents().split(": ")[1].rstrip()
self.setCommand(["patch", "-f", "-p%d" % self.stripDirs, "-i", file])
ShellCommand.start(self)