[Buildbot-commits] buildbot/buildbot/process base.py,1.77,1.78

Brian Warner warner at users.sourceforge.net
Thu May 22 22:12:07 UTC 2008


Update of /cvsroot/buildbot/buildbot/buildbot/process
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16868/buildbot/process

Modified Files:
	base.py 
Log Message:
[project @ #87:customprops.patch]
Patch by Paul Gain, Roch Gadson <rochester.gadsdon at bakbone.com>, and
Aaron Maxwell <amax at snaplogic.org> to implement "custom properties":
build properties that can be specified when the build is initially
created, e.g., by a scheduler.

Original author: dustin at v.igoro.us
Date: 2008-04-04 03:52:33+00:00

Index: base.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/process/base.py,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -d -r1.77 -r1.78
--- base.py	22 May 2008 22:11:36 -0000	1.77
+++ base.py	22 May 2008 22:12:05 -0000	1.78
@@ -39,6 +39,9 @@
                   provide this, but for forced builds the user requesting the
                   build will provide a string.
 
+    @type custom_props: dictionary.
+    @ivar custom_props: custom user properties.
+
     @ivar status: the IBuildStatus object which tracks our status
 
     @ivar submittedAt: a timestamp (seconds since epoch) when this request
@@ -49,10 +52,11 @@
     source = None
     builder = None
     startCount = 0 # how many times we have tried to start this build
+    custom_props = {}
 
     implements(interfaces.IBuildRequestControl)
 
-    def __init__(self, reason, source, builderName=None, scheduler=None):
+    def __init__(self, reason, source, builderName=None, scheduler=None, custom_props=None):
         # TODO: remove the =None on builderName, it is there so I don't have
         # to change a lot of tests that create BuildRequest objects
         assert interfaces.ISourceStamp(source, None)
@@ -60,6 +64,9 @@
         self.source = source
         self.scheduler = scheduler
 
+        if not custom_props: custom_props = {}
+        self.custom_props = custom_props
+
         self.start_watchers = []
         self.finish_watchers = []
         self.status = BuildRequestStatus(source, builderName)
@@ -86,6 +93,9 @@
         self.finish_watchers.append(d)
         return d
 
+    def customProps(self):
+     return self.custom_props
+
     # these are called by the Builder
 
     def requestSubmitted(self, builder):
@@ -172,6 +182,9 @@
         self.reason = requests[0].mergeReasons(requests[1:])
         self.scheduler = requests[0].scheduler
 
+        # Set custom properties.
+        self.custom_properties = requests[0].customProps()
+
         #self.abandoned = False
 
         self.progress = None
@@ -198,10 +211,12 @@
         properties can live."""
         self.build_status.setProperty(propname, value)
 
+    def getCustomProperties(self):
+        return self.custom_properties
+
     def getProperty(self, propname):
         return self.build_status.properties[propname]
 
-
     def allChanges(self):
         return self.source.changes
 
@@ -268,6 +283,8 @@
             self.setProperty("scheduler", "none")
         else:
             self.setProperty("scheduler", self.scheduler.name)
+        for key, userProp in self.custom_properties.items():
+            self.setProperty(key, userProp)
 
     def setupSlaveBuilder(self, slavebuilder):
         self.slavebuilder = slavebuilder





More information about the Commits mailing list