#!/usr/bin/ruby -w
require 'dbi'
require 'pp'
require 'uri'
require 'net/http'
puts "Content-type: text/html\n\n"
puts <<-EOF
Ubuntu FTBFS
Ubuntu packages that FTBFS
Contact: Lucas Nussbaum
EOF
STDOUT.flush
res32 = Net::HTTP.get(URI::parse('http://people.ubuntuwire.com/~lucas/ubuntu-nbs/res.lucid.32')).split(/\n/)
res64 = Net::HTTP.get(URI::parse('http://people.ubuntuwire.com/~lucas/ubuntu-nbs/res.lucid.64')).split(/\n/)
dbh = DBI::connect('DBI:Pg:dbname=udd;port=5441;host=localhost', 'guest')
sth = dbh.prepare("select u.source, u.version, u.component, d.version as dversion, d.version > u.version as vercmp from ubuntu_sources u LEFT JOIN (SELECT source, version from sources_uniq where distribution='debian' and release='sid') d on (u.source = d.source) where u.distribution='ubuntu' and u.release='lucid' order by u.component, u.source")
sth.execute ; rows_u = sth.fetch_all
sth.finish
fails = {}
res32.each do |l|
pkg, v, res, reason = l.split(' ', 4)
fails[pkg] = {} if fails[pkg].nil?
fails[pkg]['32'] = [res, reason]
fails[pkg]['version'] = v
end
res64.each do |l|
pkg, v, res, reason = l.split(' ', 4)
fails[pkg] = {} if fails[pkg].nil?
fails[pkg]['64'] = [res, reason]
fails[pkg]['version'] = v
end
fails.delete_if { |k, v| (v['32'].nil? or v['32'][0] == 'OK') and (v['64'].nil? or v['64'][0] == 'OK') }
puts "#{fails.length} packages failed to build.
"
outdatedres = []
puts ""
puts "| Package | Section | Newer in Debian | i386 | amd64 | Reason |
"
def showrow(r, fa)
puts "| #{r['source']} #{fa['version']}
PTS
BTS
LP
| #{r['component']} | "
if r['dversion'].nil?
puts "Not in Debian | "
elsif r['vercmp']
puts "Yes | "
else
puts "No | "
end
['32','64'].each do |a|
if fa[a].nil?
puts "N/A | "
else
puts "#{fa[a][0]} | "
end
end
if fa['32'].nil? or fa['32'][0] == 'OK' # only amd64 failed
puts "#{fa['64'][1]} | "
elsif fa['64'].nil? or fa['64'][0] == 'OK' # only i386 failed
puts "#{fa['32'][1]} | "
elsif fa['32'][1] == fa['64'][1] # both failed with the same message
puts "#{fa['64'][1]} | "
else
puts "i386: #{fa['32'][1]} amd64: #{fa['64'][1]} | "
end
puts "
"
end
rows_u.each do |r|
fa = fails[r['source']]
next if fa == nil
if r['version'] != fa['version']
outdatedres << r
next
end
showrow(r, fa)
end
puts "
"
# FIXME outdatedres
puts "Outdated results
"
puts "Those test builds were done with a version of the package that was superseded by a newer version in lucid.
"
puts ""
puts "| Package | Section | Newer in Debian | i386 | amd64 | Reason |
"
outdatedres.each do |r|
fa = fails[r['source']]
showrow(r, fa)
end
puts "
"
puts ""
puts ""