annotate contrib/sawmill/web/templates/details.html @ 559:3fbf0ea1740a

Fix: use self.branch to check if it contains a ":" branch variable could be None
author Bjoern Ricks <bricks@intevation.de>
date Fri, 02 Sep 2011 09:28:27 +0000
parents e075ce66e085
children
rev   line source
473
d8012571f9e1 sawmill: removed trailing whitespace
Sascha Teichmann <teichmann@intevation.de>
parents: 472
diff changeset
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
452
333232953771 Initial check-in of sawmill a simple mod_python based
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
2 "http://www.w3.org/TR/html4/loose.dtd">
486
283154e189d9 sawmill: Moved python blocks in templates to make them more readable.
Sascha Teichmann <teichmann@intevation.de>
parents: 485
diff changeset
3 <html>
283154e189d9 sawmill: Moved python blocks in templates to make them more readable.
Sascha Teichmann <teichmann@intevation.de>
parents: 485
diff changeset
4 <%@include file="header.inc" %>
488
a0d19e20fb89 sawmill: moved imports before there usage
Sascha Teichmann <teichmann@intevation.de>
parents: 486
diff changeset
5 <%
a0d19e20fb89 sawmill: moved imports before there usage
Sascha Teichmann <teichmann@intevation.de>
parents: 486
diff changeset
6 from cgi import escape
a0d19e20fb89 sawmill: moved imports before there usage
Sascha Teichmann <teichmann@intevation.de>
parents: 486
diff changeset
7 from xml.sax.saxutils import quoteattr
a0d19e20fb89 sawmill: moved imports before there usage
Sascha Teichmann <teichmann@intevation.de>
parents: 486
diff changeset
8 from datetime import date, datetime
a0d19e20fb89 sawmill: moved imports before there usage
Sascha Teichmann <teichmann@intevation.de>
parents: 486
diff changeset
9 %>
486
283154e189d9 sawmill: Moved python blocks in templates to make them more readable.
Sascha Teichmann <teichmann@intevation.de>
parents: 485
diff changeset
10 <div class="css_prison">
283154e189d9 sawmill: Moved python blocks in templates to make them more readable.
Sascha Teichmann <teichmann@intevation.de>
parents: 485
diff changeset
11 <h1><%= escape(description) %></h1>
283154e189d9 sawmill: Moved python blocks in templates to make them more readable.
Sascha Teichmann <teichmann@intevation.de>
parents: 485
diff changeset
12 <%= header %>
283154e189d9 sawmill: Moved python blocks in templates to make them more readable.
Sascha Teichmann <teichmann@intevation.de>
parents: 485
diff changeset
13 <table class="statustable">
283154e189d9 sawmill: Moved python blocks in templates to make them more readable.
Sascha Teichmann <teichmann@intevation.de>
parents: 485
diff changeset
14 <tr>
283154e189d9 sawmill: Moved python blocks in templates to make them more readable.
Sascha Teichmann <teichmann@intevation.de>
parents: 485
diff changeset
15 <th class="statustablehead">Status</th>
283154e189d9 sawmill: Moved python blocks in templates to make them more readable.
Sascha Teichmann <teichmann@intevation.de>
parents: 485
diff changeset
16 <th class="statustablehead">Package</th>
283154e189d9 sawmill: Moved python blocks in templates to make them more readable.
Sascha Teichmann <teichmann@intevation.de>
parents: 485
diff changeset
17 <th class="statustablehead">Revision</th>
283154e189d9 sawmill: Moved python blocks in templates to make them more readable.
Sascha Teichmann <teichmann@intevation.de>
parents: 485
diff changeset
18 <th class="statustablehead">Start</th>
283154e189d9 sawmill: Moved python blocks in templates to make them more readable.
Sascha Teichmann <teichmann@intevation.de>
parents: 485
diff changeset
19 <th class="statustablehead">Stop</th>
283154e189d9 sawmill: Moved python blocks in templates to make them more readable.
Sascha Teichmann <teichmann@intevation.de>
parents: 485
diff changeset
20 <th class="statustablehead">Duration</th>
283154e189d9 sawmill: Moved python blocks in templates to make them more readable.
Sascha Teichmann <teichmann@intevation.de>
parents: 485
diff changeset
21 <th class="statustablehead">Notes</th>
283154e189d9 sawmill: Moved python blocks in templates to make them more readable.
Sascha Teichmann <teichmann@intevation.de>
parents: 485
diff changeset
22 </tr>
452
333232953771 Initial check-in of sawmill a simple mod_python based
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
23 <%
482
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
24 def nn(s, d=""):
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
25 if not s: return d
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
26 return escape(s)
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
27
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
28 def pretty_time(t, format="%H:%M:%S"):
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
29 if not t: return "&lt;unknown&gt;"
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
30 return t.strftime(format)
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
31
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
32 def pretty_timedelta(a, b):
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
33 if a is None or b is None: return "&lt;unknown&gt;"
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
34 td = a - b
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
35 secs = td.days * 24*3600 + td.seconds
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
36 out = []
493
e075ce66e085 sawmill: fixed stupid time calc bug
Sascha Teichmann <teichmann@intevation.de>
parents: 490
diff changeset
37 if secs >= 3600:
482
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
38 hs = secs // 3600
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
39 out.append("%dh" % hs)
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
40 secs %= 3600
493
e075ce66e085 sawmill: fixed stupid time calc bug
Sascha Teichmann <teichmann@intevation.de>
parents: 490
diff changeset
41 if secs >= 60:
482
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
42 ms = secs // 60
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
43 out.append("%dm" % ms)
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
44 secs %= 60
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
45 if secs > 0 or not out:
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
46 out.append("%ds" % secs)
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
47 return " ".join(out)
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
48
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
49 def date_from_datetime(x):
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
50 if not x: return None
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
51 return date(x.year, x.month, x.day)
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
52
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
53 def sort_by_start(a, b):
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
54 a_start = a.build_start
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
55 b_start = b.build_start
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
56 if not a_start and not b_start: return 0
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
57 if not a_start: return 1
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
58 if not b_start: return -1
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
59 return cmp(a_start, b_start)
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
60
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
61 def create_tags_link(tag_url):
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
62 return quoteattr(tag_url.replace(
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
63 "svn://anonsvn.kde.org/home/kde",
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
64 "http://websvn.kde.org"))
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
65
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
66 track_items = sorted(track_items, cmp=sort_by_start, reverse=True)
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
67
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
68 last_date = None
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
69
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
70 STATUS2CLASS = {
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
71 'creating_binary_package': 'inprogress',
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
72 'creating_source_package': 'inprogress',
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
73 'source_package_created': 'inprogress',
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
74 'binary_package_created': 'finished'
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
75 }
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
76
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
77 STATUS2MSG = {
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
78 'creating_binary_package': 'building binary packages',
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
79 'creating_source_package': 'building source package',
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
80 'source_package_created': 'preparing build envrionment',
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
81 'binary_package_created': 'success'
a89f73f7c965 sawmill: Rearranged the postion of some python code in the details template to
Sascha Teichmann <teichmann@intevation.de>
parents: 481
diff changeset
82 }
452
333232953771 Initial check-in of sawmill a simple mod_python based
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
83
333232953771 Initial check-in of sawmill a simple mod_python based
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
84 for track_item in track_items:
333232953771 Initial check-in of sawmill a simple mod_python based
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
85 # for all track items
333232953771 Initial check-in of sawmill a simple mod_python based
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
86 curr_date = date_from_datetime(track_item.build_start)
333232953771 Initial check-in of sawmill a simple mod_python based
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
87 if curr_date != last_date:
333232953771 Initial check-in of sawmill a simple mod_python based
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
88 last_date = curr_date
490
73a2e603a23b sawmill: Prepared detail view for syndication:
Sascha Teichmann <teichmann@intevation.de>
parents: 489
diff changeset
89 %><tr class="date_row"><td colspan="7"><%= pretty_time(last_date, "%Y-%m-%d") %> (times in UTC)</td></tr><%
452
333232953771 Initial check-in of sawmill a simple mod_python based
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
90 # date changed
333232953771 Initial check-in of sawmill a simple mod_python based
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
91 %>
333232953771 Initial check-in of sawmill a simple mod_python based
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
92 <tr class="<%= STATUS2CLASS.get(track_item.build_status, 'error') %>">
490
73a2e603a23b sawmill: Prepared detail view for syndication:
Sascha Teichmann <teichmann@intevation.de>
parents: 489
diff changeset
93 <td><a name=<%= quoteattr(track_item.build_label) %>><%= STATUS2MSG.get(track_item.build_status, 'error') %></a></td>
73a2e603a23b sawmill: Prepared detail view for syndication:
Sascha Teichmann <teichmann@intevation.de>
parents: 489
diff changeset
94 <td><b><%= nn(track_item.track) %></b></td>
484
2e947f508553 sawmill: Improved HTML 4.01 transitional compat a bit.
Sascha Teichmann <teichmann@intevation.de>
parents: 483
diff changeset
95 <td align="right"><%
474
a8f77807d710 sawmill: create links for tag builds
Sascha Teichmann <teichmann@intevation.de>
parents: 473
diff changeset
96 tags = track_item.build_tags
a8f77807d710 sawmill: create links for tag builds
Sascha Teichmann <teichmann@intevation.de>
parents: 473
diff changeset
97 if tags:
a8f77807d710 sawmill: create links for tag builds
Sascha Teichmann <teichmann@intevation.de>
parents: 473
diff changeset
98 # a tag
490
73a2e603a23b sawmill: Prepared detail view for syndication:
Sascha Teichmann <teichmann@intevation.de>
parents: 489
diff changeset
99 %><a href=<%= create_tags_link(tags) %>><strong><%= nn(track_item.revision) %></strong></a><%
474
a8f77807d710 sawmill: create links for tag builds
Sascha Teichmann <teichmann@intevation.de>
parents: 473
diff changeset
100 else:
a8f77807d710 sawmill: create links for tag builds
Sascha Teichmann <teichmann@intevation.de>
parents: 473
diff changeset
101 # not a tag
484
2e947f508553 sawmill: Improved HTML 4.01 transitional compat a bit.
Sascha Teichmann <teichmann@intevation.de>
parents: 483
diff changeset
102 %><%= nn(track_item.revision) %><%
474
a8f77807d710 sawmill: create links for tag builds
Sascha Teichmann <teichmann@intevation.de>
parents: 473
diff changeset
103 # end if tags
484
2e947f508553 sawmill: Improved HTML 4.01 transitional compat a bit.
Sascha Teichmann <teichmann@intevation.de>
parents: 483
diff changeset
104 %></td>
478
7504ed4437e1 sawmill: short start and stop to %H:%M:%S because
Sascha Teichmann <teichmann@intevation.de>
parents: 477
diff changeset
105 <td align="right"><%= pretty_time(track_item.build_start) %></td>
7504ed4437e1 sawmill: short start and stop to %H:%M:%S because
Sascha Teichmann <teichmann@intevation.de>
parents: 477
diff changeset
106 <td align="right"><%= pretty_time(track_item.build_stop) %></td>
7504ed4437e1 sawmill: short start and stop to %H:%M:%S because
Sascha Teichmann <teichmann@intevation.de>
parents: 477
diff changeset
107 <td align="right"><%= pretty_timedelta(track_item.stop, track_item.build_start) %></td>
490
73a2e603a23b sawmill: Prepared detail view for syndication:
Sascha Teichmann <teichmann@intevation.de>
parents: 489
diff changeset
108 <td><%
452
333232953771 Initial check-in of sawmill a simple mod_python based
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
109 for log_desc, log_path in track_item.build_logs:
333232953771 Initial check-in of sawmill a simple mod_python based
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
110 # for all logs
490
73a2e603a23b sawmill: Prepared detail view for syndication:
Sascha Teichmann <teichmann@intevation.de>
parents: 489
diff changeset
111 %>[<a href=<%= quoteattr("%s/%s" % (base_dir, log_path)) %>><%= nn(log_desc) %></a>]
452
333232953771 Initial check-in of sawmill a simple mod_python based
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
112 <%
333232953771 Initial check-in of sawmill a simple mod_python based
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
113 # for all logs
490
73a2e603a23b sawmill: Prepared detail view for syndication:
Sascha Teichmann <teichmann@intevation.de>
parents: 489
diff changeset
114 %></td></tr><%
452
333232953771 Initial check-in of sawmill a simple mod_python based
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
115 # for all track itemes
333232953771 Initial check-in of sawmill a simple mod_python based
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
116 %>
333232953771 Initial check-in of sawmill a simple mod_python based
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
117
333232953771 Initial check-in of sawmill a simple mod_python based
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
118 </table>
475
7be221f41f58 sawmill: Added 'powered by Tree Packager' line in details view.
Sascha Teichmann <teichmann@intevation.de>
parents: 474
diff changeset
119 <hr>
478
7504ed4437e1 sawmill: short start and stop to %H:%M:%S because
Sascha Teichmann <teichmann@intevation.de>
parents: 477
diff changeset
120 report generated at <%= pretty_time(datetime.now(), "%Y-%m-%d %H:%M:%S") %>, powered
475
7be221f41f58 sawmill: Added 'powered by Tree Packager' line in details view.
Sascha Teichmann <teichmann@intevation.de>
parents: 474
diff changeset
121 by <a href="http://treepkg.wald.intevation.org">Tree Packager</a>
485
a55a521b7a31 Moved the saegewerk table layout completely into header and footer
Sascha Teichmann <teichmann@intevation.de>
parents: 484
diff changeset
122 </div>
452
333232953771 Initial check-in of sawmill a simple mod_python based
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
123
483
28aa6ac933fb sawmill: moved wald's table layout into common header and footer
Sascha Teichmann <teichmann@intevation.de>
parents: 482
diff changeset
124 <%@include file="footer.inc" %>
452
333232953771 Initial check-in of sawmill a simple mod_python based
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
125 </html>
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)