# HG changeset patch # User Jeff Hammel # Date 1294860540 28800 # Node ID 2616a5f49bd33c571254a6a344c733df25738d45 # Parent 65c91bf35a36fd8a92ef439ba3061c150fd081b9 switch to .ini files for configuration diff -r 65c91bf35a36 -r 2616a5f49bd3 autobot/template.py --- a/autobot/template.py Wed Jan 12 11:17:03 2011 -0800 +++ b/autobot/template.py Wed Jan 12 11:29:00 2011 -0800 @@ -54,6 +54,9 @@ else: raise AssertionError("No factory provided") + # stringify + variables['factories'] = ' '.join([i for i in variables['factories']) + def create(self, output, variables): command = ['buildbot', 'create-master', output] print ' '.join(command) diff -r 65c91bf35a36 -r 2616a5f49bd3 autobot/template/master/master.cfg --- a/autobot/template/master/master.cfg Wed Jan 12 11:17:03 2011 -0800 +++ b/autobot/template/master/master.cfg Wed Jan 12 11:29:00 2011 -0800 @@ -2,52 +2,59 @@ # ex: set syntax=python: c = BuildmasterConfig = {} +####### AUTOBOT CONFIG +import os +from autobot.config import BuildbotIniConfig +config = BuildbotIniConfig(os.path.join(basedir, 'master.ini')) + ####### BUILDSLAVES from buildbot.buildslave import BuildSlave -c['slaves'] = [BuildSlave("{{slave}}", "{{passwd}}")] -c['slavePortnum'] = {{slaveport}} +c['slaves'] = [BuildSlave(slave, config.slaves[slave]['password']) + for slave in config.slaves] +c['slavePortnum'] = config.master['slaveport'] ####### CHANGESOURCES from buildbot.changes.pb import PBChangeSource c['change_source'] = PBChangeSource() - ####### BUILDERS # define builder factories from autobot.projects import factories as factory_dict builders = [] -for factory in {{factories}}: - f = factory_dict[factory]() - - # define builder - b = {'name': factory, - 'slavename': "{{slave}}", - 'builddir': "full", - 'factory': f, - } - builders.append(b) +for slave in config.slaves: + for factory in config.slaves[slave]['factories']: + f = factory_dict[factory](**config.args.get(factory, {})) + + # define builder + buildername = '%s - %s' % (factory, slave) + b = {'name': buildername, + 'slavename': slave, + 'builddir': "full", + 'factory': f, + } + builders.append(b) c['builders'] = builders ####### SCHEDULERS from buildbot.scheduler import Scheduler -c['schedulers'] = [] # define scheduler +buildernames = [i['name'] for i in builders] +c['schedulers'] = [] c['schedulers'].append(Scheduler(name="all", branch=None, treeStableTimer=1, - builderNames={{factories}})) - - + builderNames=buildernames)) ####### STATUS TARGETS c['status'] = [] from buildbot.status import html from buildbot.status.web.authz import Authz authz = Authz(forceBuild=True, stopBuild=True) -c['status'].append(html.WebStatus(http_port={{htmlport}}, authz=authz)) +c['status'].append(html.WebStatus(http_port=config.master['htmlport'], + authz=authz)) ####### PROJECT IDENTITY c['projectName'] = "autobot" c['projectURL'] = "http://buildbot.sourceforge.net/" -c['buildbotURL'] = "http://localhost:{{htmlport}}/" +c['buildbotURL'] = "http://localhost:%d/" % config.master['htmlport'] diff -r 65c91bf35a36 -r 2616a5f49bd3 autobot/template/master/master.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/autobot/template/master/master.ini Wed Jan 12 11:29:00 2011 -0800 @@ -0,0 +1,7 @@ +[:master:] +factories = {{factories}} +password = {{passwd}} +slaveport = {{slaveport}} +htmlport = {{htmlport}} + +[slave:{{slave}}] \ No newline at end of file