/[collab-qa]/udd/web/bugs.cgi
ViewVC logotype

Diff of /udd/web/bugs.cgi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1813 by lucas, Sat Sep 25 06:44:03 2010 UTC revision 1814 by lucas, Sat Sep 25 14:06:27 2010 UTC
# Line 46  SORTS = [ Line 46  SORTS = [
46    ['popcon', 'popularity contest'],    ['popcon', 'popularity contest'],
47  ]  ]
48    
49    COLUMNS = [
50      ['cpopcon', 'popularity contest'],
51      ['chints', 'release team hints'],
52    ]
53    
54  cgi = CGI::new  cgi = CGI::new
55  # releases  # releases
56  if RELEASE_RESTRICT.map { |r| r[0] }.include?(cgi.params['release'][0])  if RELEASE_RESTRICT.map { |r| r[0] }.include?(cgi.params['release'][0])
# Line 53  if RELEASE_RESTRICT.map { |r| r[0] }.inc Line 58  if RELEASE_RESTRICT.map { |r| r[0] }.inc
58  else  else
59    release = 'squeeze'    release = 'squeeze'
60  end  end
61    # columns
62    cols = {}
63    COLUMNS.map { |r| r[0] }.each do |r|
64      if cgi.params[r][0]
65        cols[r] = true
66      else
67        cols[r] = false
68      end
69    end
70  # sorts  # sorts
71  if SORTS.map { |r| r[0] }.include?(cgi.params['sortby'][0])  if SORTS.map { |r| r[0] }.include?(cgi.params['sortby'][0])
72    sortby = cgi.params['sortby'][0]    sortby = cgi.params['sortby'][0]
# Line 64  if ['asc', 'desc'].include?(cgi.params[' Line 78  if ['asc', 'desc'].include?(cgi.params['
78  else  else
79    sorto = 'asc'    sorto = 'asc'
80  end  end
81    # hack to enable popcon column if sortby = popcon
82    if sortby == 'popcon'
83      cols['cpopcon'] = true
84    end
85  # filters  # filters
86  filters = {}  filters = {}
87  FILTERS.map { |r| r[0] }.each do |e|  FILTERS.map { |r| r[0] }.each do |e|
# Line 190  puts "<b> -- </b>" Line 208  puts "<b> -- </b>"
208    checked = (sorto == r[0] ? 'CHECKED=\'1\'':'')    checked = (sorto == r[0] ? 'CHECKED=\'1\'':'')
209    puts "<input type='radio' name='sorto' value='#{r[0]}' #{checked}/>#{r[1]}&nbsp;&nbsp;"    puts "<input type='radio' name='sorto' value='#{r[0]}' #{checked}/>#{r[1]}&nbsp;&nbsp;"
210  end  end
211    puts "<br/>\n<b>Additional columns:</b> "
212    COLUMNS.each do |r|
213      checked = cols[r[0]] ? 'checked':''
214      puts "<input type='checkbox' name='#{r[0]}' value='1' #{checked}/>#{r[1]}&nbsp;&nbsp;"
215    end
216  puts <<-EOF  puts <<-EOF
217  </p><input type='submit' value='Search'/>  <br/>\n<input type='submit' value='Search'/></p>
218  </form>  </form>
219  EOF  EOF
220  if cgi.params != {}  if cgi.params != {}
# Line 199  if cgi.params != {} Line 222  if cgi.params != {}
222  # Generate and execute query  # Generate and execute query
223  tstart = Time::now  tstart = Time::now
224  dbh = DBI::connect('DBI:Pg:dbname=udd;port=5441;host=localhost', 'guest')  dbh = DBI::connect('DBI:Pg:dbname=udd;port=5441;host=localhost', 'guest')
225  if sortby != 'popcon'  if cols['cpopcon']
   q = "select id, bugs.package, bugs.source, title, last_modified from bugs \n"  
 else  
