? atom.patch
? rss.patch
Index: jhbuild/config.py
===================================================================
RCS file: /cvs/gnome/jhbuild/jhbuild/config.py,v
retrieving revision 1.21
diff -u -b -B -r1.21 config.py
--- jhbuild/config.py	30 Nov 2004 10:17:15 -0000	1.21
+++ jhbuild/config.py	5 Aug 2005 16:35:11 -0000
@@ -33,7 +33,7 @@
                 'builddir_pattern', 'module_autogenargs', 'module_makeargs',
                 'interact', 'buildscript', 'nonetwork',
                 'alwaysautogen', 'nobuild', 'makeclean', 'makecheck',
-                'use_lib64', 'tinderbox_outputdir', 'sticky_date',
+                'use_lib64', 'tinderbox_outputdir', 'feed_url', 'sticky_date',
                 'tarballdir', 'pretty_print' ]
 
 env_prepends = {}
Index: jhbuild/defaults.jhbuildrc
===================================================================
RCS file: /cvs/gnome/jhbuild/jhbuild/defaults.jhbuildrc,v
retrieving revision 1.16
diff -u -b -B -r1.16 defaults.jhbuildrc
--- jhbuild/defaults.jhbuildrc	9 May 2005 05:48:02 -0000	1.16
+++ jhbuild/defaults.jhbuildrc	5 Aug 2005 16:35:11 -0000
@@ -67,6 +67,9 @@
 # where to put tinderbox output
 tinderbox_outputdir = None
 
+# URL for rss feed
+feed_url = 'http://localhost/jhbuild'
+
 # sticky date to perform historic checkouts
 sticky_date = None
 
Index: jhbuild/main.py
===================================================================
RCS file: /cvs/gnome/jhbuild/jhbuild/main.py,v
retrieving revision 1.17
diff -u -b -B -r1.17 main.py
--- jhbuild/main.py	11 Dec 2004 17:29:24 -0000	1.17
+++ jhbuild/main.py	5 Aug 2005 16:35:11 -0000
@@ -64,6 +64,7 @@
 
 Options valid for the tinderbox command:
   -o, --output=DIR             directory to save build logs in
+  -u, --url=URL                url where your build logs are kept
 
 Options valid for the list command:
   -r, --show-revision          show which revision will be built
Index: jhbuild/commands/tinderbox.py
===================================================================
RCS file: /cvs/gnome/jhbuild/jhbuild/commands/tinderbox.py,v
retrieving revision 1.7
diff -u -b -B -r1.7 tinderbox.py
--- jhbuild/commands/tinderbox.py	23 Mar 2004 08:05:46 -0000	1.7
+++ jhbuild/commands/tinderbox.py	5 Aug 2005 16:35:11 -0000
@@ -26,9 +26,9 @@
     config.buildscript = 'tinderbox'
 
     startat = None
-    opts, args = getopt.getopt(args, 'acno:s:t:D:',
+    opts, args = getopt.getopt(args, 'acno:u:s:t:D:',
                                ['autogen', 'clean', 'no-network', 'output=',
-                                'skip=', 'start-at='])
+                                'url=','skip=', 'start-at='])
 
     for opt, arg in opts:
         if opt in ('-a', '--autogen'):
@@ -43,6 +43,8 @@
             startat = arg
         elif opt in ('-o', '--output'):
             config.tinderbox_outputdir = arg
+        elif opt in ('-u', '--url'):
+            config.feed_url = arg
         elif opt == '-D':
             config.sticky_date = arg
 
Index: jhbuild/frontends/tinderbox.py
===================================================================
RCS file: /cvs/gnome/jhbuild/jhbuild/frontends/tinderbox.py,v
retrieving revision 1.14
diff -u -b -B -r1.14 tinderbox.py
--- jhbuild/frontends/tinderbox.py	27 Jun 2005 03:31:59 -0000	1.14
+++ jhbuild/frontends/tinderbox.py	5 Aug 2005 16:35:11 -0000
@@ -20,6 +20,7 @@
 import os
 import time
 import subprocess
+import re
 
 from jhbuild.utils import cmds
 import buildscript
@@ -27,6 +28,7 @@
 index_header = '''<html>
   <head>
     <title>JHBuild Results</title>
+    <link rel="meta" type="application/atom+xml" title="Atom Feed" href="atom.xml" />
     <style type="text/css">
       .section {
         margin-after: 1.5em;
@@ -106,6 +108,49 @@
 </html>
 '''
 
