| 1 |
lucas |
1786 |
#!/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_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 |
lucas |
1787 |
['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 |
lucas |
1786 |
] |
| 27 |
|
|
|
| 28 |
lucas |
1787 |
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 |
lucas |
1786 |
|
| 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 |
lucas |
1787 |
release = 'squeeze' |
| 49 |
lucas |
1786 |
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 |
lucas |
1787 |
filters[e] = (e == 'merged' ? 'ign' : 'notconsidered') |
| 68 |
lucas |
1786 |
end |
| 69 |
|
|
end |
| 70 |
lucas |
1787 |
# 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 |
lucas |
1786 |
|
| 95 |
|
|
puts <<-EOF |
| 96 |
|
|
<html> |
| 97 |
|
|
<head> |
| 98 |
|
|
<style type="text/css"> |
| 99 |
lucas |
1787 |
table.buglist td, table.buglist th { |
| 100 |
lucas |
1786 |
border: 1px solid gray; |
| 101 |
|
|
padding-left: 3px; |
| 102 |
|
|
padding-right: 3px; |
| 103 |
|
|
} |
| 104 |
lucas |
1787 |
table.buglist tr:hover { |
| 105 |
lucas |
1786 |
background-color: #ccc; |
| 106 |
|
|
} |
| 107 |
|
|
table { |
| 108 |
|
|
border-collapse: collapse; |
| 109 |
|
|
} |
| 110 |
lucas |
1787 |
|
| 111 |
lucas |
1786 |
</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 |
|
|
</p> |
| 127 |
lucas |
1787 |
<table class="invisible"><tr><td> |
| 128 |
|
|
<table class="buglist"> |
| 129 |
lucas |
1786 |
<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 |
lucas |
1787 |
<td style='text-align: center;'><input type='radio' name='#{r[0]}' value='ign' #{filters[r[0]]=='ign'?'CHECKED=\'1\'':''}'/></td> |
| 138 |
lucas |
1786 |
<td>#{r[1]}</td> |
| 139 |
|
|
</tr> |
| 140 |
|
|
EOF |
| 141 |
|
|
end |
| 142 |
lucas |
1787 |
# 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 |
lucas |
1786 |
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 |
lucas |
1787 |
</p><input type='submit' value='Update'/> |
| 170 |
lucas |
1786 |
</form> |
| 171 |
|
|
EOF |
| 172 |
|
|
if cgi.params != {} |
| 173 |
|
|
|
| 174 |
lucas |
1787 |
# Generate and execute query |
| 175 |
lucas |
1786 |
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 |
lucas |
1787 |
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 |
lucas |
1786 |
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 |
lucas |
1787 |
<table class="buglist"> |
| 202 |
lucas |
1786 |
<tr><th>bug#</th><th>source pkg</th><th>binary pkg</th><th>title</th><th>last modified</th></tr> |
| 203 |
|
|
EOF |
| 204 |
|
|
rows.each do |r| |
| 205 |
lucas |
1787 |
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 |
|
|
puts r['source'].split(/,\s*/).map { |pkg| "<a href=\"http://packages.qa.debian.org/#{pkg}\">#{pkg}</a>" }.join(', ') |
| 208 |
|
|
puts "</td>" |
| 209 |
lucas |
1786 |
puts <<-EOF |
| 210 |
|
|
<td style='text-align: center;'>#{r['package']}</td> |
| 211 |
|
|
<td>#{r['title']}</td> |
| 212 |
|
|
<td style='text-align: center;'>#{r['last_modified'].to_date}</td> |
| 213 |
|
|
</tr> |
| 214 |
|
|
EOF |
| 215 |
|
|
end |
| 216 |
|
|
=begin |
| 217 |
|
|
release goals: |
| 218 |
|
|
all |
| 219 |
|
|
include / only |
| 220 |
|
|
|
| 221 |
|
|
columns: |
| 222 |
|
|
id |
| 223 |
|
|
source |
| 224 |
|
|
package |
| 225 |
|
|
title |
| 226 |
|
|
|
| 227 |
|
|
time |
| 228 |
|
|
data last refreshed |
| 229 |
|
|
EOF |
| 230 |
|
|
=end |
| 231 |
|
|
|
| 232 |
|
|
=begin |
| 233 |
|
|
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") |
| 234 |
|
|
sth.execute ; rows = sth.fetch_all |
| 235 |
|
|
|
| 236 |
|
|
puts "<h2>RC bugs tagged patch (and not pending)</h2>" |
| 237 |
|
|
puts "<table>" |
| 238 |
|
|
puts "<tr><th>bug</th><th>package</th><th>source</th><th>popcon</th><th>title</th></tr>" |
| 239 |
|
|
rows.each do |r| |
| 240 |
|
|
puts "<tr><td><a href=\"http://bugs.debian.org/#{r['id']}\">#{r['id']}</a></td>" |
| 241 |
|
|
puts "<td>#{r['package']}</td>" |
| 242 |
|
|
puts "<td><a href=\"http://packages.qa.debian.org/#{r['source']}\">#{r['source']}</a></td>" |
| 243 |
|
|
puts "<td>#{r['insts']}</td>" |
| 244 |
|
|
puts "<td>#{r['title']}</td>" |
| 245 |
|
|
end |
| 246 |
|
|
puts "</table>" |
| 247 |
|
|
sth.finish |
| 248 |
|
|
|
| 249 |
|
|
puts "<h2>RC bugs on packages with a newer version in Ubuntu (possible patches), not tagged patch nor pending</h2>" |
| 250 |
|
|
puts "<table>" |
| 251 |
|
|
puts "<tr><th>bug</th><th>package</th><th>source</th><th>versions (D/U)</th><th>popcon</th><th>title</th></tr>" |
| 252 |
|
|
|
| 253 |
|
|
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) |
| 254 |
|
|
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") |
| 255 |
|
|
sth.execute ; rows = sth.fetch_all |
| 256 |
|
|
rows.each do |r| |
| 257 |
|
|
puts "<tr><td><a href=\"http://bugs.debian.org/#{r['id']}\">#{r['id']}</a></td>" |
| 258 |
|
|
puts "<td>#{r['package']}</td>" |
| 259 |
|
|
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>" |
| 260 |
|
|
puts "<td>#{r['dversion']} / #{r['uversion']}</td>" |
| 261 |
|
|
puts "<td>#{r['insts']}</td>" |
| 262 |
|
|
puts "<td>#{r['title']}</td>" |
| 263 |
|
|
end |
| 264 |
|
|
puts "</table>" |
| 265 |
|
|
sth.finish |
| 266 |
|
|
|
| 267 |
|
|
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") |
| 268 |
|
|
sth.execute ; rows = sth.fetch_all |
| 269 |
|
|
|
| 270 |
|
|
puts "<h2>RC bugs affecting only testing (not unstable, and not pending)</h2>" |
| 271 |
|
|
puts "<table>" |
| 272 |
|
|
puts "<tr><th>bug</th><th>package</th><th>source</th><th>popcon</th><th>title</th></tr>" |
| 273 |
|
|
rows.each do |r| |
| 274 |
|
|
puts "<tr><td><a href=\"http://bugs.debian.org/#{r['id']}\">#{r['id']}</a></td>" |
| 275 |
|
|
puts "<td>#{r['package']}</td>" |
| 276 |
|
|
puts "<td><a href=\"http://packages.qa.debian.org/#{r['source']}\">#{r['source']}</a></td>" |
| 277 |
|
|
puts "<td>#{r['insts']}</td>" |
| 278 |
|
|
puts "<td>#{r['title']}</td>" |
| 279 |
|
|
end |
| 280 |
|
|
puts "</table>" |
| 281 |
|
|
sth.finish |
| 282 |
|
|
|
| 283 |
|
|
=end |
| 284 |
|
|
puts "</table>" |
| 285 |
|
|
sth2 = dbh.prepare("select max(start_time) from timestamps where source = 'bugs' and command = 'run'") |
| 286 |
|
|
sth2.execute ; r2 = sth2.fetch_all |
| 287 |
|
|
puts "<p><b>Generated in #{Time::now - tstart} seconds. Last data update: #{r2[0][0]}</b></p>" |
| 288 |
|
|
puts "<pre>#{q}</pre>" |
| 289 |
|
|
end # if cgi.params != {} |
| 290 |
|
|
puts <<-EOF |
| 291 |
lucas |
1787 |
<hr/> |
| 292 |
|
|
<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> |
| 293 |
lucas |
1786 |
</body> |
| 294 |
|
|
</html> |
| 295 |
|
|
EOF |