[Buildbot-devel] (no subject)
Mark Pauley
mpauley at apple.com
Tue Apr 18 18:20:55 UTC 2006
So, I've got a quick RFC.
I found that I really wanted
a: to have a scheduler that completely ignores unimportant changes
b: to have the waterfall status class allow a refresh value.
Here are my diffs, I am completely open to suggestions (like for
example name changes) :)
Index: buildbot/scheduler.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/scheduler.py,v
retrieving revision 1.15
diff -U5 -r1.15 scheduler.py
--- buildbot/scheduler.py 12 Mar 2006 11:28:04 -0000 1.15
+++ buildbot/scheduler.py 18 Apr 2006 18:19:01 -0000
@@ -180,10 +180,13 @@
def stopService(self):
self.stopTimer()
return service.MultiService.stopService(self)
+class OnlyImportantScheduler(Scheduler):
+ def addUnimportantChange(self, change):
+ log.msg("%s: change is not important, discarding %s" % (self,
change))
class AnyBranchScheduler(BaseUpstreamScheduler):
"""This Scheduler will handle changes on a variety of branches.
It will
accumulate Changes for each branch separately. It works by
creating a
separate Scheduler for each new branch it sees."""
Index: buildbot/status/html.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/status/html.py,v
retrieving revision 1.81
diff -U5 -r1.81 html.py
--- buildbot/status/html.py 12 Mar 2006 11:28:02 -0000 1.81
+++ buildbot/status/html.py 18 Apr 2006 18:19:01 -0000
@@ -142,10 +142,11 @@
return td(text, props, bgcolor=self.color, class_=self.class_)
class HtmlResource(Resource):
css = None
+ refresh = None
contentType = "text/html; charset=UTF-8"
def render(self, request):
data = self.content(request)
request.setHeader("content-type", self.contentType)
if request.method == "HEAD":
@@ -161,10 +162,13 @@
' xmlns="http://www.w3.org/1999/xhtml"'
' lang="en"'
' xml:lang="en">\n')
data += "<head>\n"
data += " <title>" + self.title + "</title>\n"
+ if self.refresh:
+ data += ' <meta http-equiv="refresh" '
+ data += 'content="' + self.refresh + '"/>\n'
if self.css:
# TODO: use some sort of relative link up to the root
page, so
# this css can be used from child pages too
data += (' <link href="%s" rel="stylesheet" type="text/
css"/>\n'
% "buildbot.css")
@@ -1057,19 +1061,21 @@
class WaterfallStatusResource(HtmlResource):
"""This builds the main status page, with the waterfall display,
and
all child pages."""
title = "BuildBot"
- def __init__(self, status, changemaster, categories, css=None):
+ def __init__(self, status, changemaster, categories, css=None,
+ refresh=None):
HtmlResource.__init__(self)
self.status = status
self.changemaster = changemaster
self.categories = categories
p = self.status.getProjectName()
if p:
self.title = "BuildBot: %s" % p
self.css = css
+ self.refresh = refresh
def body(self, request):
"This method builds the main waterfall display."
phase = request.args.get("phase",["2"])
phase = int(phase[0])
@@ -1546,11 +1552,12 @@
class StatusResource(Resource):
status = None
control = None
favicon = None
- def __init__(self, status, control, changemaster, categories, css):
+ def __init__(self, status, control, changemaster, categories, css,
+ refresh):
"""
@type status: L{buildbot.status.builder.Status}
@type control: L{buildbot.master.Control}
@type changemaster: L{buildbot.changes.changes.ChangeMaster}
"""
@@ -1558,12 +1565,13 @@
self.status = status
self.control = control
self.changemaster = changemaster
self.categories = categories
self.css = css
+ self.refresh = refresh
waterfall = WaterfallStatusResource(self.status, changemaster,
- categories, css)
+ categories, css, refresh)
self.putChild("", waterfall)
def render(self, request):
request.redirect(request.prePathURL() + '/')
request.finish()
@@ -1634,11 +1642,12 @@
compare_attrs = ["http_port", "distrib_port", "allowForce",
"categories", "css", "favicon"]
def __init__(self, http_port=None, distrib_port=None,
allowForce=True,
- categories=None, css=buildbot_css,
favicon=buildbot_icon):
+ categories=None, css=buildbot_css,
favicon=buildbot_icon,
+ refresh=None):
"""To have the buildbot run its own web server, pass a port
number to
C{http_port}. To have it run a web.distrib server
@type http_port: int or L{twisted.application.strports}
string
@param http_port: a strports specification describing which
port the
@@ -1683,11 +1692,14 @@
browsers automatically request this file and
use it
as an icon in any bookmark generated from
this site.
Defaults to the buildbot/buildbot.png image
provided
in the distribution. Can be set to None to
avoid
using a favicon at all.
-
+
+ @type refresh: string
+ @param refresh: if set, emit a meta refresh tag in the head
of page
+
"""
base.StatusReceiverMultiService.__init__(self)
assert allowForce in (True, False) # TODO: implement others
if type(http_port) is int:
http_port = "tcp:%d" % http_port
@@ -1700,10 +1712,11 @@
self.distrib_port = distrib_port
self.allowForce = allowForce
self.categories = categories
self.css = css
self.favicon = favicon
+ self.refresh = refresh
def __repr__(self):
if self.http_port is None:
return "<Waterfall on path %s>" % self.distrib_port
if self.distrib_port is None:
@@ -1724,11 +1737,11 @@
control = interfaces.IControl(self.parent)
else:
control = None
change_svc = self.parent.change_svc
sr = StatusResource(status, control, change_svc,
self.categories,
- self.css)
+ self.css, self.refresh)
sr.favicon = self.favicon
self.site = server.Site(sr)
if self.http_port is not None:
s = strports.service(self.http_port, self.site)
_Mark
More information about the devel
mailing list