| 1 |
#!/usr/bin/ruby -w
|
| 2 |
|
| 3 |
require 'dbi'
|
| 4 |
require 'pp'
|
| 5 |
require 'cgi'
|
| 6 |
|
| 7 |
puts "Content-type: text/html\n\n"
|
| 8 |
|
| 9 |
RELEASE_RESTRICT = [
|
| 10 |
['squeeze', 'squeeze', 'id in (select id from bugs_rt_affects_testing)'],
|
| 11 |
['sid', 'sid', 'id in (select id from bugs_rt_affects_unstable)'],
|
| 12 |
['squeeze_and_sid', 'squeeze and sid', 'id in (select id from bugs_rt_affects_testing) and id in (select id from bugs_rt_affects_unstable)'],
|
| 13 |
['squeeze_or_sid', 'squeeze or sid', 'id in (select id from bugs_rt_affects_testing union select id from bugs_rt_affects_unstable)'],
|
| 14 |
['squeeze_not_sid', 'squeeze, not sid', 'id in (select id from bugs_rt_affects_testing) and id not in (select id from bugs_rt_affects_unstable)'],
|
| 15 |
['sid_not_squeeze', 'sid, not squeeze', 'id in (select id from bugs_rt_affects_unstable) and id not in (select id from bugs_rt_affects_testing)']
|
| 16 |
]
|
| 17 |
|
| 18 |
FILTERS = [
|
| 19 |
['patch', 'tagged patch', 'id in (select id from bugs_tags where tag=\'patch\')'],
|
| 20 |
['pending', 'tagged pending', 'id in (select id from bugs_tags where tag=\'pending\')'],
|
| 21 |
['security', 'tagged security', 'id in (select id from bugs_tags where tag=\'security\')'],
|
| 22 |
['notmain', 'packages not in main', 'id not in (select id from bugs_packages, sources where bugs_packages.source = sources.source and component=\'main\')'],
|
| 23 |
['notsqueeze', 'packages not in squeeze', 'id not in (select id from bugs_packages, sources where bugs_packages.source = sources.source and release=\'squeeze\')'],
|
| 24 |
['merged', 'merged bugs', 'id in (select id from bugs_merged_with where id > merged_with)'],
|
| 25 |
['done', 'marked as done', 'status = \'done\''],
|
| 26 |
]
|
| 27 |
|
| 28 |
TYPES = [
|
| 29 |
['rc', 'release-critical bugs', 'severity >= \'serious\'', true ],
|
| 30 |
['ipv6', 'release goal: IPv6 support', 'id in (select id from bugs_tags where tag=\'ipv6\')', false ],
|
| 31 |
['lfs', 'release goal: Large File Support', 'id in (select id from bugs_tags where tag=\'lfs\')', false ],
|
| 32 |
['boot', 'release goal: boot performance (init.d dependencies)', 'id in (select id from bugs_usertags where email = \'initscripts-ng-devel@lists.alioth.debian.org\')', false],
|
| 33 |
['oldgnome', 'release goal: remove obsolete GNOME libraries', 'id in (select id from bugs_usertags where email = \'pkg-gnome-maintainers@lists.alioth.debian.org\' and tag=\'oldlibs\')', false],
|
| 34 |
]
|
| 35 |
|
| 36 |
SORTS = [
|
| 37 |
['id', 'bug#'],
|
| 38 |
['source', 'source package'],
|
| 39 |
['package', 'binary package'],
|
| 40 |
['last_modified', 'last modified']
|
| 41 |
]
|
| 42 |
|
| 43 |
cgi = CGI::new
|
| 44 |
# releases
|
| 45 |
if RELEASE_RESTRICT.map { |r| r[0] }.include?(cgi.params['release'][0])
|
| 46 |
release = cgi.params['release'][0]
|
| 47 |
else
|
| 48 |
release = 'squeeze'
|
| 49 |
end
|
| 50 |
# sorts
|
| 51 |
if SORTS.map { |r| r[0] }.include?(cgi.params['sortby'][0])
|
| 52 |
sortby = cgi.params['sortby'][0]
|
| 53 |
else
|
| 54 |
sortby = 'id'
|
| 55 |
end
|
| 56 |
if ['asc', 'desc'].include?(cgi.params['sorto'][0])
|
| 57 |
sorto = cgi.params['sorto'][0]
|
| 58 |
else
|
| 59 |
sorto = 'asc'
|
| 60 |
end
|
| 61 |
# filters
|
| 62 |
filters = {}
|
| 63 |
FILTERS.map { |r| r[0] }.each do |e|
|
| 64 |
if ['notconsidered', 'only', 'ign'].include?(cgi.params[e][0])
|
| 65 |
filters[e] = cgi.params[e][0]
|
| 66 |
else
|
| 67 |
filters[e] = (e == 'merged' ? 'ign' : 'notconsidered')
|
| 68 |
end
|
| 69 |
end
|
| 70 |
# filter: newer than X days
|
| 71 |
if ['notconsidered', 'only', 'ign'].include?(cgi.params['fnewer'][0])
|
| 72 |
fnewer = cgi.params['fnewer'][0]
|
| 73 |
else
|
| 74 |
fnewer = 'notconsidered'
|
| 75 |
end
|
| 76 |
if cgi.params['fnewerval'][0] =~ /^[0-9]+$/
|
| 77 |
fnewerval = cgi.params['fnewerval'][0].to_i
|
| 78 |
else
|
| 79 |
fnewerval = 7
|
| 80 |
end
|
| 81 |
# types
|
| 82 |
types = {}
|
| 83 |
TYPES.each do |t|
|
| 84 |
if cgi.params == {}
|
| 85 |
types[t[0]] = t[3]
|
| 86 |
else
|
| 87 |
if cgi.params[t[0]][0] == '1'
|
| 88 |
types[t[0]] = true
|
| 89 |
else
|
| 90 |
types[t[0]] = false
|
| 91 |
end
|
| 92 |
end
|
| 93 |
end
|
| 94 |
|
| 95 |
puts <<-EOF
|
| 96 |
<html>
|
| 97 |
<head>
|
| 98 |
<style type="text/css">
|
| 99 |
table.buglist td, table.buglist th {
|
| 100 |
border: 1px solid gray;
|
| 101 |
padding-left: 3px;
|
| 102 |
padding-right: 3px;
|
| 103 |
}
|
| 104 |
table.buglist tr:hover {
|
| 105 |
background-color: #ccc;
|
| 106 |
}
|
| 107 |
table {
|
| 108 |
border-collapse: collapse;
|
| 109 |
}
|
| 110 |
|
| 111 |
</style>
|
| 112 |
<title>RC Bugs List @ UDD</title>
|
| 113 |
</head>
|
| 114 |
<body>
|
| 115 |
<h1>Release Critical Bugs List</h1>
|
| 116 |
|
| 117 |
<form action="bugs.cgi" method="get">
|
| 118 |
<p><b>Bugs affecting:</b>
|
| 119 |
EOF
|
| 120 |
|
| 121 |
RELEASE_RESTRICT.each do |r|
|
| 122 |
checked = (release == r[0] ? 'CHECKED=\'1\'':'')
|
| 123 |
puts "<input type='radio' name='release' value='#{r[0]}' #{checked}/>#{r[1]} "
|
| 124 |
end
|
| 125 |
puts <<-EOF
|
| 126 |
(also uses release tags and xxx-ignore information)</p>
|
| 127 |
<table class="invisible"><tr><td>
|
| 128 |
<table class="buglist">
|
| 129 |
<tr><th colspan='4'>FILTERS</th></tr>
|
| 130 |
<tr><th>not considered</th><th>only</th><th>ignore</th><th>type</th></tr>
|
| 131 |
EOF
|
| 132 |
FILTERS.each do |r|
|
| 133 |
puts <<-EOF
|
| 134 |
<tr>
|
| 135 |
<td style='text-align: center;'><input type='radio' name='#{r[0]}' value='' #{filters[r[0]]=='notconsidered'?'CHECKED=\'1\'':''}/></td>
|
| 136 |
<td style='text-align: center;'><input type='radio' name='#{r[0]}' value='only' #{filters[r[0]]=='only'?'CHECKED=\'1\'':''}/></td>
|
| 137 |
<td style='text-align: center;'><input type='radio' name='#{r[0]}' value='ign' #{filters[r[0]]=='ign'?'CHECKED=\'1\'':''}'/></td>
|
| 138 |
<td>#{r[1]}</td>
|
| 139 |
</tr>
|
| 140 |
EOF
|
| 141 |
end
|
| 142 |
# newer than
|
| 143 |
puts <<-EOF
|
| 144 |
<tr>
|
| 145 |
<td style='text-align: center;'><input type='radio' name='fnewer' value='' #{fnewer=='notconsidered'?'CHECKED=\'1\'':''}/></td>
|
| 146 |
<td style='text-align: center;'><input type='radio' name='fnewer' value='only' #{fnewer=='only'?'CHECKED=\'1\'':''}/></td>
|
| 147 |
<td style='text-align: center;'><input type='radio' name='fnewer' value='ign' #{fnewer=='ign'?'CHECKED=\'1\'':''}'/></td>
|
| 148 |
<td>newer than <input type='text' size='3' name='fnewerval' value='#{fnewerval}'/> days</td>
|
| 149 |
</tr>
|
| 150 |
EOF
|
| 151 |
puts "</table></td><td style='padding-left: 20px'><table class='buglist'>"
|
| 152 |
puts "<tr><th colspan='2'>Bug types</th></tr>"
|
| 153 |
TYPES.each do |t|
|
| 154 |
checked = types[t[0]]?" checked='1'":""
|
| 155 |
puts "<tr><td><input type='checkbox' name='#{t[0]}' value='1'#{checked}/></td><td>#{t[1]}</td></tr>"
|
| 156 |
end
|
| 157 |
puts "</table></td></tr></table>"
|
| 158 |
puts "<p><b>Sort by:</b> "
|
| 159 |
SORTS.each do |r|
|
| 160 |
checked = (sortby == r[0] ? 'CHECKED=\'1\'':'')
|
| 161 |
puts "<input type='radio' name='sortby' value='#{r[0]}' #{checked}/>#{r[1]} "
|
| 162 |
end
|
| 163 |
puts "<b> -- </b>"
|
| 164 |
[['asc', 'increasing'],[ 'desc', 'decreasing']].each do |r|
|
| 165 |
checked = (sorto == r[0] ? 'CHECKED=\'1\'':'')
|
| 166 |
puts "<input type='radio' name='sorto' value='#{r[0]}' #{checked}/>#{r[1]} "
|
| 167 |
end
|
| 168 |
puts <<-EOF
|
| 169 |
</p><input type='submit' value='Update'/>
|
| 170 |
</form>
|
| 171 |
EOF
|
| 172 |
if cgi.params != {}
|
| 173 |
|
| 174 |
# Generate and execute query
|
| 175 |
tstart = Time::now
|
| 176 |
dbh = DBI::connect('DBI:Pg:dbname=udd;port=5441;host=localhost', 'guest')
|
| 177 |
q = "select id, bugs.package, bugs.source, title, last_modified from bugs \n"
|
| 178 |
q += "where #{RELEASE_RESTRICT.select { |r| r[0] == release }[0][2]} \n"
|
| 179 |
FILTERS.each do |f|
|
| 180 |
if filters[f[0]] == 'only'
|
| 181 |
q += "and #{f[2]} \n"
|
| 182 |
elsif filters[f[0]] == 'ign'
|
| 183 |
q += "and not (#{f[2]}) \n"
|
| 184 |
end
|
| 185 |
end
|
| 186 |
if fnewer == 'only'
|
| 187 |
q += "and (current_timestamp - interval '#{fnewerval} days' <= arrival) \n"
|
| 188 |
elsif fnewer == 'ign'
|
| 189 |
q += "and (current_timestamp - interval '#{fnewerval} days' > arrival) \n"
|
| 190 |
end
|
| 191 |
q += "AND ("
|
| 192 |
q += TYPES.select { |t| types[t[0]] }.map { |t| t[2] }.join("\n OR ")
|
| 193 |
q += ")\n "
|
| 194 |
q += "order by #{sortby} #{sorto}"
|
| 195 |
sth = dbh.prepare(q)
|
| 196 |
sth.execute
|
| 197 |
rows = sth.fetch_all
|
| 198 |
|
| 199 |
puts "<p><b>#{rows.length} bugs found.</b></p>"
|
| 200 |
puts <<-EOF
|
| 201 |
<table class="buglist">
|
| 202 |
<tr><th>bug#</th><th>package</th><th>title</th><th>last modified</th></tr>
|
| 203 |
EOF
|
| 204 |
rows.each do |r|
|
| 205 |
puts "<tr><td style='text-align: center;'><a href=\"http://bugs.debian.org/#{r['id']}\">##{r['id']}</a></td>"
|
| 206 |
puts "<td style='text-align: center;'>"
|
| 207 |
srcs = r['source'].split(/,\s*/)
|
| 208 |
bins = r['package'].split(/,\s*/)
|
| 209 |
puts (0...bins.length).map { |i| "<a href=\"http://packages.qa.debian.org/#{srcs[i]}\">#{bins[i]}</a>" }.join(', ')
|
| 210 |
puts "</td>"
|
| 211 |
puts <<-EOF
|
| 212 |
<td>#{r['title']}</td>
|
| 213 |
<td style='text-align: center;'>#{r['last_modified'].to_date}</td>
|
| 214 |
</tr>
|
| 215 |
EOF
|
| 216 |
end
|
| 217 |
=begin
|
| 218 |
release goals:
|
| 219 |
all
|
| 220 |
include / only
|
| 221 |
|
| 222 |
columns:
|
| 223 |
id
|
| 224 |
source
|
| 225 |
package
|
| 226 |
title
|
| 227 |
|
| 228 |
time
|
| 229 |
data last refreshed
|
| 230 |
EOF
|
| 231 |
=end
|
| 232 |
|
| 233 |
=begin
|
| 234 |
sth = dbh.prepare("select id, bugs.package, bugs.source, insts, title from bugs, popcon_src where bugs.source = popcon_src.source and id in (select id from bugs_rt_affects_testing_and_unstable) and id in (select id from bugs_tags where tag='patch') and id not in (select id from bugs_tags where tag='pending') and severity >= 'serious' order by id")
|
| 235 |
sth.execute ; rows = sth.fetch_all
|
| 236 |
|
| 237 |
puts "<h2>RC bugs tagged patch (and not pending)</h2>"
|
| 238 |
puts "<table>"
|
| 239 |
puts "<tr><th>bug</th><th>package</th><th>source</th><th>popcon</th><th>title</th></tr>"
|
| 240 |
rows.each do |r|
|
| 241 |
puts "<tr><td><a href=\"http://bugs.debian.org/#{r['id']}\">#{r['id']}</a></td>"
|
| 242 |
puts "<td>#{r['package']}</td>"
|
| 243 |
puts "<td><a href=\"http://packages.qa.debian.org/#{r['source']}\">#{r['source']}</a></td>"
|
| 244 |
puts "<td>#{r['insts']}</td>"
|
| 245 |
puts "<td>#{r['title']}</td>"
|
| 246 |
end
|
| 247 |
puts "</table>"
|
| 248 |
sth.finish
|
| 249 |
|
| 250 |
puts "<h2>RC bugs on packages with a newer version in Ubuntu (possible patches), not tagged patch nor pending</h2>"
|
| 251 |
puts "<table>"
|
| 252 |
puts "<tr><th>bug</th><th>package</th><th>source</th><th>versions (D/U)</th><th>popcon</th><th>title</th></tr>"
|
| 253 |
|
| 254 |
sth = dbh.prepare("WITH ubudeb AS (select distinct on (d.source, u.source) d.source as dsource, u.source as usource, d.version as dversion, u.version as uversion from sources_uniq d, ubuntu_sources u where d.release = 'sid' and d.distribution = 'debian' and u.release = '#{URELEASE}' and u.distribution = 'ubuntu' and u.source = d.source and u.version > d.version order by d.source asc, u.source asc, d.version desc)
|
| 255 |
select id, bugs.package, bugs.source, title, dversion, uversion, insts from bugs, ubudeb, popcon_src where popcon_src.source = bugs.source and id in (select id from bugs_rt_affects_testing_and_unstable) and id not in (select id from bugs_tags where tag='patch') and id not in (select id from bugs_tags where tag='pending') and severity >= 'serious' and ubudeb.dsource = bugs.source order by id")
|
| 256 |
sth.execute ; rows = sth.fetch_all
|
| 257 |
rows.each do |r|
|
| 258 |
puts "<tr><td><a href=\"http://bugs.debian.org/#{r['id']}\">#{r['id']}</a></td>"
|
| 259 |
puts "<td>#{r['package']}</td>"
|
| 260 |
puts "<td><a href=\"http://packages.qa.debian.org/#{r['source']}\">#{r['source']}</a> <a href=\"https://launchpad.net/ubuntu/#{URELEASE}/+source/#{r['source']}/+changelog\">UbCh</a></td>"
|
| 261 |
puts "<td>#{r['dversion']} / #{r['uversion']}</td>"
|
| 262 |
puts "<td>#{r['insts']}</td>"
|
| 263 |
puts "<td>#{r['title']}</td>"
|
| 264 |
end
|
| 265 |
puts "</table>"
|
| 266 |
sth.finish
|
| 267 |
|
| 268 |
sth = dbh.prepare("select id, bugs.package, bugs.source, insts, title from bugs, popcon_src where bugs.source = popcon_src.source and id in (select id from bugs_rt_affects_testing) and id not in (select id from bugs_rt_affects_unstable) and severity >= 'serious' order by package")
|
| 269 |
sth.execute ; rows = sth.fetch_all
|
| 270 |
|
| 271 |
puts "<h2>RC bugs affecting only testing (not unstable, and not pending)</h2>"
|
| 272 |
puts "<table>"
|
| 273 |
puts "<tr><th>bug</th><th>package</th><th>source</th><th>popcon</th><th>title</th></tr>"
|
| 274 |
rows.each do |r|
|
| 275 |
puts "<tr><td><a href=\"http://bugs.debian.org/#{r['id']}\">#{r['id']}</a></td>"
|
| 276 |
puts "<td>#{r['package']}</td>"
|
| 277 |
puts "<td><a href=\"http://packages.qa.debian.org/#{r['source']}\">#{r['source']}</a></td>"
|
| 278 |
puts "<td>#{r['insts']}</td>"
|
| 279 |
puts "<td>#{r['title']}</td>"
|
| 280 |
end
|
| 281 |
puts "</table>"
|
| 282 |
sth.finish
|
| 283 |
|
| 284 |
=end
|
| 285 |
puts "</table>"
|
| 286 |
sth2 = dbh.prepare("select max(start_time) from timestamps where source = 'bugs' and command = 'run'")
|
| 287 |
sth2.execute ; r2 = sth2.fetch_all
|
| 288 |
puts "<p><b>Generated in #{Time::now - tstart} seconds. Last data update: #{r2[0][0]}</b></p>"
|
| 289 |
puts "<pre>#{q}</pre>"
|
| 290 |
end # if cgi.params != {}
|
| 291 |
puts <<-EOF
|
| 292 |
<hr/>
|
| 293 |
<small>Suggestions / comments / patches to lucas at debian dot org. <a href="http://svn.debian.org/wsvn/collab-qa/udd/web/cgi-bin/bugs.cgi">source code</a>.</small>
|
| 294 |
</body>
|
| 295 |
</html>
|
| 296 |
EOF
|