/[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

udd/web/cgi-bin/bugs.cgi revision 1789 by lucas, Tue Sep 14 20:26:47 2010 UTC udd/web/bugs.cgi revision 1822 by lucas, Tue Oct 12 09:11:00 2010 UTC
# Line 14  RELEASE_RESTRICT = [ Line 14  RELEASE_RESTRICT = [
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)'],    ['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)'],    ['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)'],    ['lenny', 'lenny', 'id in (select id from bugs_rt_affects_stable)'],
17      ['any', 'any', 'id in (select id from bugs where status!=\'done\')'],
18  ]  ]
19    
20  FILTERS = [  FILTERS = [
# Line 24  FILTERS = [ Line 25  FILTERS = [
25   ['notsqueeze', 'packages not in squeeze', 'id not in (select id from bugs_packages, sources where bugs_packages.source = sources.source and release=\'squeeze\')'],   ['notsqueeze', 'packages not in squeeze', 'id not in (select id from bugs_packages, sources where bugs_packages.source = sources.source and release=\'squeeze\')'],
26   ['merged', 'merged bugs', 'id in (select id from bugs_merged_with where id > merged_with)'],   ['merged', 'merged bugs', 'id in (select id from bugs_merged_with where id > merged_with)'],
27   ['done', 'marked as done', 'status = \'done\''],   ['done', 'marked as done', 'status = \'done\''],
28   ['outdatedsqueeze', 'outdated binaries in squeeze', "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)"],   ['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)"],
29   ['outdatedsid', 'outdated binaries in sid', "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)"],   ['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)"],
30     ['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)"],
31     ['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)"],
32  ]  ]
33    
34  TYPES = [  TYPES = [
# Line 34  TYPES = [ Line 37  TYPES = [
37    ['lfs', 'release goal: Large File Support', 'id in (select id from bugs_tags where tag=\'lfs\')', false ],    ['lfs', 'release goal: Large File Support', 'id in (select id from bugs_tags where tag=\'lfs\')', false ],
38    ['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],    ['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],
39    ['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],    ['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],
40      ['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'"],
41  ]  ]
42    
43  SORTS = [  SORTS = [
44    ['id', 'bug#'],    ['id', 'bug#'],
45    ['source', 'source package'],    ['source', 'source package'],
46    ['package', 'binary package'],    ['package', 'binary package'],
47    ['last_modified', 'last modified']    ['last_modified', 'last modified'],
48      ['severity', 'severity'],
49      ['popcon', 'popularity contest'],
50    ]
51    
52    COLUMNS = [
53      ['cpopcon', 'popularity contest'],
54      ['chints', 'release team hints'],
55      ['cseverity', 'severity'],
56  ]  ]
57    
58  cgi = CGI::new  cgi = CGI::new
# Line 50  if RELEASE_RESTRICT.map { |r| r[0] }.inc Line 62  if RELEASE_RESTRICT.map { |r| r[0] }.inc
62  else  else
63    release = 'squeeze'    release = 'squeeze'
64  end  end
65    # columns
66    cols = {}
67    COLUMNS.map { |r| r[0] }.each do |r|
68      if cgi.params[r][0]
69        cols[r] = true
70      else
71        cols[r] = false
72      end
73    end
74  # sorts  # sorts
75  if SORTS.map { |r| r[0] }.include?(cgi.params['sortby'][0])  if SORTS.map { |r| r[0] }.include?(cgi.params['sortby'][0])
76    sortby = cgi.params['sortby'][0]    sortby = cgi.params['sortby'][0]
# Line 61  if ['asc', 'desc'].include?(cgi.params[' Line 82  if ['asc', 'desc'].include?(cgi.params['
82  else  else
83    sorto = 'asc'    sorto = 'asc'
84  end  end
85    # hack to enable popcon column if sortby = popcon
86    cols['cpopcon'] = true if sortby == 'popcon'
87    cols['cseverity'] = true if sortby == 'severity'
88  # filters  # filters
89  filters = {}  filters = {}
90  FILTERS.map { |r| r[0] }.each do |e|  FILTERS.map { |r| r[0] }.each do |e|
# Line 156  FILTERS.each do |r| Line 180  FILTERS.each do |r|
180    <tr>    <tr>
181    <td style='text-align: center;'><input type='radio' name='#{r[0]}' value='' #{filters[r[0]]==''?'CHECKED=\'1\'':''}/></td>    <td style='text-align: center;'><input type='radio' name='#{r[0]}' value='' #{filters[r[0]]==''?'CHECKED=\'1\'':''}/></td>
182    <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>
183    <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>
184    <td>#{r[1]}</td>    <td>#{r[1]}</td>
185    </tr>    </tr>
186    EOF    EOF
# Line 166  puts <<-EOF Line 190  puts <<-EOF
190    <tr>    <tr>
191    <td style='text-align: center;'><input type='radio' name='fnewer' value='' #{fnewer==''?'CHECKED=\'1\'':''}/></td>    <td style='text-align: center;'><input type='radio' name='fnewer' value='' #{fnewer==''?'CHECKED=\'1\'':''}/></td>
192    <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='only' #{fnewer=='only'?'CHECKED=\'1\'':''}/></td>
193    <td style='text-align: center;'><input type='radio' name='fnewer' value='ign' #{fnewer=='ign'?'CHECKED=\'1\'':''}'/></td>    <td style='text-align: center;'><input type='radio' name='fnewer' value='ign' #{fnewer=='ign'?'CHECKED=\'1\'':''}/></td>
194    <td>newer than <input type='text' size='3' name='fnewerval' value='#{fnewerval}'/> days</td>    <td>newer than <input type='text' size='3' name='fnewerval' value='#{fnewerval}'/> days</td>
195    </tr>    </tr>
196  EOF  EOF
# Line 187  puts "<b> -- </b>" Line 211  puts "<b> -- </b>"
211    checked = (sorto == r[0] ? 'CHECKED=\'1\'':'')    checked = (sorto == r[0] ? 'CHECKED=\'1\'':'')
212    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;"
213  end  end
214    puts "<br/>\n<b>Additional columns:</b> "
215    COLUMNS.each do |r|
216      checked = cols[r[0]] ? 'checked':''
217      puts "<input type='checkbox' name='#{r[0]}' value='1' #{checked}/>#{r[1]}&nbsp;&nbsp;"
218    end
219  puts <<-EOF  puts <<-EOF
220  </p><input type='submit' value='Search'/>  <br/>\n<input type='submit' value='Search'/></p>
221  </form>  </form>
222  EOF  EOF
223  if cgi.params != {}  if cgi.params != {}
# Line 196  if cgi.params != {} Line 225  if cgi.params != {}
225  # Generate and execute query  # Generate and execute query
226  tstart = Time::now  tstart = Time::now
227  dbh = DBI::connect('DBI:Pg:dbname=udd;port=5441;host=localhost', 'guest')  dbh = DBI::connect('DBI:Pg:dbname=udd;port=5441;host=localhost', 'guest')
228  q = "select id, bugs.package, bugs.source, title, last_modified from bugs \n"  if cols['cpopcon']
229      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"
230    else
231      q = "select id, bugs.package, bugs.source, severity, title, last_modified from bugs \n"
232    end
233  q += "where #{RELEASE_RESTRICT.select { |r| r[0] == release }[0][2]} \n"  q += "where #{RELEASE_RESTRICT.select { |r| r[0] == release }[0][2]} \n"
234  FILTERS.each do |f|  FILTERS.each do |f|
235    if filters[f[0]] == 'only'    if filters[f[0]] == 'only'
# Line 218  else Line 251  else
251    q += "AND FALSE\n"    q += "AND FALSE\n"
252  end  end
253  q += "order by #{sortby} #{sorto}"  q += "order by #{sortby} #{sorto}"
254  sth = dbh.prepare(q)  begin
255  sth.execute    sth = dbh.prepare(q)
256  rows = sth.fetch_all    sth.execute
257      rows = sth.fetch_all
258    rescue DBI::ProgrammingError => e
259      puts "<p>The query generated an error, please report it to lucas@debian.org: #{e.message}</p>"
260      puts "<pre>#{q}</pre>"
261      exit(0)
262    end
263    
264    if cols['chints']
265      sthh = dbh.prepare("select distinct source, type, argument, version, file, comment from relevant_hints order by type")
266      sthh.execute
267      rowsh = sthh.fetch_all
268      hints = {}
269      rowsh.each do |r|
270        hints[r['source']] ||= []
271        hints[r['source']] << r
272      end
273    end
274    
275  puts "<p><b>#{rows.length} bugs found.</b></p>"  puts "<p><b>#{rows.length} bugs found.</b></p>"
276  puts <<-EOF  puts '<table class="buglist">'
277  <table class="buglist">  puts '<tr><th>bug#</th><th>package</th><th>title</th>'
278  <tr><th>bug#</th><th>package</th><th>title</th><th>last&nbsp;modified</th></tr>  puts '<th>popcon</th>' if cols['cpopcon']
279  EOF  puts '<th>severity</th>' if cols['cseverity']
280    if cols['chints']
281      puts '<th>hints</th>'
282    end
283    puts '<th>last&nbsp;modified</th></tr>'
284    
285    def genhints(source, hints)
286      return '' if hints.nil?
287      s = ''
288      hints.each do |h|
289        v = h['version'] ? h['version'] + ' ' : ''
290        t = h['type'] == 'age-days' ? "age/#{h['argument']}" : h['type']
291        s += "<a href=\"http://release.debian.org/britney/hints/#{h['file']}\" title=\"#{v}#{h['file']} #{h['comment']}\">#{t}</a> "
292      end
293      s
294    end
295    
296  rows.each do |r|  rows.each do |r|
297    puts "<tr><td style='text-align: center;'><a href=\"http://bugs.debian.org/#{r['id']}\">##{r['id']}</a></td>"    puts "<tr><td style='text-align: center;'><a href=\"http://bugs.debian.org/#{r['id']}\">##{r['id']}</a></td>"
298    puts "<td style='text-align: center;'>"    puts "<td style='text-align: center;'>"
# Line 234  rows.each do |r| Line 300  rows.each do |r|
300    bins = r['package'].split(/,\s*/)    bins = r['package'].split(/,\s*/)
301    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(', ')
302    puts "</td>"    puts "</td>"
303    puts <<-EOF    puts "<td>#{CGI::escapeHTML(r['title'])}</td>"
304    <td>#{CGI::escapeHTML(r['title'])}</td>    puts "<td>#{r['popcon']}</td>" if cols['cpopcon']
305    <td style='text-align: center;'>#{r['last_modified'].to_date}</td>    puts "<td>#{r['severity']}</td>" if cols['cseverity']
306    </tr>    puts "<td>#{genhints(r['source'], hints[r['source']])}</td>" if cols['chints']
307    EOF    puts "<td style='text-align: center;'>#{r['last_modified'].to_date}</td></tr>"
308  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  
309    
 =end  
310  puts "</table>"  puts "</table>"
311  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'")
312  sth2.execute ; r2 = sth2.fetch_all  sth2.execute ; r2 = sth2.fetch_all
# Line 318  end # if cgi.params != {} Line 317  end # if cgi.params != {}
317  puts <<-EOF  puts <<-EOF
318  </div>  </div>
319  <div class="footer">  <div class="footer">
320  <small>Suggestions / comments / patches to lucas@debian.org. <a href="http://svn.debian.org/wsvn/collab-qa/udd/web/cgi-bin/bugs.cgi">source code</a>.</small>  <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>
321  </div>  </div>
322  </body>  </body>
323  </html>  </html>

Legend:
Removed from v.1789  
changed lines
  Added in v.1822

  ViewVC Help
Powered by ViewVC 1.1.5