[Collab-qa-commits] r1787 - udd/web/cgi-bin

Lucas Nussbaum lucas at alioth.debian.org
Mon Sep 13 13:32:53 UTC 2010


Author: lucas
Date: 2010-09-13 13:32:51 +0000 (Mon, 13 Sep 2010)
New Revision: 1787

Modified:
   udd/web/cgi-bin/bugs.cgi
Log:
improve RC bugs list

Modified: udd/web/cgi-bin/bugs.cgi
===================================================================
--- udd/web/cgi-bin/bugs.cgi	2010-09-13 09:15:56 UTC (rev 1786)
+++ udd/web/cgi-bin/bugs.cgi	2010-09-13 13:32:51 UTC (rev 1787)
@@ -16,17 +16,23 @@
 ]
 
 FILTERS = [
- ['fpatch', 'tagged patch', 'id in (select id from bugs_tags where tag=\'patch\')'],
- ['fsecurity', 'tagged security', 'id in (select id from bugs_tags where tag=\'security\')'],
- ['fdone', 'marked as done', 'status = \'done\''],
- ['fpending', 'tagged pending', 'id in (select id from bugs_tags where tag=\'pending\')'],
+ ['patch', 'tagged patch', 'id in (select id from bugs_tags where tag=\'patch\')'],
+ ['pending', 'tagged pending', 'id in (select id from bugs_tags where tag=\'pending\')'],
+ ['security', 'tagged security', 'id in (select id from bugs_tags where tag=\'security\')'],
+ ['notmain', 'packages not in main', 'id not in (select id from bugs_packages, sources where bugs_packages.source = sources.source and component=\'main\')'],
+ ['notsqueeze', 'packages not in squeeze', 'id not in (select id from bugs_packages, sources where bugs_packages.source = sources.source and release=\'squeeze\')'],
+ ['merged', 'merged bugs', 'id in (select id from bugs_merged_with where id > merged_with)'],
+ ['done', 'marked as done', 'status = \'done\''],
 ]
 
-# ignore merged bugs ['fmerged', 'merged bugs', 'id in (select id from bugs_merged_with where id > merged_with)'],
+TYPES = [
+  ['rc', 'release-critical bugs', 'severity >= \'serious\'', true ],
+  ['ipv6', 'release goal: IPv6 support', 'id in (select id from bugs_tags where tag=\'ipv6\')', false ],
+  ['lfs', 'release goal: Large File Support', 'id in (select id from bugs_tags where tag=\'lfs\')', false ],
+  ['boot', 'release goal: boot performance (init.d dependencies)', 'id in (select id from bugs_usertags where email = \'initscripts-ng-devel at lists.alioth.debian.org\')', false],
+  ['oldgnome', 'release goal: remove obsolete GNOME libraries', 'id in (select id from bugs_usertags where email = \'pkg-gnome-maintainers at lists.alioth.debian.org\' and tag=\'oldlibs\')', false],
+]
 
-# not in squeeze
-# ['fnotmain', 'not in main', 'FIXME'],
-# ['fnewer', 'newer than 7 days', 'FIXME'],
 SORTS = [
   ['id', 'bug#'],
   ['source', 'source package'],
@@ -35,12 +41,11 @@
 ]
 
 cgi = CGI::new
-p cgi.params
 # releases
 if RELEASE_RESTRICT.map { |r| r[0] }.include?(cgi.params['release'][0])
   release = cgi.params['release'][0]
 else
-  release = 'squeeze_or_sid'
+  release = 'squeeze'
 end
 # sorts
 if SORTS.map { |r| r[0] }.include?(cgi.params['sortby'][0])
@@ -59,25 +64,50 @@
   if ['notconsidered', 'only', 'ign'].include?(cgi.params[e][0])
     filters[e] = cgi.params[e][0]
   else
-    filters[e] = 'notconsidered'
+    filters[e] = (e == 'merged' ? 'ign' : 'notconsidered')
   end
 end
+# filter: newer than X days
+if ['notconsidered', 'only', 'ign'].include?(cgi.params['fnewer'][0])
+  fnewer = cgi.params['fnewer'][0]
+else
+  fnewer = 'notconsidered'
+end
+if cgi.params['fnewerval'][0] =~ /^[0-9]+$/
+  fnewerval = cgi.params['fnewerval'][0].to_i
+else
+  fnewerval = 7
+end
+# types
+types = {}
+TYPES.each do |t|
+  if cgi.params == {}
+    types[t[0]] = t[3]
+  else
+    if cgi.params[t[0]][0] == '1'
+      types[t[0]] = true
+    else
+      types[t[0]] = false
+    end
+  end
+end
 
 puts <<-EOF
 <html>
 <head>
 <style type="text/css">
