#!/usr/bin/python ### Fetch the build logs of the octave package in Debian and show the ### results of the tests. ### Coypright (C) 2012 Rafael Laboissiere ### ### This program is free software. It comes without any warranty, to the ### extent permitted by applicable law. You can redistribute it and/or ### modify it under the terms of the Do What The Fuck You Want To Public ### License, Version 2, as published by Sam Hocevar. See ### http://sam.zoy.org/wtfpl/COPYING for more details. import re import urllib2 base_url = 'https://buildd.debian.org/status' table_url = base_url + '/package.php?p=octave' response = urllib2.urlopen (table_url) html = response.read () logs = re.findall (r'href="(fetch.php\?pkg=octave&arch=[^"]*)"', html) sep = '=' * 70 for line in logs: line = line.replace ('&', '&') m = re.match (r'.*arch=(.*)', line) tag = m.group (1).replace ('&', ', ') print '\n' + sep + '\n' + tag + '\n' + sep response = urllib2.urlopen (base_url + '/' + line) html = response.readlines () passes = filter (lambda x: re.match ('.*(FAIL|PASS).*', x) != None, html) print ''.join (passes)