changeset 66:cbcb96142ed6

stubs towards specifying multiple factories
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 11 Jan 2011 10:15:33 -0800
parents 288397616e5f
children e8dabfd24c42
files autobot/template.py autobot/template/master/master.cfg
diffstat 2 files changed, 21 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/autobot/template.py	Tue Jan 11 09:51:46 2011 -0800
+++ b/autobot/template.py	Tue Jan 11 10:15:33 2011 -0800
@@ -41,15 +41,15 @@
             Variable('htmlport', 'port for waterfall display', default=8010, cast=int)]
 
     def pre(self, variables):
-        factory = variables.get('factory')
+        factory = variables.get('factories')
         if factory:
-            assert factory in factories, 'Factory must be one of: ' % ', '.join(factories.keys())
+            assert(set(factory).issubset(factories.keys())), 'Factory must be one of: ' % ', '.join(factories.keys())
         elif self.interactive:
             print print_descriptions()
             sys.stdout.write('Enter factory: ')
             factory = raw_input()
             assert factory in factories, 'Factory must be one of: ' % ', '.join(factories.keys())
-            variables['factory'] = factory
+            variables['factories'] = [factory]
         else:
             raise AssertionError("No factory provided")
 
@@ -64,6 +64,7 @@
         """
         self.create(self.output, variables)
 
+
 class AutobotSlaveTemplate(MakeItSoTemplate):
     name = 'autobot-slave'
     description = 'template for the autotools buildbot slave'
@@ -105,7 +106,8 @@
     """
     def parser(self):
         parser = MakeItSoCLI.parser(self)
-        parser.add_option('-f', '--factory', dest='factory',
+        parser.add_option('-f', '--factory', dest='factories',
+                          default=[], action='append',
                           help="factory to use")
         parser.add_option('--list-factories', dest='_list_factories',
                           default=False, action='store_true',
--- a/autobot/template/master/master.cfg	Tue Jan 11 09:51:46 2011 -0800
+++ b/autobot/template/master/master.cfg	Tue Jan 11 10:15:33 2011 -0800
@@ -20,17 +20,22 @@
 
 ####### BUILDERS
 
-# define builder factory
-from autobot.projects import factories
-f1 = factories['{{factory}}']()
+# define builder factories
+from autobot.projects import factories as factory_dict
+builders = []
 
-# define builder
-b1 = {'name': "buildbot-full",
-      'slavename': "{{slave}}",
-      'builddir': "full",
-      'factory': f1,
-      }
-c['builders'] = [b1]
+for factory in {{factories}}:
+    f = factory_dict['{{factory}}']()
+    
+    # define builder
+    b = {'name': "buildbot-" + factory,
+         'slavename': "{{slave}}",
+         'builddir': "full",
+         'factory': f,
+         }
+    builders.append(b)
+    
+c['builders'] = builders
 
 ####### STATUS TARGETS
 c['status'] = []