| 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 |
lucas |
1788 |
['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 |
lucas |
1786 |
['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 |
lucas |
1789 |
['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 |
|
|
['lenny', 'lenny', 'id in (select id from bugs_rt_affects_stable)'], |
| 17 |
lucas |
1820 |
['any', 'any', 'id in (select id from bugs where status!=\'done\')'], |
| 18 |
lucas |
1786 |
] |
| 19 |
|
|
|
| 20 |
|
|
FILTERS = [ |
| 21 |
lucas |
1787 |
['patch', 'tagged patch', 'id in (select id from bugs_tags where tag=\'patch\')'], |
| 22 |
|
|
['pending', 'tagged pending', 'id in (select id from bugs_tags where tag=\'pending\')'], |
| 23 |
|
|
['security', 'tagged security', 'id in (select id from bugs_tags where tag=\'security\')'], |
| 24 |
lucas |
1841 |
['wontfix', 'tagged wontfix', 'id in (select id from bugs_tags where tag=\'wontfix\')'], |
| 25 |
|
|
['upstream', 'tagged upstream', 'id in (select id from bugs_tags where tag=\'upstream\')'], |
| 26 |
lucas |
1846 |
['unreproducible', 'tagged unreproducible', 'id in (select id from bugs_tags where tag=\'unreproducible\')'], |
| 27 |
lucas |
1841 |
['forwarded', 'forwarded upstream', 'forwarded != \'\''], |
| 28 |
lucas |
1832 |
['claimed', 'claimed bugs', "id in (select id from bugs_usertags where email='bugsquash@qa.debian.org')"], |
| 29 |
lucas |
1836 |
['deferred', 'fixed in deferred/delayed', "id in (select id from deferred_closes)"], |
| 30 |
lucas |
1787 |
['notmain', 'packages not in main', 'id not in (select id from bugs_packages, sources where bugs_packages.source = sources.source and component=\'main\')'], |
| 31 |
|
|
['notsqueeze', 'packages not in squeeze', 'id not in (select id from bugs_packages, sources where bugs_packages.source = sources.source and release=\'squeeze\')'], |
| 32 |
lucas |
1827 |
['base', 'packages in base system', 'bugs.source in (select source from sources where priority=\'required\' or priority=\'important\')'], |
| 33 |
|
|
['standard', 'packages in standard installation', 'bugs.source in (select source from sources where priority=\'standard\')'], |
| 34 |
lucas |
1787 |
['merged', 'merged bugs', 'id in (select id from bugs_merged_with where id > merged_with)'], |
| 35 |
|
|
['done', 'marked as done', 'status = \'done\''], |
| 36 |
lucas |
1820 |
['outdatedsqueeze', 'outdated binaries in squeeze', "bugs.source in (select distinct p1.source from packages_summary p1, packages_summary p2 where p1.source = p2.source and p1.release='squeeze' and p2.release='squeeze' and p1.source_version != p2.source_version)"], |
| 37 |
lucas |
1815 |
['outdatedsid', 'outdated binaries in sid', "bugs.source in (select distinct p1.source from packages_summary p1, packages_summary p2 where p1.source = p2.source and p1.release='sid' and p2.release='sid' and p1.source_version != p2.source_version)"], |
| 38 |
|
|
['needmig', 'different versions in squeeze and sid', "bugs.source in (select s1.source from sources s1, sources s2 where s1.source = s2.source and s1.release = 'squeeze' and s2.release='sid' and s1.version != s2.version)"], |
| 39 |
lucas |
1822 |
['newerubuntu', 'newer in Ubuntu than in sid', "bugs.source in (select s1.source from sources_uniq s1, ubuntu_sources s2 where s1.source = s2.source and s1.release = 'sid' and s2.release='natty' and s1.version < s2.version)"], |
| 40 |
lucas |
1786 |
] |
| 41 |
|
|
|
| 42 |
lucas |
1787 |
TYPES = [ |
| 43 |
|
|
['rc', 'release-critical bugs', 'severity >= \'serious\'', true ], |
| 44 |
|
|
['ipv6', 'release goal: IPv6 support', 'id in (select id from bugs_tags where tag=\'ipv6\')', false ], |
| 45 |
|
|
['lfs', 'release goal: Large File Support', 'id in (select id from bugs_tags where tag=\'lfs\')', false ], |
| 46 |
|
|
['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], |
| 47 |
|
|
['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], |
| 48 |
lucas |
1820 |
['ruby', 'Ruby bugs', "bugs.source in (select source from sources where maintainer ~ 'ruby' or uploaders ~ 'ruby')\nOR bugs.package in (select source from packages where (package ~ 'ruby' or depends ~ 'ruby') and source != 'subversion')\nOR title ~ 'ruby'"], |
| 49 |
lucas |
1827 |
['l10n', 'Localisation bugs', 'id in (select id from bugs_tags where tag=\'l10n\')', false], |
| 50 |
lucas |
1841 |
['xsf', 'X Strike Force bugs', "bugs.source in (select source from sources where maintainer ~ 'debian-x@lists.debian.org')\n"], |
| 51 |
lucas |
1827 |
['allbugs', 'All bugs', 'true', false], |
| 52 |
lucas |
1787 |
] |
| 53 |
lucas |
1786 |
|
| 54 |
|
|
SORTS = [ |
| 55 |
|
|
['id', 'bug#'], |
| 56 |
|
|
['source', 'source package'], |
| 57 |
|
|
['package', 'binary package'], |
| 58 |
lucas |
1794 |
['last_modified', 'last modified'], |
| 59 |
lucas |
1816 |
['severity', 'severity'], |
| 60 |
lucas |
1794 |
['popcon', 'popularity contest'], |
| 61 |
lucas |
1786 |
] |
| 62 |
|
|
|
| 63 |
lucas |
1814 |
COLUMNS = [ |
| 64 |
|
|
['cpopcon', 'popularity contest'], |
| 65 |
|
|
['chints', 'release team hints'], |
| 66 |
lucas |
1816 |
['cseverity', 'severity'], |
| 67 |
lucas |
1831 |
['ctags', 'tags'], |
| 68 |
lucas |
1832 |
['cclaimed', 'claimed by'], |
| 69 |
lucas |
1835 |
['cdeferred', 'deferred/delayed'], |
| 70 |
lucas |
1814 |
] |
| 71 |
|
|
|
| 72 |
lucas |
1786 |
cgi = CGI::new |
| 73 |
|
|
# releases |
| 74 |
|
|
if RELEASE_RESTRICT.map { |r| r[0] }.include?(cgi.params['release'][0]) |
| 75 |
|
|
release = cgi.params['release'][0] |
| 76 |
|
|
else |
| 77 |
lucas |
1787 |
release = 'squeeze' |
| 78 |
lucas |
1786 |
end |
| 79 |
lucas |
1814 |
# columns |
| 80 |
|
|
cols = {} |
| 81 |
|
|
COLUMNS.map { |r| r[0] }.each do |r| |
| 82 |
|
|
if cgi.params[r][0] |
| 83 |
|
|
cols[r] = true |
| 84 |
|
|
else |
| 85 |
|
|
cols[r] = false |
| 86 |
|
|
end |
| 87 |
|
|
end |
| 88 |
lucas |
1786 |
# sorts |
| 89 |
|
|
if SORTS.map { |r| r[0] }.include?(cgi.params['sortby'][0]) |
| 90 |
|
|
sortby = cgi.params['sortby'][0] |
| 91 |
|
|
else |
| 92 |
|
|
sortby = 'id' |
| 93 |
|
|
end |
| 94 |
|
|
if ['asc', 'desc'].include?(cgi.params['sorto'][0]) |
| 95 |
|
|
sorto = cgi.params['sorto'][0] |
| 96 |
|
|
else |
| 97 |
|
|
sorto = 'asc' |
| 98 |
|
|
end |
| 99 |
lucas |
1814 |
# hack to enable popcon column if sortby = popcon |
| 100 |
lucas |
1816 |
cols['cpopcon'] = true if sortby == 'popcon' |
| 101 |
|
|
cols['cseverity'] = true if sortby == 'severity' |
| 102 |
lucas |
1786 |
# filters |
| 103 |
|
|
filters = {} |
| 104 |
|
|
FILTERS.map { |r| r[0] }.each do |e| |
| 105 |
lucas |
1789 |
if ['', 'only', 'ign'].include?(cgi.params[e][0]) |
| 106 |
lucas |
1786 |
filters[e] = cgi.params[e][0] |
| 107 |
|
|
else |
| 108 |
lucas |
1789 |
filters[e] = (e == 'merged' ? 'ign' : '') |
| 109 |
lucas |
1786 |
end |
| 110 |
|
|
end |
| 111 |
lucas |
1787 |
# filter: newer than X days |
| 112 |
lucas |
1789 |
if ['', 'only', 'ign'].include?(cgi.params['fnewer'][0]) |
| 113 |
lucas |
1787 |
fnewer = cgi.params['fnewer'][0] |
| 114 |
|
|
else |
| 115 |
lucas |
1789 |
fnewer = '' |
| 116 |
lucas |
1787 |
end |
| 117 |
|
|
if cgi.params['fnewerval'][0] =~ /^[0-9]+$/ |
| 118 |
|
|
fnewerval = cgi.params['fnewerval'][0].to_i |
| 119 |
|
|
else |
| 120 |
|
|
fnewerval = 7 |
| 121 |
|
|
end |
| 122 |
|
|
# types |
| 123 |
|
|
types = {} |
| 124 |
|
|
TYPES.each do |t| |
| 125 |
|
|
if cgi.params == {} |
| 126 |
|
|
types[t[0]] = t[3] |
| 127 |
|
|
else |
| 128 |
|
|
if cgi.params[t[0]][0] == '1' |
| 129 |
|
|
types[t[0]] = true |
| 130 |
|
|
else |
| 131 |
|
|
types[t[0]] = false |
| 132 |
|
|
end |
| 133 |
|
|
end |
| 134 |
|
|
end |
| 135 |
lucas |
1786 |
|
| 136 |
|
|
puts <<-EOF |
| 137 |
|
|
<html> |
| 138 |
|
|
<head> |
| 139 |
|
|
<style type="text/css"> |
| 140 |
lucas |
1789 |
|
| 141 |
|
|
body { |
| 142 |
|
|
font-family : "DejaVu Sans", "Bitstream Vera Sans", sans-serif;" |
| 143 |
|
|
} |
| 144 |
|
|
|
| 145 |
lucas |
1787 |
table.buglist td, table.buglist th { |
| 146 |
lucas |
1786 |
border: 1px solid gray; |
| 147 |
|
|
padding-left: 3px; |
| 148 |
|
|
padding-right: 3px; |
| 149 |
|
|
} |
| 150 |
lucas |
1787 |
table.buglist tr:hover { |
| 151 |
lucas |
1786 |
background-color: #ccc; |
| 152 |
|
|
} |
| 153 |
|
|
table { |
| 154 |
|
|
border-collapse: collapse; |
| 155 |
|
|
} |
| 156 |
lucas |
1787 |
|
| 157 |
lucas |
1789 |
div#body { |
| 158 |
|
|
border-top: 2px solid #d70751; |
| 159 |
|
|
} |
| 160 |
|
|
|
| 161 |
|
|
div.footer { |
| 162 |
|
|
padding: 0.3em 0; |
| 163 |
|
|
background-color: #fff; |
| 164 |
|
|
text-align: center; |
| 165 |
|
|
border-top: 2px solid #d70751; |
| 166 |
|
|
margin: 0 0 0 0; |
| 167 |
|
|
border-bottom: 0; |
| 168 |
|
|
font-size: 85%; |
| 169 |
|
|
} |
| 170 |
lucas |
1786 |
</style> |
| 171 |
lucas |
1789 |
<title>Debian Bugs Search @ UDD</title> |
| 172 |
lucas |
1831 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> |
| 173 |
lucas |
1786 |
</head> |
| 174 |
|
|
<body> |
| 175 |
lucas |
1789 |
<h1 style="margin-bottom : 5px"><img src="http://qa.debian.org/debian.png" alt="Debian logo" width="188" height="52" style="vertical-align : -13px; ">Bugs Search <span style="color :#c70036">@</span> UDD</h1> |
| 176 |
|
|
<div id="body"> |
| 177 |
lucas |
1786 |
|
| 178 |
|
|
<form action="bugs.cgi" method="get"> |
| 179 |
|
|
<p><b>Bugs affecting:</b> |
| 180 |
|
|
EOF |
| 181 |
|
|
|
| 182 |
|
|
RELEASE_RESTRICT.each do |r| |
| 183 |
|
|
checked = (release == r[0] ? 'CHECKED=\'1\'':'') |
| 184 |
|
|
puts "<input type='radio' name='release' value='#{r[0]}' #{checked}/>#{r[1]} " |
| 185 |
|
|
end |
| 186 |
|
|
puts <<-EOF |
| 187 |
lucas |
1848 |
<br/>(This already uses release tags ('sid', 'squeeze') and xxx-ignore ('squeeze-ignore') to include/exclude bugs)</p> |
| 188 |
lucas |
1787 |
<table class="invisible"><tr><td> |
| 189 |
|
|
<table class="buglist"> |
| 190 |
lucas |
1786 |
<tr><th colspan='4'>FILTERS</th></tr> |
| 191 |
|
|
<tr><th>not considered</th><th>only</th><th>ignore</th><th>type</th></tr> |
| 192 |
|
|
EOF |
| 193 |
|
|
FILTERS.each do |r| |
| 194 |
|
|
puts <<-EOF |
| 195 |
|
|
<tr> |
| 196 |
lucas |
1789 |
<td style='text-align: center;'><input type='radio' name='#{r[0]}' value='' #{filters[r[0]]==''?'CHECKED=\'1\'':''}/></td> |
| 197 |
lucas |
1786 |
<td style='text-align: center;'><input type='radio' name='#{r[0]}' value='only' #{filters[r[0]]=='only'?'CHECKED=\'1\'':''}/></td> |
| 198 |
lucas |
1806 |
<td style='text-align: center;'><input type='radio' name='#{r[0]}' value='ign' #{filters[r[0]]=='ign'?'CHECKED=\'1\'':''}/></td> |
| 199 |
lucas |
1786 |
<td>#{r[1]}</td> |
| 200 |
|
|
</tr> |
| 201 |
|
|
EOF |
| 202 |
|
|
end |
| 203 |
lucas |
1787 |
# newer than |
| 204 |
|
|
puts <<-EOF |
| 205 |
|
|
<tr> |
| 206 |
lucas |
1789 |
<td style='text-align: center;'><input type='radio' name='fnewer' value='' #{fnewer==''?'CHECKED=\'1\'':''}/></td> |
| 207 |
lucas |
1787 |
<td style='text-align: center;'><input type='radio' name='fnewer' value='only' #{fnewer=='only'?'CHECKED=\'1\'':''}/></td> |
| 208 |
lucas |
1806 |
<td style='text-align: center;'><input type='radio' name='fnewer' value='ign' #{fnewer=='ign'?'CHECKED=\'1\'':''}/></td> |
| 209 |
lucas |
1787 |
<td>newer than <input type='text' size='3' name='fnewerval' value='#{fnewerval}'/> days</td> |
| 210 |
|
|
</tr> |
| 211 |
|
|
EOF |
| 212 |
|
|
puts "</table></td><td style='padding-left: 20px'><table class='buglist'>" |
| 213 |
|
|
puts "<tr><th colspan='2'>Bug types</th></tr>" |
| 214 |
|
|
TYPES.each do |t| |
| 215 |
|
|
checked = types[t[0]]?" checked='1'":"" |
| 216 |
|
|
puts "<tr><td><input type='checkbox' name='#{t[0]}' value='1'#{checked}/></td><td>#{t[1]}</td></tr>" |
| 217 |
|
|
end |
| 218 |
|
|
puts "</table></td></tr></table>" |
| 219 |
lucas |
1786 |
puts "<p><b>Sort by:</b> " |
| 220 |
|
|
SORTS.each do |r| |
| 221 |
|
|
checked = (sortby == r[0] ? 'CHECKED=\'1\'':'') |
| 222 |
|
|
puts "<input type='radio' name='sortby' value='#{r[0]}' #{checked}/>#{r[1]} " |
| 223 |
|
|
end |
| 224 |
|
|
puts "<b> -- </b>" |
| 225 |
|
|
[['asc', 'increasing'],[ 'desc', 'decreasing']].each do |r| |
| 226 |
|
|
checked = (sorto == r[0] ? 'CHECKED=\'1\'':'') |
| 227 |
|
|
puts "<input type='radio' name='sorto' value='#{r[0]}' #{checked}/>#{r[1]} " |
| 228 |
|
|
end |
| 229 |
lucas |
1831 |
puts "<br/>\n<b>Additional information:</b> " |
| 230 |
lucas |
1814 |
COLUMNS.each do |r| |
| 231 |
|
|
checked = cols[r[0]] ? 'checked':'' |
| 232 |
|
|
puts "<input type='checkbox' name='#{r[0]}' value='1' #{checked}/>#{r[1]} " |
| 233 |
|
|
end |
| 234 |
lucas |
1786 |
puts <<-EOF |
| 235 |
lucas |
1814 |
<br/>\n<input type='submit' value='Search'/></p> |
| 236 |
lucas |
1786 |
</form> |
| 237 |
|
|
EOF |
| 238 |
|
|
if cgi.params != {} |
| 239 |
|
|
|
| 240 |
lucas |
1787 |
# Generate and execute query |
| 241 |
lucas |
1786 |
tstart = Time::now |
| 242 |
|
|
dbh = DBI::connect('DBI:Pg:dbname=udd;port=5441;host=localhost', 'guest') |
| 243 |
lucas |
1814 |
if cols['cpopcon'] |
| 244 |
lucas |
1816 |
q = "select id, bugs.package, bugs.source, severity, title, last_modified, coalesce(popcon_src.insts, 0) as popcon\nfrom bugs left join popcon_src on (bugs.source = popcon_src.source) \n" |
| 245 |
lucas |
1814 |
else |
| 246 |
lucas |
1816 |
q = "select id, bugs.package, bugs.source, severity, title, last_modified from bugs \n" |
| 247 |
lucas |
1794 |
end |
| 248 |
lucas |
1786 |
q += "where #{RELEASE_RESTRICT.select { |r| r[0] == release }[0][2]} \n" |
| 249 |
|
|
FILTERS.each do |f| |
| 250 |
|
|
if filters[f[0]] == 'only' |
| 251 |
|
|
q += "and #{f[2]} \n" |
| 252 |
|
|
elsif filters[f[0]] == 'ign' |
| 253 |
|
|
q += "and not (#{f[2]}) \n" |
| 254 |
|
|
end |
| 255 |
|
|
end |
| 256 |
lucas |
1787 |
if fnewer == 'only' |
| 257 |
|
|
q += "and (current_timestamp - interval '#{fnewerval} days' <= arrival) \n" |
| 258 |
|
|
elsif fnewer == 'ign' |
| 259 |
|
|
q += "and (current_timestamp - interval '#{fnewerval} days' > arrival) \n" |
| 260 |
|
|
end |
| 261 |
lucas |
1789 |
q2 = TYPES.select { |t| types[t[0]] }.map { |t| t[2] }.join("\n OR ") |
| 262 |
|
|
if q2 != "" |
| 263 |
|
|
q += "AND (#{q2})\n" |
| 264 |
|
|
else |
| 265 |
|
|
puts "<p><b>Must select at least one bug type!</b></p>" |
| 266 |
|
|
q += "AND FALSE\n" |
| 267 |
|
|
end |
| 268 |
lucas |
1786 |
q += "order by #{sortby} #{sorto}" |
| 269 |
lucas |
1820 |
begin |
| 270 |
|
|
sth = dbh.prepare(q) |
| 271 |
|
|
sth.execute |
| 272 |
|
|
rows = sth.fetch_all |
| 273 |
|
|
rescue DBI::ProgrammingError => e |
| 274 |
|
|
puts "<p>The query generated an error, please report it to lucas@debian.org: #{e.message}</p>" |
| 275 |
|
|
puts "<pre>#{q}</pre>" |
| 276 |
|
|
exit(0) |
| 277 |
|
|
end |
| 278 |
lucas |
1786 |
|
| 279 |
lucas |
1814 |
if cols['chints'] |
| 280 |
|
|
sthh = dbh.prepare("select distinct source, type, argument, version, file, comment from relevant_hints order by type") |
| 281 |
|
|
sthh.execute |
| 282 |
|
|
rowsh = sthh.fetch_all |
| 283 |
|
|
hints = {} |
| 284 |
|
|
rowsh.each do |r| |
| 285 |
|
|
hints[r['source']] ||= [] |
| 286 |
|
|
hints[r['source']] << r |
| 287 |
|
|
end |
| 288 |
|
|
end |
| 289 |
|
|
|
| 290 |
lucas |
1831 |
if cols['ctags'] |
| 291 |
|
|
ids = rows.map { |r| r['id'] }.join(',') |
| 292 |
|
|
stht = dbh.prepare("select id, tag from bugs_tags where id in (#{ids})") |
| 293 |
|
|
stht.execute |
| 294 |
|
|
rowst = stht.fetch_all |
| 295 |
|
|
tags = {} |
| 296 |
|
|
rowst.each do |r| |
| 297 |
|
|
tags[r['id']] ||= [] |
| 298 |
|
|
tags[r['id']] << r['tag'] |
| 299 |
|
|
end |
| 300 |
|
|
end |
| 301 |
|
|
|
| 302 |
lucas |
1832 |
if cols['cclaimed'] |
| 303 |
|
|
ids = rows.map { |r| r['id'] }.join(',') |
| 304 |
lucas |
1847 |
stht = dbh.prepare("select distinct id, tag from bugs_usertags where email='bugsquash@qa.debian.org' and id in (#{ids})") |
| 305 |
lucas |
1832 |
stht.execute |
| 306 |
|
|
rowst = stht.fetch_all |
| 307 |
|
|
claimedbugs = {} |
| 308 |
|
|
rowst.each do |r| |
| 309 |
|
|
claimedbugs[r['id']] ||= [] |
| 310 |
|
|
claimedbugs[r['id']] << r['tag'] |
| 311 |
|
|
end |
| 312 |
|
|
end |
| 313 |
|
|
|
| 314 |
lucas |
1835 |
if cols['cdeferred'] |
| 315 |
|
|
ids = rows.map { |r| r['id'] }.join(',') |
| 316 |
lucas |
1847 |
sthd = dbh.prepare("select id, deferred.source, deferred.version, extract (day from delay_remaining) as du from deferred, deferred_closes where deferred.source = deferred_closes.source and deferred.version = deferred_closes.version and deferred_closes.id in (#{ids})") |
| 317 |
lucas |
1835 |
sthd.execute |
| 318 |
|
|
rowsd = sthd.fetch_all |
| 319 |
|
|
deferredbugs = {} |
| 320 |
|
|
rowsd.each do |r| |
| 321 |
|
|
d = r['du'].to_i |
| 322 |
lucas |
1838 |
deferredbugs[r['id']] = "#{r['version']} (#{d} day#{d==1?'':'s'})" |
| 323 |
lucas |
1835 |
end |
| 324 |
|
|
end |
| 325 |
|
|
|
| 326 |
lucas |
1786 |
puts "<p><b>#{rows.length} bugs found.</b></p>" |
| 327 |
lucas |
1794 |
puts '<table class="buglist">' |
| 328 |
lucas |
1814 |
puts '<tr><th>bug#</th><th>package</th><th>title</th>' |
| 329 |
lucas |
1816 |
puts '<th>popcon</th>' if cols['cpopcon'] |
| 330 |
|
|
puts '<th>severity</th>' if cols['cseverity'] |
| 331 |
lucas |
1832 |
puts '<th>hints</th>' if cols['chints'] |
| 332 |
|
|
puts '<th>claimed by</th>' if cols['cclaimed'] |
| 333 |
lucas |
1835 |
puts '<th>deferred</th>' if cols['cdeferred'] |
| 334 |
lucas |
1814 |
puts '<th>last modified</th></tr>' |
| 335 |
lucas |
1794 |
|
| 336 |
lucas |
1814 |
def genhints(source, hints) |
| 337 |
|
|
return '' if hints.nil? |
| 338 |
|
|
s = '' |
| 339 |
|
|
hints.each do |h| |
| 340 |
|
|
v = h['version'] ? h['version'] + ' ' : '' |
| 341 |
|
|
t = h['type'] == 'age-days' ? "age/#{h['argument']}" : h['type'] |
| 342 |
|
|
s += "<a href=\"http://release.debian.org/britney/hints/#{h['file']}\" title=\"#{v}#{h['file']} #{h['comment']}\">#{t}</a> " |
| 343 |
|
|
end |
| 344 |
|
|
s |
| 345 |
|
|
end |
| 346 |
|
|
|
| 347 |
lucas |
1831 |
# copied from /org/bugs.debian.org/etc/config |
| 348 |
|
|
$TagsSingleLetter = { |
| 349 |
|
|
'patch' => '+', |
| 350 |
|
|
'wontfix' => '☹', |
| 351 |
|
|
'moreinfo' => 'M', |
| 352 |
|
|
'unreproducible' => 'R', |
| 353 |
|
|
'security' => 'S', |
| 354 |
|
|
'pending' => 'P', |
| 355 |
|
|
'fixed' => 'F', |
| 356 |
|
|
'help' => 'H', |
| 357 |
|
|
'fixed-upstream' => 'U', |
| 358 |
|
|
'upstream' => 'u', |
| 359 |
|
|
# Added tags |
| 360 |
|
|
'confirmed' => 'C', |
| 361 |
|
|
'etch-ignore' => 'etc-i', |
| 362 |
|
|
'lenny-ignore' => 'len-i', |
| 363 |
|
|
'sarge-ignore' => 'sar-i', |
| 364 |
|
|
'squeeze-ignore' => 'squ-i', |
| 365 |
|
|
'woody' => 'wod', |
| 366 |
|
|
'sarge' => 'sar', |
| 367 |
|
|
'etch' => 'etc', |
| 368 |
|
|
'lenny' => 'len', |
| 369 |
|
|
'squeeze' => 'squ', |
| 370 |
|
|
'sid' => 'sid', |
| 371 |
|
|
'experimental' => 'exp', |
| 372 |
|
|
'l10n' => 'l10n', |
| 373 |
|
|
'd-i' => 'd-i', |
| 374 |
|
|
'ipv6' => 'ipv6', |
| 375 |
|
|
'lfs' => 'lfs', |
| 376 |
|
|
'fixed-in-experimental' => 'fie', |
| 377 |
|
|
} |
| 378 |
|
|
|
| 379 |
|
|
def gentags(tags) |
| 380 |
|
|
return '' if tags.nil? |
| 381 |
|
|
tags.sort! |
| 382 |
|
|
texttags = tags.map do |tag| |
| 383 |
|
|
puts "unknowntag: #{tag}" if $TagsSingleLetter[tag].nil? |
| 384 |
|
|
"<abbr title='#{tag}'>#{$TagsSingleLetter[tag]}</abbr>" |
| 385 |
|
|
end |
| 386 |
|
|
return ' [' + texttags.join('|') + ']' |
| 387 |
|
|
end |
| 388 |
|
|
|
| 389 |
lucas |
1786 |
rows.each do |r| |
| 390 |
lucas |
1831 |
print "<tr><td style='text-align: left;'><a href=\"http://bugs.debian.org/#{r['id']}\">##{r['id']}</a>" |
| 391 |
|
|
puts "#{gentags(tags[r['id']])}" if cols['ctags'] |
| 392 |
|
|
puts "</td>" |
| 393 |
lucas |
1787 |
puts "<td style='text-align: center;'>" |
| 394 |
lucas |
1788 |
srcs = r['source'].split(/,\s*/) |
| 395 |
|
|
bins = r['package'].split(/,\s*/) |
| 396 |
|
|
puts (0...bins.length).map { |i| "<a href=\"http://packages.qa.debian.org/#{srcs[i]}\">#{bins[i]}</a>" }.join(', ') |
| 397 |
lucas |
1787 |
puts "</td>" |
| 398 |
lucas |
1794 |
puts "<td>#{CGI::escapeHTML(r['title'])}</td>" |
| 399 |
lucas |
1816 |
puts "<td>#{r['popcon']}</td>" if cols['cpopcon'] |
| 400 |
|
|
puts "<td>#{r['severity']}</td>" if cols['cseverity'] |
| 401 |
|
|
puts "<td>#{genhints(r['source'], hints[r['source']])}</td>" if cols['chints'] |
| 402 |
lucas |
1832 |
puts "<td>#{claimedbugs[r['id']]}</td>" if cols['cclaimed'] |
| 403 |
lucas |
1835 |
puts "<td>#{deferredbugs[r['id']]}</td>" if cols['cdeferred'] |
| 404 |
lucas |
1794 |
puts "<td style='text-align: center;'>#{r['last_modified'].to_date}</td></tr>" |
| 405 |
lucas |
1786 |
end |
| 406 |
|
|
|
| 407 |
|
|
puts "</table>" |
| 408 |
|
|
sth2 = dbh.prepare("select max(start_time) from timestamps where source = 'bugs' and command = 'run'") |
| 409 |
|
|
sth2.execute ; r2 = sth2.fetch_all |
| 410 |
lucas |
1789 |
puts "<p><b>Generated in #{Time::now - tstart} seconds. Last data update: #{r2[0][0]}" |
| 411 |
|
|
puts " (%.1f hours ago)</b></p>" % ((Time::now - r2[0][0].to_time) / 3600) |
| 412 |
lucas |
1786 |
puts "<pre>#{q}</pre>" |
| 413 |
|
|
end # if cgi.params != {} |
| 414 |
|
|
puts <<-EOF |
| 415 |
lucas |
1789 |
</div> |
| 416 |
|
|
<div class="footer"> |
| 417 |
lucas |
1820 |
<small>Suggestions / comments / patches to lucas@debian.org. <a href="http://svn.debian.org/wsvn/collab-qa/udd/web/bugs.cgi">source code</a>.</small> |
| 418 |
lucas |
1789 |
</div> |
| 419 |
lucas |
1786 |
</body> |
| 420 |
|
|
</html> |
| 421 |
|
|
EOF |