def update_xml_feed(): """Generate events.xml into the event directory.""" feedName = os.path.join(builder.config.EVENT_DIR, "events.xml") print "Updating XML feed in %s..." % feedName out = file(feedName, 'wt') print >> out, '<?xml version="1.0" encoding="UTF-8"?>' print >> out, '<log>' for timestamp, ev in builder.events_by_time(): print >> out, ev.xml_description() print >> out, '</log>'
def find_previous_tag(toTag, version): builds = builder.events_by_time() #print [(e[1].number(), e[1].timestamp()) for e in builds] i = 0 while i < len(builds): ev = builds[i][1] print ev.tag(), ev.version(), ev.timestamp() if ev.tag() != toTag and (ev.version() is None or version is None or ev.version().startswith(version)): # This is good. return ev.tag() i += 1 # Nothing suitable found. Fall back to a more lax search. return find_previous_tag(toTag, None)
def update_feed(): """Generate events.rss into the event directory.""" feedName = os.path.join(builder.config.EVENT_DIR, "events.rss") print "Updating feed in %s..." % feedName out = file(feedName, 'wt') print >> out, '<?xml version="1.0" encoding="UTF-8"?>' print >> out, '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">' print >> out, '<channel>' print >> out, '<title>Doomsday Engine Builds</title>' print >> out, '<link>http://dengine.net/</link>' print >> out, '<atom:link href="%s/events.rss" rel="self" type="application/rss+xml" />' % builder.config.BUILD_URI print >> out, '<description>Automated binary builds of the Doomsday Engine.</description>' print >> out, '<language>en-us</language>' print >> out, '<webMaster>[email protected] (Jaakko Keränen)</webMaster>' print >> out, '<lastBuildDate>%s</lastBuildDate>' % time.strftime( builder.config.RFC_TIME, time.gmtime(builder.find_newest_event()['time'])) print >> out, '<generator>autobuild.py</generator>' print >> out, '<ttl>180</ttl>' # 3 hours for timestamp, ev in builder.events_by_time(): print >> out, '<item>' print >> out, '<title>Build %i</title>' % ev.number() print >> out, '<link>%s/%s/</link>' % ("http://dengine.net", ev.tag()) print >> out, '<author>[email protected] (skyjake)</author>' print >> out, '<pubDate>%s</pubDate>' % time.strftime( builder.config.RFC_TIME, time.gmtime(timestamp)) print >> out, '<atom:summary>%s</atom:summary>' % ev.text_summary() print >> out, '<description>%s</description>' % ev.html_description() print >> out, '<guid isPermaLink="false">%s</guid>' % ev.tag() print >> out, '</item>' write_index_html(ev.tag()) # Close. print >> out, '</channel>' print >> out, '</rss>'
def update_feed(): """Generate events.rss into the event directory.""" feedName = os.path.join(builder.config.EVENT_DIR, "events.rss") print "Updating feed in %s..." % feedName out = file(feedName, 'wt') print >> out, '<?xml version="1.0" encoding="UTF-8"?>' print >> out, '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">' print >> out, '<channel>' print >> out, '<title>Doomsday Engine Builds</title>' print >> out, '<link>http://dengine.net/</link>' print >> out, '<atom:link href="%s/events.rss" rel="self" type="application/rss+xml" />' % builder.config.BUILD_URI print >> out, '<description>Automated binary builds of the Doomsday Engine.</description>' print >> out, '<language>en-us</language>' print >> out, '<webMaster>[email protected] (Jaakko Keränen)</webMaster>' print >> out, '<lastBuildDate>%s</lastBuildDate>' % time.strftime(builder.config.RFC_TIME, time.gmtime(builder.find_newest_event()['time'])) print >> out, '<generator>autobuild.py</generator>' print >> out, '<ttl>180</ttl>' # 3 hours for timestamp, ev in builder.events_by_time(): print >> out, '<item>' print >> out, '<title>Build %i</title>' % ev.number() print >> out, '<link>%s/%s/</link>' % ("http://dengine.net", ev.tag()) print >> out, '<author>[email protected] (skyjake)</author>' print >> out, '<pubDate>%s</pubDate>' % time.strftime(builder.config.RFC_TIME, time.gmtime(timestamp)) print >> out, '<atom:summary>%s</atom:summary>' % ev.text_summary() print >> out, '<description>%s</description>' % ev.html_description() print >> out, '<guid isPermaLink="false">%s</guid>' % ev.tag() print >> out, '</item>' write_index_html(ev.tag()) # Close. print >> out, '</channel>' print >> out, '</rss>'
def find_previous_tag(toTag, version): """Finds the build tag preceding `toTag`. Arguments: toTag: Build tag ("buildNNNN"). version: The preceding build tag must be from this version, comparing only major and minor version components. Set to None to omit comparisons based on version. Returns: Build tag ("buildNNNN"). None, if there is no applicable previous build. """ builds = builder.events_by_time() # descending by timestamp print "Finding previous build for %s (version:%s)" % (toTag, version) # Disregard builds later than `toTag`. while len(builds) and builds[0][1].tag() != toTag: del builds[0] if len(builds): del builds[0] # == toTag if len(builds) == 0: return None for timestamp, ev in builds: print ev.tag(), ev.version(), time.strftime( '%Y-%m-%d %H:%M:%S', time.gmtime(ev.timestamp())) if version is None: # Anything goes. return ev.tag() else: requiredVer = version_split(version) eventVer = version_split(ev.version()) if requiredVer[:2] == eventVer[:2]: return ev.tag() # Nothing suitable found. Fall back to a more lax search. return find_previous_tag(toTag, None)
def find_previous_tag(toTag, version): """Finds the build tag preceding `toTag`. Arguments: toTag: Build tag ("buildNNNN"). version: The preceding build tag must be from this version, comparing only major and minor version components. Set to None to omit comparisons based on version. Returns: Build tag ("buildNNNN"). None, if there is no applicable previous build. """ builds = builder.events_by_time() # descending by timestamp print "Finding previous build for %s (version:%s)" % (toTag, version) # Disregard builds later than `toTag`. while len(builds) and builds[0][1].tag() != toTag: del builds[0] if len(builds): del builds[0] # == toTag if len(builds) == 0: return None for timestamp, ev in builds: print ev.tag(), ev.version(), time.strftime('%Y-%m-%d %H:%M:%S', time.gmtime(ev.timestamp())) if version is None: # Anything goes. return ev.tag() else: requiredVer = version_split(version) eventVer = version_split(ev.version()) if requiredVer[:2] == eventVer[:2]: return ev.tag() # Nothing suitable found. Fall back to a more lax search. return find_previous_tag(toTag, None)
def update_feed(): """Generate events.rss into the event directory.""" feedName = os.path.join(builder.config.EVENT_DIR, "events.rss") print "Updating feed in %s..." % feedName out = file(feedName, 'wt') print >> out, '<?xml version="1.0" encoding="UTF-8"?>' print >> out, '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">' print >> out, '<channel>' print >> out, '<title>Doomsday Engine Builds</title>' print >> out, '<link>http://dengine.net/</link>' print >> out, '<atom:link href="%s/events.rss" rel="self" type="application/rss+xml" />' % builder.config.BUILD_URI print >> out, '<description>Automated binary builds of the Doomsday Engine.</description>' print >> out, '<language>en-us</language>' print >> out, '<webMaster>[email protected] (Jaakko Keränen)</webMaster>' print >> out, '<lastBuildDate>%s</lastBuildDate>' % time.strftime(builder.config.RFC_TIME, time.gmtime(builder.find_newest_event()['time'])) 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://files.dengine.net/builds", ev.name) print >> out, '<author>[email protected] (skyjake)</author>' print >> out, '<pubDate>%s</pubDate>' % time.strftime(builder.config.RFC_TIME, time.gmtime(timestamp)) print >> out, '<atom:summary>%s</atom:summary>' % ev.text_summary() print >> out, '<description>%s</description>' % ev.html_description() print >> out, '<guid isPermaLink="false">%s</guid>' % ev.tag() print >> out, '</item>' 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></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://files.dengine.net/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://files.dengine.net/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_feed(): """Generate events.rss into the event directory.""" feedName = os.path.join(builder.config.EVENT_DIR, "events.rss") print "Updating feed in %s..." % feedName out = file(feedName, 'wt') print >> out, '<?xml version="1.0" encoding="UTF-8"?>' print >> out, '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">' print >> out, '<channel>' print >> out, '<title>Doomsday Engine Builds</title>' print >> out, '<link>http://dengine.net/</link>' print >> out, '<atom:link href="%s/events.rss" rel="self" type="application/rss+xml" />' % builder.config.BUILD_URI print >> out, '<description>Automated binary builds of the Doomsday Engine.</description>' print >> out, '<language>en-us</language>' print >> out, '<webMaster>[email protected] (Jaakko Keränen)</webMaster>' print >> out, '<lastBuildDate>%s</lastBuildDate>' % time.strftime( builder.config.RFC_TIME, time.gmtime(builder.find_newest_event()['time'])) 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()) print >> out, '<author>[email protected] (skyjake)</author>' print >> out, '<pubDate>%s</pubDate>' % time.strftime( builder.config.RFC_TIME, time.gmtime(timestamp)) print >> out, '<atom:summary>%s</atom:summary>' % ev.text_summary() print >> out, '<description>%s</description>' % ev.html_description() print >> out, '<guid isPermaLink="false">%s</guid>' % ev.tag() print >> out, '</item>' 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)