226    q = "select id, bugs.package, bugs.source, title, last_modified, coalesce(popcon_src.insts, 0) as popcon\nfrom bugs left join popcon_src on (bugs.source = popcon_src.source) \n"    q = "select id, bugs.package, bugs.source, title, last_modified, coalesce(popcon_src.insts, 0) as popcon\nfrom bugs left join popcon_src on (bugs.source = popcon_src.source) \n"
227    else
228      q = "select id, bugs.package, bugs.source, title, last_modified from bugs \n"
229  end  end
230  q += "where #{RELEASE_RESTRICT.select { |r| r[0] == release }[0][2]} \n"  q += "where #{RELEASE_RESTRICT.select { |r| r[0] == release }[0][2]} \n"
231  FILTERS.each do |f|  FILTERS.each do |f|
# Line 229  sth = dbh.prepare(q) Line 252  sth = dbh.prepare(q)
252  sth.execute  sth.execute
253  rows = sth.fetch_all  rows = sth.fetch_all
254    
255    if cols['chints']
256      sthh = dbh.prepare("select distinct source, type, argument, version, file, comment from relevant_hints order by type")
257      sthh.execute
258      rowsh = sthh.fetch_all
259      hints = {}
260      rowsh.each do |r|
261        hints[r['source']] ||= []
262        hints[r['source']] << r
263      end
264    end
265    
266  puts "<p><b>#{rows.length} bugs found.</b></p>"  puts "<p><b>#{rows.length} bugs found.</b></p>"
267  puts '<table class="buglist">'  puts '<table class="buglist">'
268  if sortby != 'popcon'  puts '<tr><th>bug#</th><th>package</th><th>title</th>'
269    puts '<tr><th>bug#</th><th>package</th><th>title</th><th>last&nbsp;modified</th></tr>'  if cols['cpopcon']
270  else    puts '<th>popcon</th>'
271    puts '<tr><th>bug#</th><th>package</th><th>title</th><th>popcon</th><th>last&nbsp;modified</th></tr>'  end
272    if cols['chints']
273      puts '<th>hints</th>'
274    end
275    puts '<th>last&nbsp;modified</th></tr>'
276    
277    def genhints(source, hints)
278      return '' if hints.nil?
279      s = ''
280      hints.each do |h|
281        v = h['version'] ? h['version'] + ' ' : ''
282        t = h['type'] == 'age-days' ? "age/#{h['argument']}" : h['type']
283        s += "<a href=\"http://release.debian.org/britney/hints/#{h['file']}\" title=\"#{v}#{h['file']} #{h['comment']}\">#{t}</a> "
284      end
285      s
286  end  end
287    
288  rows.each do |r|  rows.each do |r|
# Line 245  rows.each do |r| Line 293  rows.each do |r|
293    puts (0...bins.length).map { |i| "<a href=\"http://packages.qa.debian.org/#{srcs[i]}\">#{bins[i]}</a>" }.join(', ')    puts (0...bins.length).map { |i| "<a href=\"http://packages.qa.debian.org/#{srcs[i]}\">#{bins[i]}</a>" }.join(', ')
294    puts "</td>"    puts "</td>"
295    puts "<td>#{CGI::escapeHTML(r['title'])}</td>"    puts "<td>#{CGI::escapeHTML(r['title'])}</td>"
296    if sortby == 'popcon'    if cols['cpopcon']
297      puts "<td>#{r['popcon']}</td>"      puts "<td>#{r['popcon']}</td>"
298    end    end
299      if cols['chints']
300        puts "<td>#{genhints(r['source'], hints[r['source']])}</td>"
301      end
302    puts "<td style='text-align: center;'>#{r['last_modified'].to_date}</td></tr>"    puts "<td style='text-align: center;'>#{r['last_modified'].to_date}</td></tr>"
303  end  end
 =begin  
 release goals:  
 all  
 include / only  
   
 columns:  
 id  
 source  
 package  
 title  
   
 time  
 data last refreshed  
 EOF  
 =end  
   
 =begin  
 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")  
 sth.execute ; rows = sth.fetch_all  
   
 puts "<h2>RC bugs tagged patch (and not pending)</h2>"  
 puts "<table>"  
 puts "<tr><th>bug</th><th>package</th><th>source</th><th>popcon</th><th>title</th></tr>"  
 rows.each do |r|  
    puts "<tr><td><a href=\"http://bugs.debian.org/#{r['id']}\">#{r['id']}</a></td>"  
    puts "<td>#{r['package']}</td>"  
    puts "<td><a href=\"http://packages.qa.debian.org/#{r['source']}\">#{r['source']}</a></td>"  
    puts "<td>#{r['insts']}</td>"  
    puts "<td>#{r['title']}</td>"  
 end  
 puts "</table>"  
 sth.finish  
   
 puts "<h2>RC bugs on packages with a newer version in Ubuntu (possible patches), not tagged patch nor pending</h2>"  
 puts "<table>"  
 puts "<tr><th>bug</th><th>package</th><th>source</th><th>versions (D/U)</th><th>popcon</th><th>title</th></tr>"  
   
 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)  
 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")  
 sth.execute ; rows = sth.fetch_all  
 rows.each do |r|  
    puts "<tr><td><a href=\"http://bugs.debian.org/#{r['id']}\">#{r['id']}</a></td>"  
    puts "<td>#{r['package']}</td>"  
    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>"  
    puts "<td>#{r['dversion']} / #{r['uversion']}</td>"  
    puts "<td>#{r['insts']}</td>"  
    puts "<td>#{r['title']}</td>"  
 end  
 puts "</table>"  
 sth.finish  
   
 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")  
 sth.execute ; rows = sth.fetch_all  
   
 puts "<h2>RC bugs affecting only testing (not unstable, and not pending)</h2>"  
 puts "<table>"  
 puts "<tr><th>bug</th><th>package</th><th>source</th><th>popcon</th><th>title</th></tr>"  
 rows.each do |r|  
    puts "<tr><td><a href=\"http://bugs.debian.org/#{r['id']}\">#{r['id']}</a></td>"  
    puts "<td>#{r['package']}</td>"  
    puts "<td><a href=\"http://packages.qa.debian.org/#{r['source']}\">#{r['source']}</a></td>"  
    puts "<td>#{r['insts']}</td>"  
    puts "<td>#{r['title']}</td>"  
 end  
 puts "</table>"  
 sth.finish  
304    
 =end  
305  puts "</table>"  puts "</table>"
306  sth2 = dbh.prepare("select max(start_time) from timestamps where source = 'bugs' and command = 'run'")  sth2 = dbh.prepare("select max(start_time) from timestamps where source = 'bugs' and command = 'run'")
307  sth2.execute ; r2 = sth2.fetch_all  sth2.execute ; r2 = sth2.fetch_all

Legend:
Removed from v.1813  
changed lines
  Added in v.1814

  ViewVC Help
Powered by ViewVC 1.1.5