+feed_skeleton = '''
+<?xml version="1.0" encoding="utf-8"?>
+<feed xmlns="http://www.w3.org/2005/Atom">
+  <title>%(moduleset)s tinderbox results: %(distro)s-%(arch)s</title>
+  <link>%(url)s</link>
+  <author><name>jhbuild @ %(host)s</name></author>
+  <subtitle>
+    Listing of errors from the %(moduleset)s tinderbox on:
+    Build Host: %(host)s
+    Architecture: %(arch)s
+    Distro: %(distro)s
+  </subtitle>
+  <entry>
+    <title>Build Launched</title>
+    <link href=%(url)s>
+    <updated>%(timestamp)s</updated>
+    <summary>dummy entry- first post!</summary>
+  </entry>
+  <entry>
+    <title>Build Succeeded</title>
+    <link href=%(url)s>
+    <updated>%(timestamp)s</updated>
+    <summary>Well, we hope it will. Keep an eye on this space</summary>
+  </entry>  
+</feed>
+'''
+
+build_start_entry = '''
+  <entry>
+    <title>Build Launched</title>
+    <link href=%(url)s>
+    <updated>%(timestamp)s</updated>
+    <summary>A build of %(moduleset)s was launched at %(timestamp)s on a %(distro)s-%(arch)s box named %(host)s</summary>
+  </entry>'''
+
+build_finish_entry = '''
+  <entry>
+    <title>Build %(success)s</title>
+    <link href=%(url)s>
+    <updated>%(timestamp)s</updated>
+    <summary>%(info)s</summary>
+  </entry>'''
+
 def escape(string):
     return string.replace('&','&amp;').replace('<','&lt;').replace('>','&gt;')
 
@@ -120,6 +165,7 @@
             os.makedirs(self.outputdir)
 
         os.environ['TERM'] = 'dumb'
+        self.url = config.feed_url
 
     def timestamp(self):
         tm = time.time()
@@ -148,7 +194,6 @@
         '''executes a command, and returns the error code'''
         assert self.modulefp, 'not currently building a module'
 
-        
         self.modulefp.write('<pre>')
         if isinstance(command, (str, unicode)):
             self.modulefp.write('<span class="command">%s</span>\n'
@@ -205,6 +250,7 @@
             if os.path.exists(filename):
                 info.append(('Distribution',
                              open(filename, 'r').readline().strip()))
+		distro = open(filename, 'r').readline().strip()
                 break
 
         info.append(('Module Set', self.config.moduleset))
@@ -221,6 +267,27 @@
         self.indexfp.write(index_header % { 'buildplatform': buildplatform })
         self.indexfp.flush()
 
+	if not (os.path.isfile(os.path.join(self.outputdir, 'atom.xml'))):
+	    self.feedfp = open(os.path.join(self.outputdir, 'atom.xml'), 'w')
+            self.feedfp.write(feed_skeleton %
+                                    { 'moduleset': self.config.moduleset, 'url': self.url, 'timestamp': self.timestamp(), 'host': socket.gethostname(), 'distro': distro, 'arch': 'FIXME'})
+            self.feedfp.close()
+	
+	
+	p = re.compile(r'\s*<entry>\s*<title>Build Launched</title>.*?</entry>', re.DOTALL)
+	
+	self.feedfp = open(os.path.join(self.outputdir, 'atom.xml'))
+	previous_feed = self.feedfp.read()
+	self.feedfp.close()
+
+	self.feedfp = open(os.path.join(self.outputdir, 'atom.xml'), 'w')
+	self.feedfp.write(p.sub(build_start_entry % { 'moduleset':
+		self.config.moduleset, 'url': self.url, 'timestamp': 
+		self.timestamp(), 'host': socket.gethostname(), 'distro': 
+		distro, 'arch': 'FIXME'}, previous_feed))
+
+	self.feedfp.close()
+
     def end_build(self, failures):
         self.indexfp.write('<tr>'
                            '<td>%s</td>'
@@ -231,12 +298,25 @@
             info += '<blockquote>\n'
             info += ', '.join(failures)
             info += '</blockquote>\n'
+	    success = 'Failed'
         else:
             info = ''
+            success = 'Succeeded'
         self.indexfp.write(index_footer % { 'failures': info })
         self.indexfp.close()
         self.indexfp = None
 
+	p = re.compile(r'\s*<entry>\s*<title>Build (Failed|Succeeded)</title>.*?</entry>', re.DOTALL)
+	
+	self.feedfp = open(os.path.join(self.outputdir, 'atom.xml'))
+	previous_feed = self.feedfp.read()
+	self.feedfp.close()
+
+	self.feedfp = open(os.path.join(self.outputdir, 'atom.xml'), 'w')
+	self.feedfp.write(p.sub(build_finish_entry % { 'success': success, 'url': self.url, 
+		'timestamp': self.timestamp(), 'info': info}, previous_feed))
+	self.feedfp.close()
+
     def start_module(self, module):
         self.modulefilename='%s.html' % module.replace('/','_')
         self.indexfp.write('<tr>'
@@ -269,6 +351,7 @@
         if error:
             self.indexfp.write('<a class="failure" title="%s" href="%s#%s">%s</a>\n'
                                % (error, self.modulefilename, state, state))
+            self.modulefilename='%s.html' % module.replace('/','_')
         else:
             self.indexfp.write('<a class="success" href="%s#%s">%s</a>\n'
                                % (self.modulefilename, state, state))
