| 16 |
] |
] |
| 17 |
|
|
| 18 |
FILTERS = [ |
FILTERS = [ |
| 19 |
['fpatch', 'tagged patch', 'id in (select id from bugs_tags where tag=\'patch\')'], |
['patch', 'tagged patch', 'id in (select id from bugs_tags where tag=\'patch\')'], |
| 20 |
['fsecurity', 'tagged security', 'id in (select id from bugs_tags where tag=\'security\')'], |
['pending', 'tagged pending', 'id in (select id from bugs_tags where tag=\'pending\')'], |
| 21 |
['fdone', 'marked as done', 'status = \'done\''], |
['security', 'tagged security', 'id in (select id from bugs_tags where tag=\'security\')'], |
| 22 |
['fpending', 'tagged pending', 'id in (select id from bugs_tags where tag=\'pending\')'], |
['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 |
# ignore merged bugs ['fmerged', 'merged bugs', 'id in (select id from bugs_merged_with where id > merged_with)'], |
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 |
|
|
|
# not in squeeze |
|
|
# ['fnotmain', 'not in main', 'FIXME'], |
|
|
# ['fnewer', 'newer than 7 days', 'FIXME'], |
|
| 36 |
SORTS = [ |
SORTS = [ |
| 37 |
['id', 'bug#'], |
['id', 'bug#'], |
| 38 |
['source', 'source package'], |
['source', 'source package'], |
| 41 |
] |
] |
| 42 |
|
|
| 43 |
cgi = CGI::new |
cgi = CGI::new |
|
p cgi.params |
|
| 44 |
# releases |
# releases |
| 45 |
if RELEASE_RESTRICT.map { |r| r[0] }.include?(cgi.params['release'][0]) |
if RELEASE_RESTRICT.map { |r| r[0] }.include?(cgi.params['release'][0]) |
| 46 |
release = cgi.params['release'][0] |
release = cgi.params['release'][0] |
| 47 |
else |
else |
| 48 |
release = 'squeeze_or_sid' |
release = 'squeeze' |
| 49 |
end |
end |
| 50 |
# sorts |
# sorts |
| 51 |
if SORTS.map { |r| r[0] }.include?(cgi.params['sortby'][0]) |
if SORTS.map { |r| r[0] }.include?(cgi.params['sortby'][0]) |
| 64 |
if ['notconsidered', 'only', 'ign'].include?(cgi.params[e][0]) |
if ['notconsidered', 'only', 'ign'].include?(cgi.params[e][0]) |
| 65 |
filters[e] = cgi.params[e][0] |
filters[e] = cgi.params[e][0] |
| 66 |
else |
else |
| 67 |
filters[e] = 'notconsidered' |
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 |
end |
| 93 |
end |
end |
| 94 |
|
|
| 96 |
<html> |
<html> |
| 97 |
<head> |
<head> |
| 98 |
<style type="text/css"> |
<style type="text/css"> |
| 99 |
td, th { |
table.buglist td, table.buglist th { |
| 100 |
border: 1px solid gray; |
border: 1px solid gray; |
| 101 |
padding-left: 3px; |
padding-left: 3px; |
| 102 |
padding-right: 3px; |
padding-right: 3px; |
| 103 |
} |
} |
| 104 |
tr:hover { |
table.buglist tr:hover { |
| 105 |
background-color: #ccc; |
background-color: #ccc; |
| 106 |
} |
} |
| 107 |
table { |
table { |
| 108 |
border-collapse: collapse; |
border-collapse: collapse; |
| 109 |
} |
} |
| 110 |
|
|
| 111 |
</style> |
</style> |
| 112 |
<title>RC Bugs List @ UDD</title> |
<title>RC Bugs List @ UDD</title> |
| 113 |
</head> |
</head> |
| 124 |
end |
end |
| 125 |
puts <<-EOF |
puts <<-EOF |
| 126 |
</p> |
</p> |
| 127 |
<table> |
<table class="invisible"><tr><td> |
| 128 |
|
<table class="buglist"> |
| 129 |
<tr><th colspan='4'>FILTERS</th></tr> |
<tr><th colspan='4'>FILTERS</th></tr> |
| 130 |
<tr><th>not considered</th><th>only</th><th>ignore</th><th>type</th></tr> |
<tr><th>not considered</th><th>only</th><th>ignore</th><th>type</th></tr> |
| 131 |
EOF |
EOF |
| 134 |
<tr> |
<tr> |
| 135 |
<td style='text-align: center;'><input type='radio' name='#{r[0]}' value='' #{filters[r[0]]=='notconsidered'?'CHECKED=\'1\'':''}/></td> |
<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> |
<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> |
<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> |
<td>#{r[1]}</td> |
| 139 |
</tr> |
</tr> |
| 140 |
EOF |
EOF |
| 141 |
end |
end |
| 142 |
|
# newer than |
| 143 |
puts "</table>" |
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> " |
puts "<p><b>Sort by:</b> " |
| 159 |
SORTS.each do |r| |
SORTS.each do |r| |
| 160 |
checked = (sortby == r[0] ? 'CHECKED=\'1\'':'') |
checked = (sortby == r[0] ? 'CHECKED=\'1\'':'') |
| 166 |
puts "<input type='radio' name='sorto' value='#{r[0]}' #{checked}/>#{r[1]} " |
puts "<input type='radio' name='sorto' value='#{r[0]}' #{checked}/>#{r[1]} " |
| 167 |
end |
end |
| 168 |
puts <<-EOF |
puts <<-EOF |
| 169 |
</p><input type='submit'/> |
</p><input type='submit' value='Update'/> |
| 170 |
</form> |
</form> |
| 171 |
EOF |
EOF |
| 172 |
if cgi.params != {} |
if cgi.params != {} |
| 173 |
|
|
| 174 |
|
# Generate and execute query |
| 175 |
tstart = Time::now |
tstart = Time::now |
|
|
|
| 176 |
dbh = DBI::connect('DBI:Pg:dbname=udd;port=5441;host=localhost', 'guest') |
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" |
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" |
q += "where #{RELEASE_RESTRICT.select { |r| r[0] == release }[0][2]} \n" |
|
q += "and severity >= 'serious' \n" # hack hack hack |
|
| 179 |
FILTERS.each do |f| |
FILTERS.each do |f| |
| 180 |
if filters[f[0]] == 'only' |
if filters[f[0]] == 'only' |
| 181 |
q += "and #{f[2]} \n" |
q += "and #{f[2]} \n" |
| 183 |
q += "and not (#{f[2]}) \n" |
q += "and not (#{f[2]}) \n" |
| 184 |
end |
end |
| 185 |
end |
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}" |
q += "order by #{sortby} #{sorto}" |
| 195 |
sth = dbh.prepare(q) |
sth = dbh.prepare(q) |
| 196 |
sth.execute |
sth.execute |
| 198 |
|
|
| 199 |
puts "<p><b>#{rows.length} bugs found.</b></p>" |
puts "<p><b>#{rows.length} bugs found.</b></p>" |
| 200 |
puts <<-EOF |
puts <<-EOF |
| 201 |
<table> |
<table class="buglist"> |
| 202 |
<tr><th>bug#</th><th>source pkg</th><th>binary pkg</th><th>title</th><th>last modified</th></tr> |
<tr><th>bug#</th><th>source pkg</th><th>binary pkg</th><th>title</th><th>last modified</th></tr> |
| 203 |
EOF |
EOF |
| 204 |
rows.each do |r| |
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 |
|
puts r['source'].split(/,\s*/).map { |pkg| "<a href=\"http://packages.qa.debian.org/#{pkg}\">#{pkg}</a>" }.join(', ') |
| 208 |
|
puts "</td>" |
| 209 |
puts <<-EOF |
puts <<-EOF |
|
<tr> |
|
|
<td style='text-align: center;'><a href="http://bugs.debian.org/#{r['id']}">##{r['id']}</a></td> |
|
|
<td style='text-align: center;'>#{r['source']}</td> |
|
| 210 |
<td style='text-align: center;'>#{r['package']}</td> |
<td style='text-align: center;'>#{r['package']}</td> |
| 211 |
<td>#{r['title']}</td> |
<td>#{r['title']}</td> |
| 212 |
<td style='text-align: center;'>#{r['last_modified'].to_date}</td> |
<td style='text-align: center;'>#{r['last_modified'].to_date}</td> |
| 288 |
puts "<pre>#{q}</pre>" |
puts "<pre>#{q}</pre>" |
| 289 |
end # if cgi.params != {} |
end # if cgi.params != {} |
| 290 |
puts <<-EOF |
puts <<-EOF |
| 291 |
|
<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 |
</body> |
</body> |
| 294 |
</html> |
</html> |
| 295 |
EOF |
EOF |