Revision: 79878 http://trac.macports.org/changeset/79878 Author: jmr@macports.org Date: 2011-06-28 17:43:01 -0700 (Tue, 28 Jun 2011) Log Message: ----------- WIP buildbot config Added Paths: ----------- users/jmr/master.cfg Added: users/jmr/master.cfg =================================================================== --- users/jmr/master.cfg (rev 0) +++ users/jmr/master.cfg 2011-06-29 00:43:01 UTC (rev 79878) @@ -0,0 +1,213 @@ +# -*- python -*- +# ex: set syntax=python: + +# This is a buildmaster config file. It must be installed as +# 'master.cfg' in your buildmaster's base directory. + +# This is the dictionary that the buildmaster pays attention to. We also use +# a shorter alias to save typing. +c = BuildmasterConfig = {} + +####### BUILDSLAVES + +# The 'slaves' list defines the set of recognized buildslaves. Each element is +# a BuildSlave object, specifying a unique slave name and password. The same +# slave name and password must be configured on the slave. +from buildbot.buildslave import BuildSlave +c['slaves'] = [BuildSlave("snowleopard-x86_64", "pass")] + +# 'slavePortnum' defines the TCP port to listen on for connections from slaves. +# This must match the value configured into the buildslaves (with their +# --master option) +c['slavePortnum'] = 9989 + +####### CHANGESOURCES + +# the 'change_source' setting tells the buildmaster how it should find out +# about source code changes. + +# poller is used for local testing but PBChangeSource (which relies on +# notifications from a post-commit script) should be used in production + +from buildbot.changes.svnpoller import SVNPoller +c['change_source'] = [SVNPoller( + 'https://svn.macports.org/repository/macports/trunk/base', + project='base', + svnbin='/opt/local/bin/svn', + pollinterval=300), + SVNPoller( + 'https://svn.macports.org/repository/macports/trunk/dports', + project='ports', + svnbin='/opt/local/bin/svn', + pollinterval=300) + ] + +# from buildbot.changes.pb import PBChangeSource +# c['change_source'] = PBChangeSource(user='change', passwd='changepw') + +####### SCHEDULERS + +# consider changes to _resources as unimportant +def ports_check_importance(change): + for f in change.files: + if f.split('/')[0] != "_resources": + return True + return False + +# Configure the Schedulers, which decide how to react to incoming changes. + +from buildbot.changes.filter import ChangeFilter +base_filter = ChangeFilter(project="base") +ports_filter = ChangeFilter(project="ports") + +from buildbot.schedulers.basic import SingleBranchScheduler +c['schedulers'] = [SingleBranchScheduler( + name="base", + treeStableTimer=300, + change_filter=base_filter, + builderNames=["buildbase"]), + SingleBranchScheduler( + name="ports", + treeStableTimer=30, + change_filter=ports_filter, + fileIsImportant=ports_check_importance, + builderNames=["buildports"]) + ] + +####### BUILDERS + +#c['mergeRequests'] = True + +# The 'builders' list defines the Builders, which tell Buildbot how to perform a build: +# what steps, and which slaves can execute them. Note that any particular build will +# only take place on one slave. + +from buildbot.process.factory import BuildFactory, GNUAutoconf +from buildbot.process.properties import WithProperties +from buildbot.steps.source import SVN +from buildbot.steps.shell import ShellCommand, Compile + +base_factory = GNUAutoconf(source=SVN(svnurl='https://svn.macports.org/repository/macports/trunk/base', mode="copy"), + configureFlags=["--enable-readline"], + compile=["make", "-j2"], + test=["make", "test"]) + + +# custom class to make the file list available on the slave... +class ShellCommandWithPortList(ShellCommand): + def setBuild(self, build): + ShellCommand.setBuild(self, build) + + portset = set() + # paths should be category/portdir(/...) + for f in self.build.allFiles(): + comps = f.split('/') + if len(comps) >= 2 and comps[0] != '_resources': + portset.add(comps[1]) + portlist = ' '.join(portset) + self.setProperty('portlist', portlist) + +ports_factory = BuildFactory() +# get MPAB itself; we'll do the checkout of base and dports via MPAB's script +ports_factory.addStep(SVN(svnurl='https://svn.macports.org/repository/macports/contrib/mpab', + mode="update")) +# XXX can't run with PREFIX/SRC_PREFIX inside the workdir in production, +# because archives must be built with prefix=/opt/local +ports_factory.addStep(ShellCommand(command=["./mpsync.sh"], + env={'PREFIX': WithProperties("%(workdir)s/opt/local"), + 'SRC_PREFIX': WithProperties("%(workdir)s/opt/mports")})) +ports_factory.addStep(ShellCommandWithPortList(command=WithProperties('echo %(portlist)s | tr " " "\n" > portlist'))) +# run MPAB on the port list +ports_factory.addStep(Compile(command=["./mpab", "buildports", "portlist"], + env={'PREFIX': WithProperties("%(workdir)s/opt/local"), + 'SRC_PREFIX': WithProperties("%(workdir)s/opt/mports")})) +# sign generated binaries and sync to download server (if distributable) +opensslcmd = '/usr/bin/openssl' +# FIXME: configure these +prefix='../opt/local' +# private key to use for signing +privkey='' +# download server hostname and path where it keeps archives +dlhost='mparchives.local' +dlpath='/archives' +ports_factory.addStep(ShellCommand(command=[ +"""for port in `cat portlist`; do + if [[ -f logs-*/success/${port}.log ]]; then + if ./mpexport/base/portmgr/jobs/port_binary_distributable.tcl ${port}; then + echo $port is distributable + portversion=$("""+prefix+"""/bin/port info --version ${portName} | awk '{print $2}') + portrevision=$("""+prefix+"""/bin/port info --revision ${portName} | awk '{print $2}') + for archive in """+prefix+"""/var/macports/software/${portname}/${portname}-${portversion}_${portrevision}[+.]*; do + aname=$(basename $archive) + echo deploying archive: $aname + openssl dgst -ripemd160 -sign """+privkey+""" -out ./${aname}.rmd160 ${archive} + ssh """+dlhost+""" mkdir -p """+dlpath+"""/${portname} + rsync -av --ignore-existing ./${aname}.rmd160 ${archive} """+dlhost+""":"""+dlpath+"""/${portname} + rm ./${aname}.rmd160 + done + fi + fi +done +"""]) + +# suck in the log files generated for each port +#ports_factory.addStep(ShellCommand(command=["rm -r ./logs-*"])) + +from buildbot.config import BuilderConfig + +c['builders']= [ + BuilderConfig(name="buildbase", + slavenames=["snowleopard-x86_64"], + factory=base_factory), + BuilderConfig(name="buildports", + slavenames=["snowleopard-x86_64"], + factory=ports_factory) + ] + +####### STATUS TARGETS + +# 'status' is a list of Status Targets. The results of each build will be +# pushed to these targets. buildbot/status/*.py has a variety to choose from, +# including web pages, email senders, and IRC bots. + +c['status'] = [] + +from buildbot.status import html +from buildbot.status.web import auth, authz +authz_cfg=authz.Authz( + # change any of these to True to enable; see the manual for more + # options + gracefulShutdown = False, + forceBuild = True, # use this to test your slave once it is set up + forceAllBuilds = False, + pingBuilder = False, + stopBuild = False, + stopAllBuilds = False, + cancelPendingBuild = False, +) +c['status'].append(html.WebStatus(http_port=8010, authz=authz_cfg)) + +####### PROJECT IDENTITY + +# the 'title' string will appear at the top of this buildbot +# installation's html.WebStatus home page (linked to the +# 'titleURL') and is embedded in the title of the waterfall HTML page. + +c['title'] = "MacPorts" +c['titleURL'] = "http://www.macports.org/" + +# the 'buildbotURL' string should point to the location where the buildbot's +# internal web server (usually the html.WebStatus page) is visible. This +# typically uses the port number set in the Waterfall 'status' entry, but +# with an externally-visible host name which the buildbot cannot figure out +# without some help. + +c['buildbotURL'] = "http://localhost:8010/" + +####### DB URL + +# This specifies what database buildbot uses to store change and scheduler +# state. You can leave this at its default for all but the largest +# installations. +c['db_url'] = "sqlite:///state.sqlite" +
participants (1)
-
jmr@macports.org