Skip to content

Commit

Permalink
Builder: Generate an index page for code.iki.fi/builds/
Browse files Browse the repository at this point in the history
Latest builds and builds by version.
  • Loading branch information
skyjake committed Jul 28, 2015
1 parent 5c5691e commit 27cfd97
Show file tree
Hide file tree
Showing 2 changed files with 164 additions and 8 deletions.
51 changes: 43 additions & 8 deletions distrib/autobuild.py
Expand Up @@ -260,21 +260,26 @@ def rebuild_apt_repository():
os.system("~/Dropbox/Scripts/mirror-tree.py %s %s" % (aptDir, os.path.join(builder.config.EVENT_DIR, 'apt')))


def write_index_html(tag):
ev = builder.Event(tag)
f = file(ev.file_path('index.html'), 'wt')
def write_html_page(outPath, title, content):
f = file(outPath, 'wt')
print >> f, "<html><head>"
print >> f, '<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">'
print >> f, "<title>Build %i</title>" % ev.number()
print >> f, "<title>%s</title>" % title
print >> f, "<link href='http://fonts.googleapis.com/css?family=Open+Sans:400italic,400,300,700' rel='stylesheet' type='text/css'>"
print >> f, "<link href='../../build.css' rel='stylesheet' type='text/css'>"
print >> f, "<link href='http://code.iki.fi/build.css' rel='stylesheet' type='text/css'>"
print >> f, "</head><body><div id='content-outer'><div id='content-inner'>"
print >> f, "<h1>Build %i</h1>" % ev.number()
print >> f, ev.html_description(False)
print >> f, "<h1>%s</h1>" % title
print >> f, content
print >> f, "</div></div></body>"
print >> f, "</html>"


def write_report_html(tag):
ev = builder.Event(tag)
write_html_page(ev.file_path('index.html'), 'Build %i' % ev.number(),
ev.html_description(False))


def update_feed():
"""Generate events.rss into the event directory."""

Expand All @@ -297,7 +302,10 @@ def update_feed():
print >> out, '<generator>autobuild.py</generator>'
print >> out, '<ttl>180</ttl>' # 3 hours

allEvents = []

for timestamp, ev in builder.events_by_time():
allEvents.append((timestamp, ev))
print >> out, '<item>'
print >> out, '<title>Build %i</title>' % ev.number()
print >> out, '<link>%s/%s/</link>' % ("http://dengine.net", ev.tag())
Expand All @@ -308,12 +316,39 @@ def update_feed():
print >> out, '<guid isPermaLink="false">%s</guid>' % ev.tag()
print >> out, '</item>'

write_index_html(ev.tag())
write_report_html(ev.tag())

# Close.
print >> out, '</channel>'
print >> out, '</rss>'

# Write a index page for all the builds.
versions = {}
text = '<p class="links"><a href="events.rss">RSS Feed</a> | <a href="events.xml">XML Feed</a> | <a href="apt">Apt Repository</a></p>'
text += '<h2>Latest Builds</h2>'
text += '<div class="buildlist">'
for timestamp, ev in allEvents:
eventVersion = '.'.join(ev.version().split('.')[:2])
if eventVersion in versions:
versions[eventVersion].append(ev)
else:
versions[eventVersion] = [ev]
text += '<div class="build %s"><a href="http://code.iki.fi/builds/build%i"><div class="buildnumber">%i</div><div class="builddate">%s</div><div class="buildversion">%s</div></a></div>' % (ev.release_type(), ev.number(), ev.number(),
time.strftime('%b %d', time.gmtime(timestamp)), ev.version())
text += '</div>'

text += '<h2>Versions</h2>'
for version in versions.keys():
text += '<h3>%s</h3>' % version
text += '<div class="buildlist">'
for ev in versions[version]:
text += '<div class="build %s"><a href="http://code.iki.fi/builds/build%i"><div class="buildnumber">%i</div><div class="builddate">%s</div><div class="buildversion">%s</div></a></div>' % (ev.release_type(), ev.number(), ev.number(),
time.strftime('%b %d', time.gmtime(ev.timestamp())), ev.version())
text += '</div>'

write_html_page(os.path.join(builder.config.EVENT_DIR, "index.html"),
'Doomsday Autobuilder', text)


def update_xml_feed():
"""Generate events.xml into the event directory."""
Expand Down
121 changes: 121 additions & 0 deletions distrib/build.css
@@ -0,0 +1,121 @@
body {
font-family: "Open Sans";
}
#content-outer { }
#content-inner {
max-width: 45em;
margin: 0 auto;
}

h1, h2 {
font-weight: 300;
text-align: center;
}

h1 {
font-size: 275%;
margin-top: 1em;
}

h2 {
font-size: 200%;
margin-top: 1.5em;
}

h3 {
font-size: 150%;
margin-top: 1.5em;
}

p {
color: #666;
text-align: justify;
-webkit-hyphens: auto;
-moz-hyphens: auto;
-ms-hyphens: auto;
hyphens: auto;
}
ul {
color: #666;
}
blockquote {
font-size: 95%;
color: #aaa !important;
margin-left: 0em;
margin-top: 1ex;
padding-left: 1em;
border-left: 2px solid #ddd;
}
blockquote:hover {
border-left: 2px solid #2c2;
color: #666 !important;
}

a {
color: #191;
text-decoration: none;
}

a:hover {
text-decoration: underline;
}

table {
margin: auto;
}
th {
border-bottom: 1px solid #ccc;
}
td, th {
padding: 0.5ex;
}

/* Build List */

.links {
text-align: center;
}

div.buildlist {
text-align: center;
}

div.build {
min-width: 5em;
display: inline-block;
border: 1px solid #bdb;
border-radius: 1ex;
margin: 0.5ex;
padding: 1ex;
text-align: center;
}

div.build.candidate {
border-color: #da8;
background: #fd8;
}

div.build.stable {
border-color: #371;
background: #6a3;
}

div.build.candidate a {
color: #850;
}

div.build.stable a {
color: white;
}

.buildnumber {
font-size: 150%;
}

.builddate, .buildversion {
font-size: 80%;
}

.buildversion {
font-weight: 300;
}

0 comments on commit 27cfd97

Please sign in to comment.