1
2 import urllib
3 from buildbot.status.web.base import HtmlResource, path_to_builder, \
4 path_to_build, css_classes
5 from buildbot.status.web.logs import LogsResource
6 from buildbot import util
7 from time import ctime
8
9
11 title = "Build Step"
12 addSlash = True
13
14 - def __init__(self, build_status, step_status):
18
19 - def content(self, req, cxt):
20 s = self.step_status
21 b = s.getBuild()
22
23 logs = cxt['logs'] = []
24 for l in s.getLogs():
25
26
27
28
29
30 logs.append({'has_contents': l.hasContents(),
31 'name': l.getName(),
32 'link': req.childLink("logs/%s" % urllib.quote(l.getName())) })
33
34 start, end = s.getTimes()
35
36 if start:
37 cxt['start'] = ctime(start)
38 if end:
39 cxt['end'] = ctime(end)
40 cxt['elapsed'] = util.formatInterval(end - start)
41 else:
42 cxt['end'] = "Not Finished"
43 cxt['elapsed'] = util.formatInterval(util.now() - start)
44
45 cxt.update(dict(builder_link = path_to_builder(req, b.getBuilder()),
46 build_link = path_to_build(req, b),
47 b = b,
48 s = s,
49 result_css = css_classes[b.getResults()]))
50
51 template = req.site.buildbot_service.templates.get_template("buildstep.html");
52 return template.render(**cxt)
53
58
59
60
61
74