changeset 134:a67fb62c04a6

start adding sources to the master.mfg
author Jeff Hammel <jhammel@mozilla.com>
date Mon, 24 Jan 2011 10:21:07 -0800
parents 1abbe826d0f3
children 7ab38166e65e
files autobot/projects/autobot/__init__.py autobot/template/master/master.cfg
diffstat 2 files changed, 32 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/autobot/projects/autobot/__init__.py	Sun Jan 23 17:04:36 2011 -0800
+++ b/autobot/projects/autobot/__init__.py	Mon Jan 24 10:21:07 2011 -0800
@@ -6,11 +6,13 @@
   """
   factory to test autobot
   """
+
+  sources = {'hg': ['http://k0s.org/mozilla/hg/autobot'])
+
   def __init__(self, slaveport=7357, htmlport=7358):
 
     # setup the environment
-    PythonSourceFactory.__init__(self, name='autobot',
-                                 hg_sources=['http://k0s.org/mozilla/hg/autobot'])
+    PythonSourceFactory.__init__(self, name='autobot')
 
     # find the necessary scripts
     self.findScript('create-autobot')
--- a/autobot/template/master/master.cfg	Sun Jan 23 17:04:36 2011 -0800
+++ b/autobot/template/master/master.cfg	Mon Jan 24 10:21:07 2011 -0800
@@ -13,11 +13,11 @@
                for slave in config.slaves]
 c['slavePortnum'] = config.master['slaveport']
 
-####### CHANGESOURCES
-from buildbot.changes.pb import PBChangeSource
-c['change_source'] = [PBChangeSource()]
+####### BUILDERS
 
-####### BUILDERS
+sources = {'git': set(),
+           'hg':  set()}
+           
 
 # define builder factories
 from autobot.projects import factories as factory_dict
@@ -35,9 +35,33 @@
              'factory': f,
              }
         builders.append(b)
+
+        # get change sources
+        # XXX this should be moved to real code, not pseudo-config
+        if not hasattr(f, 'sources'):
+            continue
+        for source_type in sources:
+            _sources = getattr(_sources).get(source_type, [])
+            if isinstance(_sources, basestring):
+                _sources = _sources.split()
+            for source in _sources:
+                if instance(source, basestring):
+                    branch = None
+                    if '#' in source:
+                        source, branch = source.rsplit('#', 1)
+                else: # tuple
+                    source, branch = source
+                sources[source_type].add((source, branch))
     
 c['builders'] = builders
 
+####### CHANGESOURCES
+from buildbot.changes.pb import PBChangeSource
+c['change_source'] = [PBChangeSource()]
+
+from buildbot.changes.gitpoller import GitPoller
+from autobot.changes.poller import HgPoller
+
 ####### SCHEDULERS
 from buildbot.scheduler import Scheduler
 buildernames = [i['name'] for i in builders]