Mercurial > hg > autobot
changeset 74:d94fbaac7c2c
stub out being able to find scripts cross-platform in a virtualenv
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Tue, 11 Jan 2011 15:04:31 -0800 |
parents | d033843da35a |
children | a7ee8eacf605 |
files | autobot/process/factory.py autobot/projects/autobot/__init__.py autobot/steps/virtualenv.py autobot/template.py autobot/template/master/master.cfg |
diffstat | 5 files changed, 37 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/autobot/process/factory.py Tue Jan 11 14:23:39 2011 -0800 +++ b/autobot/process/factory.py Tue Jan 11 15:04:31 2011 -0800 @@ -1,3 +1,4 @@ +from autobot.steps import find from autobot.steps import CreateVirtualenv from buildbot.process.factory import BuildFactory from buildbot.steps.shell import SetProperty @@ -10,12 +11,13 @@ def find(*args): """ - returns a command to echo the found file + returns a command to echo the found file cross-platform """ args = ['[ -e "%s" ]; then echo "%s"' % (arg, arg) for arg in args] command = 'if %s; else false; fi' % '; elif '.join(args) return ['bash', '-c', command] + class VirtualenvFactory(BuildFactory): """ create a virtualenv @@ -57,6 +59,17 @@ workdir=WithProperties('%(virtualenv)s/src'), haltOnFailure=True)) + def findScript(self, script): + """ + find the name of the script cross-platform + - script: unix-style name of the script + """ + self.addStep(SetProperty(property=script, + command=find(script, script + '.exe'), + workdir=WithProperties('%(virtualenv)s/%(script)s'))) + + + class PythonSourceFactory(VirtualenvFactory): """ setup several python packages
--- a/autobot/projects/autobot/__init__.py Tue Jan 11 14:23:39 2011 -0800 +++ b/autobot/projects/autobot/__init__.py Tue Jan 11 15:04:31 2011 -0800 @@ -1,4 +1,6 @@ from autobot.process.factory import PythonSourceFactory +from buildbot.steps.shell import ShellCommand +from buildbot.steps.shell import WithProperties class TestAutobotFactory(PythonSourceFactory): """ @@ -11,4 +13,4 @@ hg_sources=['http://k0s.org/mozilla/hg/autobot']) # run the tests - # [TODO] +
--- a/autobot/steps/virtualenv.py Tue Jan 11 14:23:39 2011 -0800 +++ b/autobot/steps/virtualenv.py Tue Jan 11 15:04:31 2011 -0800 @@ -1,5 +1,9 @@ +""" +steps related to virtualenvs +""" + from buildbot.process.properties import WithProperties -from buildbot.steps.shell import ShellCommand +from buildbot.steps.shell import ShellCommand class CreateVirtualenv(ShellCommand): """create a virtualenv"""
--- a/autobot/template.py Tue Jan 11 14:23:39 2011 -0800 +++ b/autobot/template.py Tue Jan 11 15:04:31 2011 -0800 @@ -119,7 +119,7 @@ parser = MakeItSoCLI.parser(self) parser.add_option('-f', '--factory', dest='factories', default=[], action='append', - help="factory to use") + help="factory to use ('--factory -' for all)") parser.add_option('--list-factories', dest='_list_factories', default=False, action='store_true', help="list available factories") @@ -137,6 +137,10 @@ print print_descriptions() parser.exit() + # check for all factories + if options.factories == ['-']: + options.factories = factories.keys() + # call the parent return MakeItSoCLI.parse(self, args, parser, options)
--- a/autobot/template/master/master.cfg Tue Jan 11 14:23:39 2011 -0800 +++ b/autobot/template/master/master.cfg Tue Jan 11 15:04:31 2011 -0800 @@ -11,12 +11,6 @@ from buildbot.changes.pb import PBChangeSource c['change_source'] = PBChangeSource() -####### SCHEDULERS -from buildbot.scheduler import Scheduler -c['schedulers'] = [] -c['schedulers'].append(Scheduler(name="all", branch=None, - treeStableTimer=1, - builderNames=["buildbot-full"])) ####### BUILDERS @@ -28,7 +22,7 @@ f = factory_dict[factory]() # define builder - b = {'name': "buildbot-" + factory, + b = {'name': factory, 'slavename': "{{slave}}", 'builddir': "full", 'factory': f, @@ -37,6 +31,15 @@ c['builders'] = builders +####### SCHEDULERS +from buildbot.scheduler import Scheduler +c['schedulers'] = [] # define scheduler +c['schedulers'].append(Scheduler(name="all", branch=None, + treeStableTimer=1, + builderNames={{factories}})) + + + ####### STATUS TARGETS c['status'] = [] from buildbot.status import html