| 1 |
#!/usr/bin/ruby -w
|
| 2 |
|
| 3 |
require 'dbi'
|
| 4 |
require 'pp'
|
| 5 |
require 'uri'
|
| 6 |
require 'net/http'
|
| 7 |
require 'cgi'
|
| 8 |
|
| 9 |
URELEASE='natty'
|
| 10 |
|
| 11 |
$cgi = CGI::new
|
| 12 |
|
| 13 |
if $cgi.has_key?('csv')
|
| 14 |
puts "Content-type: text/plain\n\n"
|
| 15 |
else
|
| 16 |
puts "Content-type: text/html\n\n"
|
| 17 |
|
| 18 |
puts <<-EOF
|
| 19 |
<html>
|
| 20 |
<head>
|
| 21 |
<style type="text/css">
|
| 22 |
td, th {
|
| 23 |
border: 1px solid gray;
|
| 24 |
padding-left: 3px;
|
| 25 |
padding-right: 3px;
|
| 26 |
}
|
| 27 |
tr:hover {
|
| 28 |
background-color: #ccc;
|
| 29 |
}
|
| 30 |
table {
|
| 31 |
border-collapse: collapse;
|
| 32 |
}
|
| 33 |
</style>
|
| 34 |
<title>Ubuntu FTBFS</title>
|
| 35 |
</head>
|
| 36 |
<body>
|
| 37 |
<h1>Ubuntu packages that FTBFS</h1>
|
| 38 |
|
| 39 |
Contact: <a href="mailto:lucas@ubuntu.com">Lucas Nussbaum</a><br>
|
| 40 |
EOF
|
| 41 |
end
|
| 42 |
|
| 43 |
STDOUT.flush
|
| 44 |
|
| 45 |
res32 = Net::HTTP.get(URI::parse('http://people.ubuntuwire.com/~lucas/ubuntu-nbs/res.ubuntu.32')).split(/\n/)
|
| 46 |
res64 = Net::HTTP.get(URI::parse('http://people.ubuntuwire.com/~lucas/ubuntu-nbs/res.ubuntu.64')).split(/\n/)
|
| 47 |
|
| 48 |
dbh = DBI::connect('DBI:Pg:dbname=udd;port=5441;host=localhost', 'guest')
|
| 49 |
|
| 50 |
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='#{URELEASE}' order by u.component, u.source")
|
| 51 |
sth.execute ; rows_u = sth.fetch_all
|
| 52 |
sth.finish
|
| 53 |
|
| 54 |
fails = {}
|
| 55 |
res32.each do |l|
|
| 56 |
pkg, v, res, reason = l.split(' ', 4)
|
| 57 |
fails[pkg] = {} if fails[pkg].nil?
|
| 58 |
fails[pkg]['32'] = [res, reason]
|
| 59 |
fails[pkg]['version'] = v
|
| 60 |
end
|
| 61 |
res64.each do |l|
|
| 62 |
pkg, v, res, reason = l.split(' ', 4)
|
| 63 |
fails[pkg] = {} if fails[pkg].nil?
|
| 64 |
fails[pkg]['64'] = [res, reason]
|
| 65 |
fails[pkg]['version'] = v
|
| 66 |
end
|
| 67 |
fails.delete_if { |k, v| (v['32'].nil? or v['32'][0] == 'OK') and (v['64'].nil? or v['64'][0] == 'OK') }
|
| 68 |
|
| 69 |
outdatedres = []
|
| 70 |
|
| 71 |
if not $cgi.has_key?('csv')
|
| 72 |
|
| 73 |
puts "#{fails.length} packages failed to build.<br><br>"
|
| 74 |
|
| 75 |
puts "<table>"
|
| 76 |
puts "<tr><th>Package</th><th>Section</th><th>Newer in Debian</th><th>i386</th><th>amd64</th><th>Reason</th></tr>"
|
| 77 |
end
|
| 78 |
|
| 79 |
def showrow(r, fa)
|
| 80 |
if $cgi.has_key?('csv')
|
| 81 |
print "#{r['source']},#{fa['version']},#{r['component']},"
|
| 82 |
if r['dversion'].nil?
|
| 83 |
print "Not in Debian"
|
| 84 |
elsif r['vercmp']
|
| 85 |
print "Yes"
|
| 86 |
else
|
| 87 |
print "No"
|
| 88 |
end
|
| 89 |
['32','64'].each do |a|
|
| 90 |
if fa[a].nil?
|
| 91 |
print ",N/A"
|
| 92 |
else
|
| 93 |
print ",http://people.ubuntuwire.org/~lucas/ubuntu-nbs/#{a}/#{r['source']}_#{fa['version']}_lubuntu#{a}.buildlog,#{fa[a][0]}"
|
| 94 |
end
|
| 95 |
end
|
| 96 |
puts
|
| 97 |
else
|
| 98 |
puts "<tr><td>#{r['source']} #{fa['version']}
|
| 99 |
<a href=\"http://packages.qa.debian.org/#{r['source']}\">PTS</a>
|
| 100 |
<a href=\"http://bugs.debian.org/src:#{r['source']}\">BTS</a>
|
| 101 |
<a href=\"https://launchpad.net/ubuntu/+source/#{r['source']}\">LP</a>
|
| 102 |
</td><td>#{r['component']}</td>"
|
| 103 |
if r['dversion'].nil?
|
| 104 |
puts "<td>Not in Debian</td>"
|
| 105 |
elsif r['vercmp']
|
| 106 |
puts "<td>Yes</td>"
|
| 107 |
else
|
| 108 |
puts "<td>No</td>"
|
| 109 |
end
|
| 110 |
['32','64'].each do |a|
|
| 111 |
if fa[a].nil?
|
| 112 |
puts "<td>N/A</td>"
|
| 113 |
else
|
| 114 |
puts "<td><a href=\"http://people.ubuntuwire.org/~lucas/ubuntu-nbs/#{a}/#{r['source']}_#{fa['version']}_lubuntu#{a}.buildlog\">#{fa[a][0]}</a></td>"
|
| 115 |
end
|
| 116 |
end
|
| 117 |
if fa['32'].nil? or fa['32'][0] == 'OK' # only amd64 failed
|
| 118 |
puts "<td>#{fa['64'][1]}</td>"
|
| 119 |
elsif fa['64'].nil? or fa['64'][0] == 'OK' # only i386 failed
|
| 120 |
puts "<td>#{fa['32'][1]}</td>"
|
| 121 |
elsif fa['32'][1] == fa['64'][1] # both failed with the same message
|
| 122 |
puts "<td>#{fa['64'][1]}</td>"
|
| 123 |
else
|
| 124 |
puts "<td>i386: #{fa['32'][1]}<br>amd64: #{fa['64'][1]}</td>"
|
| 125 |
end
|
| 126 |
puts "</tr>"
|
| 127 |
end
|
| 128 |
end
|
| 129 |
|
| 130 |
rows_u.each do |r|
|
| 131 |
fa = fails[r['source']]
|
| 132 |
next if fa == nil
|
| 133 |
if r['version'] != fa['version']
|
| 134 |
outdatedres << r
|
| 135 |
next
|
| 136 |
end
|
| 137 |
showrow(r, fa)
|
| 138 |
end
|
| 139 |
if not $cgi.has_key?('csv')
|
| 140 |
puts "</table>"
|
| 141 |
|
| 142 |
puts "<h2>Outdated results</h2>"
|
| 143 |
puts "Those test builds were done with a version of the package that was superseded by a newer version in ubuntu.<br><br>"
|
| 144 |
puts "<table>"
|
| 145 |
puts "<tr><th>Package</th><th>Section</th><th>Newer in Debian</th><th>i386</th><th>amd64</th><th>Reason</th></tr>"
|
| 146 |
end
|
| 147 |
|
| 148 |
outdatedres.each do |r|
|
| 149 |
fa = fails[r['source']]
|
| 150 |
showrow(r, fa)
|
| 151 |
end
|
| 152 |
if not $cgi.has_key?('csv')
|
| 153 |
puts "</table>"
|
| 154 |
puts "</body>"
|
| 155 |
puts "</html>"
|
| 156 |
end
|