| 1 |
#!/usr/bin/ruby -w
|
| 2 |
|
| 3 |
require 'dbi'
|
| 4 |
require 'pp'
|
| 5 |
require 'uri'
|
| 6 |
require 'net/http'
|
| 7 |
|
| 8 |
URELEASE='oneiric'
|
| 9 |
|
| 10 |
puts "Content-type: text/html\n\n"
|
| 11 |
|
| 12 |
puts <<-EOF
|
| 13 |
<html>
|
| 14 |
<head>
|
| 15 |
<style type="text/css">
|
| 16 |
td, th {
|
| 17 |
border: 1px solid gray;
|
| 18 |
padding-left: 3px;
|
| 19 |
padding-right: 3px;
|
| 20 |
}
|
| 21 |
tr:hover {
|
| 22 |
background-color: #ccc;
|
| 23 |
}
|
| 24 |
table {
|
| 25 |
border-collapse: collapse;
|
| 26 |
}
|
| 27 |
</style>
|
| 28 |
<title>Ubuntu: outstanding merges</title>
|
| 29 |
</head>
|
| 30 |
<body>
|
| 31 |
<h1>Outstanding merges</h1>
|
| 32 |
EOF
|
| 33 |
|
| 34 |
DREL='sid'
|
| 35 |
UREL='oneiric'
|
| 36 |
puts "Debian release: #{DREL}<br>"
|
| 37 |
puts "Ubuntu release: #{UREL}<br>"
|
| 38 |
puts "Bugs data refreshed once a day. Packages data refreshed twice a day.<br>"
|
| 39 |
puts "<a href=\"http://svn.debian.org/wsvn/collab-qa/udd/web/cgi-bin/merges.cgi\">Source code</a>"
|
| 40 |
|
| 41 |
dbh = DBI::connect('DBI:Pg:dbname=udd;port=5441;host=localhost', 'guest')
|
| 42 |
|
| 43 |
# Fetching blacklist
|
| 44 |
blacklist = Net::HTTP.get(URI::parse('http://people.canonical.com/~ubuntu-archive/sync-blacklist.txt')).split(/\n/)
|
| 45 |
bpkgs = []
|
| 46 |
blacklist.each do |l|
|
| 47 |
l.gsub!(/#.*/, '')
|
| 48 |
l.strip!
|
| 49 |
next if l == ''
|
| 50 |
bpkgs << l
|
| 51 |
end
|
| 52 |
sbpkgs = "'" + bpkgs.uniq.join("','") + "'"
|
| 53 |
|
| 54 |
sth = dbh.prepare("select ubu.component, deb.source, deb.version as dversion, ubu.version as uversion
|
| 55 |
from sources_uniq deb, ubuntu_sources ubu
|
| 56 |
where deb.distribution='debian' and deb.release='#{DREL}'
|
| 57 |
and ubu.distribution='ubuntu' and ubu.release='#{UREL}'
|
| 58 |
and deb.source = ubu.source and deb.version > ubu.version
|
| 59 |
and deb.source not in (#{sbpkgs})
|
| 60 |
and ubu.version !~ '[0-9]build[0-9]'
|
| 61 |
order by component, source")
|
| 62 |
sth.execute ; rows = sth.fetch_all
|
| 63 |
|
| 64 |
sth2 = dbh.prepare("select distinct package, b.bug, title, status
|
| 65 |
from ubuntu_bugs b, ubuntu_bugs_tasks bt
|
| 66 |
where b.bug = bt.bug
|
| 67 |
and title ~ '^((P|p)lease )?((M|m)erge|(S|s)ync) .* from Debian'
|
| 68 |
and status not in ('Invalid', 'Fix Released', 'Won''t Fix', 'Opinion')
|
| 69 |
and distro != 'Debian'")
|
| 70 |
sth2.execute ; rowsb = sth2.fetch_all
|
| 71 |
|
| 72 |
bugs = {}
|
| 73 |
rowsb.each do |r|
|
| 74 |
src = r['package']
|
| 75 |
bugs[src] = [] if bugs[src].nil?
|
| 76 |
bugs[src] << [r['bug'], r['status']]
|
| 77 |
end
|
| 78 |
|
| 79 |
puts "<table>"
|
| 80 |
puts "<tr><th>Component</th><th>Source</th><th>Debian</th><th>Ubuntu</th><th>Bugs</th></tr>"
|
| 81 |
rows.each do |r|
|
| 82 |
puts "<tr>"
|
| 83 |
puts "<td>#{r['component']}</td>"
|
| 84 |
puts "<td>#{r['source']} "
|
| 85 |
puts "<a href=\"https://launchpad.net/ubuntu/+source/#{r['source']}\">LP</a> "
|
| 86 |
puts "<a href=\"http://packages.qa.debian.org/#{r['source']}\">PTS</a> "
|
| 87 |
puts "<a href=\"http://bugs.debian.org/src:#{r['source']}\">BTS</a> "
|
| 88 |
puts "</td>"
|
| 89 |
puts "<td>#{r['dversion']}</td>"
|
| 90 |
puts "<td>#{r['uversion']}</td>"
|
| 91 |
puts "<td>"
|
| 92 |
if bugs[r['source']] != nil
|
| 93 |
puts bugs[r['source']].map { |b| "<a href=\"https://launchpad.net/bugs/#{b[0]}\">#{b[0]}</a> (#{b[1]})" }.join('<br>')
|
| 94 |
end
|
| 95 |
puts "</tr>"
|
| 96 |
end
|
| 97 |
puts "</table>"
|
| 98 |
puts "#{rows.length} packages listed<br>"
|
| 99 |
['main', 'restricted', 'universe', 'multiverse'].each do |comp|
|
| 100 |
n = rows.select { |r| r['component'] == comp }.length
|
| 101 |
puts "#{comp}: #{n}<br>"
|
| 102 |
end
|
| 103 |
puts "#{bpkgs.length} packages in the <a href=\"http://people.canonical.com/~ubuntu-archive/sync-blacklist.txt\">blacklist</a>"
|
| 104 |
sth.finish
|
| 105 |
puts "</body></html>"
|