-  td, th {
+  table.buglist td, table.buglist th {
     border: 1px solid gray;
     padding-left: 3px;
     padding-right: 3px;
   }
-  tr:hover  {
+  table.buglist tr:hover  {
     background-color: #ccc;
   }
   table {
     border-collapse: collapse;
   }
+
 </style>
 <title>RC Bugs List @ UDD</title>
 </head>
@@ -94,7 +124,8 @@
 end
 puts <<-EOF
 </p>
-<table>
+<table class="invisible"><tr><td>
+<table class="buglist">
 <tr><th colspan='4'>FILTERS</th></tr>
 <tr><th>not considered</th><th>only</th><th>ignore</th><th>type</th></tr>
 EOF
@@ -103,13 +134,27 @@
   <tr>
   <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='only' #{filters[r[0]]=='only'?'CHECKED=\'1\'':''}/></td>
-  <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>
   <td>#{r[1]}</td>
   </tr>
   EOF
 end
-
-puts "</table>"
+# newer than
+puts <<-EOF
+  <tr>
+  <td style='text-align: center;'><input type='radio' name='fnewer' value='' #{fnewer=='notconsidered'?'CHECKED=\'1\'':''}/></td>
+  <td style='text-align: center;'><input type='radio' name='fnewer' value='only' #{fnewer=='only'?'CHECKED=\'1\'':''}/></td>
+  <td style='text-align: center;'><input type='radio' name='fnewer' value='ign' #{fnewer=='ign'?'CHECKED=\'1\'':''}'/></td>
+  <td>newer than <input type='text' size='3' name='fnewerval' value='#{fnewerval}'/> days</td>
+  </tr>
+EOF
+puts "</table></td><td style='padding-left: 20px'><table class='buglist'>"
+puts "<tr><th colspan='2'>Bug types</th></tr>"
+TYPES.each do |t|
+  checked = types[t[0]]?" checked='1'":""
+  puts "<tr><td><input type='checkbox' name='#{t[0]}' value='1'#{checked}/></td><td>#{t[1]}</td></tr>"
+end
+puts "</table></td></tr></table>"
 puts "<p><b>Sort by:</b> "
 SORTS.each do |r|
   checked = (sortby == r[0] ? 'CHECKED=\'1\'':'')
@@ -121,17 +166,16 @@
   puts "<input type='radio' name='sorto' value='#{r[0]}' #{checked}/>#{r[1]}&nbsp;&nbsp;"
 end
 puts <<-EOF
-</p><input type='submit'/>
+</p><input type='submit' value='Update'/>
 </form>
 EOF
 if cgi.params != {}
 
+# Generate and execute query
 tstart = Time::now
-
 dbh = DBI::connect('DBI:Pg:dbname=udd;port=5441;host=localhost', 'guest')
 q = "select id, bugs.package, bugs.source, title, last_modified from bugs \n"
 q += "where #{RELEASE_RESTRICT.select { |r| r[0] == release }[0][2]} \n"
-q += "and severity >= 'serious' \n" # hack hack hack
 FILTERS.each do |f|
   if filters[f[0]] == 'only'
     q += "and #{f[2]} \n"
@@ -139,7 +183,14 @@
     q += "and not (#{f[2]}) \n"
   end
 end
-
+if fnewer == 'only'
+  q += "and (current_timestamp - interval '#{fnewerval} days' <= arrival) \n"
+elsif fnewer == 'ign'
+  q += "and (current_timestamp - interval '#{fnewerval} days' > arrival) \n"
+end
+q += "AND ("
+q += TYPES.select { |t| types[t[0]] }.map { |t| t[2] }.join("\n OR ")
+q += ")\n "
 q += "order by #{sortby} #{sorto}"
 sth = dbh.prepare(q)
 sth.execute
@@ -147,14 +198,15 @@
 
 puts "<p><b>#{rows.length} bugs found.</b></p>"
 puts <<-EOF
-<table>
+<table class="buglist">
 <tr><th>bug#</th><th>source pkg</th><th>binary pkg</th><th>title</th><th>last&nbsp;modified</th></tr>
 EOF
 rows.each do |r|
+  puts "<tr><td style='text-align: center;'><a href=\"http://bugs.debian.org/#{r['id']}\">##{r['id']}</a></td>"
+  puts "<td style='text-align: center;'>"
+  puts r['source'].split(/,\s*/).map { |pkg| "<a href=\"http://packages.qa.debian.org/#{pkg}\">#{pkg}</a>" }.join(', ')
+  puts "</td>"
   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>
   <td style='text-align: center;'>#{r['package']}</td>
   <td>#{r['title']}</td>
   <td style='text-align: center;'>#{r['last_modified'].to_date}</td>
@@ -236,6 +288,8 @@
 puts "<pre>#{q}</pre>"
 end # if cgi.params != {}
 puts <<-EOF
+<hr/>
+<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>
 </body>
 </html>
 EOF




More information about the Collab-qa-commits mailing list