]>
git.ipfire.org Git - ipfire.org.git/blob - build/index.py
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2008 Michael Tremer & Christian Schmidt #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
28 from builder
import Builder
, getAllBuilders
29 from constants
import *
31 def format_time(seconds
, use_hours
=1):
32 if seconds
is None or seconds
< 0:
33 if use_hours
: return '--:--:--'
36 seconds
= int(seconds
)
37 minutes
= seconds
/ 60
38 seconds
= seconds
% 60
41 minutes
= minutes
% 60
42 return '%02i:%02i:%02i' % (hours
, minutes
, seconds
)
44 return '%02i:%02i' % (minutes
, seconds
)
47 def __init__(self
, config
):
50 print "Content-type: text/html"
53 def __call__(self
, builders
=None):
54 self
.builders
= builders
55 print """<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
56 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
57 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
59 <title>%(title)s</title>
60 <style type="text/css">
64 text-decoration: none;
70 background-color:#f9f9f9;
73 text-decoration: underline;
80 border: 1px solid #999;
89 margin: 10px 0 10px 0;
101 /* visibility: hidden; */
104 font-family: Courier New;
132 text-decoration: bold;
135 color: black; text-decoration: none;
138 color: black; text-decoration: none;
141 <meta http-equiv="refresh" content="90; URL=%(script)s" />
145 <h1>IPFire Builder</h1>""" % self
.config
150 for builder
in self
.builders
:
154 for i
in self
.config
["nightly_url"]:
156 <p><a href="%s" target="_blank">%s</a></p>""" % (i
, i
,)
162 print "\t\t</body>\n</html>"
168 <div id="content">"""
169 for builder
in self
.builders
:
176 def __init__(self
, builder
):
177 self
.builder
= builder
179 def __call__(self
, count
):
182 <div class="box" style="%s">"""\
183 % (self
.builder
.hostname(), state2style
[self
.builder
.state()],)
185 <div class="infobox">"""
194 if self
.builder
.state() == "error":
201 return """<a href="#%(hostname)s">%(hostname)s</a>""" % { "hostname" : self
.builder
.hostname(), }
205 <p class="boxheader">
206 %(hostname)s <span>[%(uuid)s]</span>
208 <!-- <img class="right" src="/images/%(state)s.png" /> -->""" \
209 % { "hostname" : self
.builder
.hostname(),
210 "state" : self
.builder
.state(),
211 "uuid" : self
.builder
.uuid
, }
214 if self
.builder
.state() in [ "compiling", "error", ]:
216 <p class="package">%s</p>"""\
217 % self
.builder
.package()
222 % time
.ctime(float(self
.builder
.state
.time()))
225 if self
.builder
.state() in [ "compiling", "error", "idle", ]:
227 <p class="desc">%s</p>""" \
228 % statedesc
[self
.builder
.state()]
232 <p>Average Build Duration: %s</p>""" \
233 % format_time(self
.builder
.duration
.get_avg())
234 if self
.builder
.state() == "compiling":
237 % self
.builder
.duration
.get_eta(self
.builder
.state
.time())
239 def distccinfo(self
):
240 state
= self
.builder
.distcc
.ping()
241 port
= self
.builder
.distcc()
246 <p class="%s">Distcc: %s</p>""" \
247 % (ping2class
[state
], port
,)
250 log
= self
.builder
.log()
256 print "%s<br />" % (i
.rstrip("\n"),)
265 <p>target: %s - jobs: %s</p>
267 """ % (self
.builder
.target(), self
.builder
.jobs(),)
272 for builder
in getAllBuilders(3):
273 boxes
.append(Box(builder
))