[Buildbot-commits] buildbot/buildbot/status/web xmlrpc.py,1.2,1.3
Brian Warner
warner at users.sourceforge.net
Thu Mar 20 18:04:55 UTC 2008
Update of /cvsroot/buildbot/buildbot/buildbot/status/web
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv6755/buildbot/status/web
Modified Files:
xmlrpc.py
Log Message:
[project @ #195:xmlrpc-additions.patch]
Patch by Etienne PIERRE <e.ti.n.pierre at gmail.com> adding XMLRPC
methods getAllBuilders, getStatus, and getLastBuilds.
Original author: dustin at v.igoro.us
Date: 2008-02-29 15:34:17+00:00
Index: xmlrpc.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/status/web/xmlrpc.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- xmlrpc.py 30 Sep 2007 18:20:56 -0000 1.2
+++ xmlrpc.py 20 Mar 2008 18:04:53 -0000 1.3
@@ -16,6 +16,70 @@
self.control = req.site.buildbot_service.getControl()
return xmlrpc.XMLRPC.render(self, req)
+ def xmlrpc_getAllBuilders(self):
+ """Return a list of all builder names
+ """
+ log.msg("getAllBuilders")
+ return self.status.getBuilderNames()
+
+ def xmlrpc_getStatus(self, builder_name):
+ """Return the result of the last build for the given builder
+ """
+ builder = self.status.getBuilder(builder_name)
+ lastbuild = builder.getBuild(-1)
+ return Results[lastbuild.getResults()]
+
+ def xmlrpc_getLastBuilds(self, builder_name, num_builds):
+ """Return the last builds for the given builder
+ 'builder_name' is the name of the builder to query
+ 'num_builds' is the number of builds to return
+
+ Each build is returned in the same form as xmlrpc_getAllBuildsInInterval
+ """
+ log.msg("getLastBuilds: %s - %d" % (builder_name, num_builds))
+ builder = self.status.getBuilder(builder_name)
+ all_builds = []
+ for build_number in range(1, num_builds+1):
+ build = builder.getBuild(-build_number)
+ if not build:
+ break
+ if not build.isFinished():
+ continue
+ (build_start, build_end) = build.getTimes()
+
+ ss = build.getSourceStamp()
+ branch = ss.branch
+ if branch is None:
+ branch = ""
+ try:
+ revision = build.getProperty("got_revision")
+ except KeyError:
+ revision = ""
+ revision = str(revision)
+
+ answer = (builder_name,
+ build.getNumber(),
+ build_end,
+ branch,
+ revision,
+ Results[build.getResults()],
+ build.getText(),
+ )
+ all_builds.append((build_end, answer))
+
+ # now we've gotten all the builds we're interested in. Sort them by
+ # end time.
+ all_builds.sort(lambda a,b: cmp(a[0], b[0]))
+ # and remove the timestamps
+ all_builds = [t[1] for t in all_builds]
+
+ log.msg("ready to go: %s" % (all_builds,))
+
+ return all_builds
+
+
+
+
def xmlrpc_getAllBuildsInInterval(self, start, stop):
"""Return a list of builds that have completed after the 'start'
timestamp and before the 'stop' timestamp. This looks at all
More information about the Commits
mailing list