/[collab-qa]/udd/web/cgi-bin/merges.json.cgi
ViewVC logotype

Contents of /udd/web/cgi-bin/merges.json.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2051 - (show annotations) (download)
Mon Oct 17 07:51:31 2011 UTC (19 months, 1 week ago) by lucas
File size: 1842 byte(s)
ubuntu oneiric released
1 #!/usr/bin/ruby -w
2
3 require 'dbi'
4 require 'pp'
5 require 'uri'
6 require 'net/http'
7 require 'json/pure'
8
9 URELEASE='precise'
10
11 puts "Content-type: application/json\n\n"
12
13 DREL='sid'
14 UREL='precise'
15
16 dbh = DBI::connect('DBI:Pg:dbname=udd;port=5441;host=localhost', 'guest')
17
18 # Fetching blacklist
19 blacklist = Net::HTTP.get(URI::parse('http://people.canonical.com/~ubuntu-archive/sync-blacklist.txt')).split(/\n/)
20 bpkgs = []
21 blacklist.each do |l|
22 l.gsub!(/#.*/, '')
23 l.strip!
24 next if l == ''
25 bpkgs << l
26 end
27 sbpkgs = "'" + bpkgs.uniq.join("','") + "'"
28
29 sth = dbh.prepare("select ubu.component, deb.source, deb.version as dversion, ubu.version as uversion
30 from sources_uniq deb, ubuntu_sources ubu
31 where deb.distribution='debian' and deb.release='#{DREL}'
32 and ubu.distribution='ubuntu' and ubu.release='#{UREL}'
33 and deb.source = ubu.source and deb.version > ubu.version
34 and deb.source not in (#{sbpkgs})
35 and ubu.version !~ '[0-9]build[0-9]'
36 and ubu.version ~ 'ubuntu'
37 order by component, source")
38 sth.execute ; rows = sth.fetch_all
39
40 sth2 = dbh.prepare("select distinct package, b.bug, title, status
41 from ubuntu_bugs b, ubuntu_bugs_tasks bt
42 where b.bug = bt.bug
43 and title ~ '^((P|p)lease )?((M|m)erge|(S|s)ync) .* from Debian'
44 and status not in ('Invalid', 'Fix Released', 'Won''t Fix', 'Opinion')
45 and distro != 'Debian'")
46 sth2.execute ; rowsb = sth2.fetch_all
47
48 bugs = {}
49 rowsb.each do |r|
50 src = r['package']
51 bugs[src] = [] if bugs[src].nil?
52 bugs[src] << {'bug' => r['bug'], 'status' => r['status'], 'title' => r['title']}
53 end
54
55 merges = {}
56 merges['main'] = {}
57 merges['restricted'] = {}
58 merges['universe'] = {}
59 merges['multiverse'] = {}
60
61 rows.each do |r|
62 merges[r['component']][r['source']] = { 'debian_version' => r['dversion'], 'ubuntu_version' => r['uversion'], 'bugs' => (bugs[r['source']] or []) }
63 end
64 puts merges.to_json
65 sth.finish

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.5