[Buildbot-commits] buildbot/buildbot/status html.py,1.70,1.71 words.py,1.42,1.43

Brian Warner warner at users.sourceforge.net
Thu Oct 20 22:25:31 UTC 2005


Update of /cvsroot/buildbot/buildbot/buildbot/status
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9509/buildbot/status

Modified Files:
	html.py words.py 
Log Message:
Revision: arch at buildbot.sf.net--2004/buildbot--dev--0--patch-344
Creator:  Brian Warner <warner at lothar.com>

clean up use of 'force build' methods

	* buildbot/interfaces.py (IBuilderControl.requestBuildSoon): new
	method specifically for use by HTML "force build" button and the
	IRC "force" command. Raises an immediate error if there are no
	slaves available.
	(IBuilderControl.requestBuild): make this just submit a build, not
	try to check for existing slaves or set up any when-finished
	Deferreds or anything.
	* buildbot/process/builder.py (BuilderControl): same
	* buildbot/status/html.py (StatusResourceBuilder.force): same
	* buildbot/status/words.py (IrcStatusBot.command_FORCE): same
	* buildbot/test/test_slaves.py: same
	* buildbot/test/test_web.py: same


Index: html.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/status/html.py,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -d -r1.70 -r1.71
--- html.py	19 Oct 2005 05:59:34 -0000	1.70
+++ html.py	20 Oct 2005 22:25:29 -0000	1.71
@@ -20,8 +20,10 @@
 
 from buildbot import interfaces, util
 from buildbot import version
+from buildbot.sourcestamp import SourceStamp
 from buildbot.status import builder, base
 from buildbot.changes import changes
+from buildbot.process.base import BuildRequest
 
 class ITopBox(Interface):
     """I represent a box in the top row of the waterfall display: the one
@@ -472,9 +474,12 @@
             # TODO: if we can authenticate that a particular User pushed the
             # button, use their name instead of None, so they'll be informed of
             # the results.
+            branch = None
+            s = SourceStamp(branch=branch)
+            req = BuildRequest(r, s, self.builder.getName())
             try:
-                self.control.forceBuild(None, r)
-            except (interfaces.NoSlaveError, interfaces.BuilderInUseError):
+                self.control.requestBuildSoon(req)
+            except interfaces.NoSlaveError:
                 # TODO: tell the web user that their request could not be
                 # honored
                 pass

Index: words.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/status/words.py,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- words.py	19 Oct 2005 05:59:34 -0000	1.42
+++ words.py	20 Oct 2005 22:25:29 -0000	1.43
@@ -17,6 +17,8 @@
 
 from buildbot import interfaces, util
 from buildbot import version
+from buildbot.sourcestamp import SourceStamp
+from buildbot.process.base import BuildRequest
 from buildbot.status import base
 from buildbot.status.builder import SUCCESS, WARNINGS, FAILURE, EXCEPTION
 
@@ -299,25 +301,20 @@
         # TODO: or, monitor this build and announce the results through the
         # 'reply' argument.
         r = "forced: by IRC user <%s>: %s" % (user, reason)
+        # TODO: maybe give certain users the ability to request builds of
+        # certain branches
+        branch = None
+        s = SourceStamp(branch=branch)
+        req = BuildRequest(r, s, which)
         try:
-            # TODO: replace this with bc.requestBuild, and maybe give certain
-            # users the ability to request builds of certain branches
-            d = bc.forceBuild(who, r)
+            bc.requestBuildSoon(req)
         except interfaces.NoSlaveError:
             self.reply(reply,
-                       "sorry, I can't force a build: the slave is offline")
-            return
-        except interfaces.BuilderInUseError:
-            self.reply(reply,
-                       "sorry, I can't force a build: the slave is in use")
-            return
-        if not d:
-            self.reply(reply, "sorry, I can't force a build: I must have "
-                       "left the builder in my other pants")
+                       "sorry, I can't force a build: all slaves are offline")
             return
+        ireq = IrcBuildRequest(self, reply)
+        req.subscribe(ireq.started)
 
-        req = IrcBuildRequest(self, reply)
-        d.addCallback(req.started)
 
     command_FORCE.usage = "force build <which> <reason> - Force a build"
 





More information about the Commits mailing list