[cig-commits] r5849 - in cs/buildbot/trunk/buildbot: . status

leif at geodynamics.org leif at geodynamics.org
Fri Jan 19 17:46:39 PST 2007


Author: leif
Date: 2007-01-19 17:46:39 -0800 (Fri, 19 Jan 2007)
New Revision: 5849

Added:
   cs/buildbot/trunk/buildbot/categories.py
Modified:
   cs/buildbot/trunk/buildbot/status/html.py
Log:
Enhanced BuildBot's notion of 'categories'.  A category is now
represented by a Category object (instead of a simple string).  A
Category consists of mutiple, arbitrary keyword/value pairs.  In
master.cfg, one can now write

    b1 = {'name': "build1",
	  'slavename': "bot1name",
	  'builddir': "b1",
	  'factory': f1,
	  'category': Category(project='CitcomS'),
	  }
    b2 = {'name': "build2",
	  'slavename': "bot1name",
	  'builddir': "b2",
	  'factory': f1,
	  'category': Category(project='PyLith'),
	  }
    c['builders'] = [b1,b2]

and (for example) select CitcomS builds or PyLith builds in the
waterfall display by appending a simple query string to the URL:

    http://localhost:8010/?project=CitcomS
    http://localhost:8010/?project=PyLith

Of course, multiple keyword/value pairs are allowed:

    http://localhost:8010/?project=PyLith&type=binaries

I nuked the waterfall's "show=<build name>" feature, since it would
have been awkward to integrate and this is more powerful anyway.


Added: cs/buildbot/trunk/buildbot/categories.py
===================================================================
--- cs/buildbot/trunk/buildbot/categories.py	2007-01-19 23:12:02 UTC (rev 5848)
+++ cs/buildbot/trunk/buildbot/categories.py	2007-01-20 01:46:39 UTC (rev 5849)
@@ -0,0 +1,27 @@
+
+class Category(object):
+
+    def __init__(self, **kwds):
+        self.__dict__.update(kwds)
+
+
+class CategorySet(object):
+
+    def __init__(self, args):
+        self.args = args
+
+    def __contains__(self, item):
+        if item is None:
+            return True
+        for kw,l in self.args.iteritems():
+            if hasattr(item, kw):
+                attr = getattr(item, kw)
+                for v in l:
+                    if v != attr:
+                        return False
+        return True
+
+    def subset(self, anotherSet):
+        ret = CategorySet(self.args.copy())
+        ret.args.update(anotherSet)
+        return ret

Modified: cs/buildbot/trunk/buildbot/status/html.py
===================================================================
--- cs/buildbot/trunk/buildbot/status/html.py	2007-01-19 23:12:02 UTC (rev 5848)
+++ cs/buildbot/trunk/buildbot/status/html.py	2007-01-20 01:46:39 UTC (rev 5849)
@@ -1083,6 +1083,8 @@
     def body(self, request):
         "This method builds the main waterfall display."
 
+        from buildbot.categories import CategorySet
+
         data = ''
 
         projectName = self.status.getProjectName()
@@ -1091,18 +1093,11 @@
         phase = request.args.get("phase",["2"])
         phase = int(phase[0])
 
-        showBuilders = request.args.get("show", None)
-        allBuilders = self.status.getBuilderNames(categories=self.categories)
-        if showBuilders:
-            builderNames = []
-            for b in showBuilders:
-                if b not in allBuilders:
-                    continue
-                if b in builderNames:
-                    continue
-                builderNames.append(b)
+        if self.categories is None:
+            categories = CategorySet(request.args)
         else:
-            builderNames = allBuilders
+            categories = self.categories.subset(request.args)
+        builderNames = self.status.getBuilderNames(categories=categories)
         builders = map(lambda name: self.status.getBuilder(name),
                        builderNames)
 



More information about the cig-commits mailing list