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

Lucas Nussbaum lucas at alioth.debian.org
Mon Jul 13 21:23:09 UTC 2009


Author: lucas
Date: 2009-07-13 21:23:08 +0000 (Mon, 13 Jul 2009)
New Revision: 1510

Added:
   udd/web/cgi-bin/nmu_stats.cgi
   udd/web/cgi-bin/ubuntu_stats.cgi
   udd/web/cgi-bin/ubuntu_wrong_version.cgi
Modified:
   udd/web/cgi-bin/sources_in_ubuntu_but_not_in_debian_by_popcon.cgi
Log:
better and new cgi example scripts

Added: udd/web/cgi-bin/nmu_stats.cgi
===================================================================
--- udd/web/cgi-bin/nmu_stats.cgi	                        (rev 0)
+++ udd/web/cgi-bin/nmu_stats.cgi	2009-07-13 21:23:08 UTC (rev 1510)
@@ -0,0 +1,41 @@
+#!/usr/bin/ruby -w
+
+require 'dbi'
+require 'pp'
+
+puts "Content-type: text/html\n\n"
+
+dbh = DBI::connect('DBI:Pg:dbname=udd;port=5441;host=localhost', 'guest')
+sth = dbh.prepare("select changed_by, count(*) cnt from
+upload_history uh, sources s
+where s.distribution='debian' and s.release='sid'
+and s.source = uh.package and s.version = uh.version
+and uh.nmu
+and uh.date > current_timestamp - interval '2 months'
+group by changed_by having count(*) >= 2 order by cnt desc")
+sth.execute ; rows = sth.fetch_all
+
+puts "<h1>People having done more than 2 NMUs over the last 2 months (only uploads still in the archive)</h1>"
+puts "<table>"
+rows.each do |r|
+puts "<tr><td>#{r[0].gsub('<','&lt;').gsub('>','&gt;')}</td><td>#{r[1]}</td></tr>"
+end
+puts "</table>"
+
+
+sth = dbh.prepare("select changed_by, count(*) cnt from
+upload_history uh, sources s
+where s.distribution='debian' and s.release='sid'
+and s.source = uh.package and s.version = uh.version
+and uh.nmu
+group by changed_by order by cnt desc")
+sth.execute ; rows = sth.fetch_all
+
+puts "<h1>NMUs uploaded currently in the archive</h1>"
+puts "<table>"
+rows.each do |r|
+puts "<tr><td>#{r[0].gsub('<','&lt;').gsub('>','&gt;')}</td><td>#{r[1]}</td></tr>"
+end
+puts "</table>"
+
+sth.finish


Property changes on: udd/web/cgi-bin/nmu_stats.cgi
___________________________________________________________________
Added: svn:executable
   + *

Modified: udd/web/cgi-bin/sources_in_ubuntu_but_not_in_debian_by_popcon.cgi
===================================================================
--- udd/web/cgi-bin/sources_in_ubuntu_but_not_in_debian_by_popcon.cgi	2009-07-10 22:17:43 UTC (rev 1509)
+++ udd/web/cgi-bin/sources_in_ubuntu_but_not_in_debian_by_popcon.cgi	2009-07-13 21:23:08 UTC (rev 1510)
@@ -8,24 +8,31 @@
 
 my $dbh = DBI->connect("dbi:Pg:dbname=udd;port=5441;host=localhost", "guest") or die $!;
 my $sth = $dbh->prepare(<<EOF
-	SELECT DISTINCT intrepid.source, insts
+	SELECT DISTINCT ubu.source, insts
         FROM (SELECT DISTINCT source FROM ubuntu_sources
-                WHERE release = 'intrepid')
-          AS intrepid,
+                WHERE release = 'karmic')
+          AS ubu,
              ubuntu_popcon_src
         WHERE NOT EXISTS (SELECT * FROM sources WHERE distribution = 'debian'
-                          and source = intrepid.source)
-              AND ubuntu_popcon_src.source = intrepid.source ORDER BY insts DESC;
+                          and source = ubu.source)
+              AND ubuntu_popcon_src.source = ubu.source
+              AND ubu.source !~ '^language-(support|pack)-.*'
+              AND ubu.source !~ '^kde-l10n-.*'
+              AND ubu.source !~ 'ubuntu'
+              AND ubu.source !~ 'launchpad'
+         ORDER BY insts DESC;
 EOF
 	);
 
 $sth->execute() or die $!;
 
 my $q = CGI->new();
-
+my $n = 0;
 print $q->header(-type => 'text/plain');
 while(my @row = $sth->fetchrow_array) {
 	my ($package, $score) = @row;
 	print "$package\t$score\n";
+	$n++;
 }
+print "\n\n# Packages: $n\n";
 

Added: udd/web/cgi-bin/ubuntu_stats.cgi
===================================================================
--- udd/web/cgi-bin/ubuntu_stats.cgi	                        (rev 0)
+++ udd/web/cgi-bin/ubuntu_stats.cgi	2009-07-13 21:23:08 UTC (rev 1510)
@@ -0,0 +1,155 @@
+#!/usr/bin/ruby -w
+
+require 'dbi'
+require 'pp'
+RELEASE='jaunty'
+
+puts "Content-type: text/plain\n\n"
+
+dbh = DBI::connect('DBI:Pg:dbname=udd;port=5441;host=localhost', 'guest')
+sth = dbh.prepare("select count(*) from ubuntu_sources where distribution = 'ubuntu' and release = '#{RELEASE}'")
+sth.execute ; rows = sth.fetch_all
+allpkgs = rows[0][0]
+puts "Source packages in Ubuntu: #{allpkgs}"
+
+sth = dbh.prepare("select count(*) from sources where distribution = 'debian' and release = 'sid'")
+sth.execute ; rows = sth.fetch_all
+allpkgs = rows[0][0]
+puts "Source packages in Debian: #{allpkgs}"
+
+sth = dbh.prepare("select count(*) from sources where distribution = 'debian' and release = 'lenny'")
+sth.execute ; rows = sth.fetch_all
+allpkgs = rows[0][0]
+puts "Source packages in Debian lenny: #{allpkgs}"
+sth = dbh.prepare("select component, count(*) from ubuntu_sources where distribution = 'ubuntu' and release = '#{RELEASE}'
+ group by component")
+sth.execute ; rows = sth.fetch_all
+pp rows
+
+puts "Not Ubuntu specific:"
+sth = dbh.prepare("select component, count(*) from ubuntu_sources where distribution = 'ubuntu' and release = '#{RELEASE}'
+AND source !~ '^language-(support|pack)-.*'
+AND source !~ '^kde-l10n-.*'
+AND source !~ 'ubuntu'
+AND source !~ 'launchpad'
+ group by component")
+sth.execute ; rows = sth.fetch_all
+pp rows
+
+puts "Not Ubuntu specific, not in debian:"
+sth = dbh.prepare("select component, count(*) from ubuntu_sources where distribution = 'ubuntu' and release = '#{RELEASE}'
+AND source !~ '^language-(support|pack)-.*'
+AND source !~ '^kde-l10n-.*'
+AND source !~ 'ubuntu'
+AND source !~ 'launchpad'
+AND source not in (select source from sources where distribution='debian' and release in ('sid', 'lenny'))
+ group by component")
+sth.execute ; rows = sth.fetch_all
+pp rows
+
+puts "Not Ubuntu specific, not in debian, version !~ /ubuntu/ (FAIL!):"
+sth = dbh.prepare("select component, count(*) from ubuntu_sources where distribution = 'ubuntu' and release = '#{RELEASE}'
+AND source !~ '^language-(support|pack)-.*' AND source !~ '^kde-l10n-.*' AND source !~ 'ubuntu' AND source !~ 'launchpad'
+AND source not in (select source from sources where distribution='debian' and release in ('sid', 'lenny'))
+AND version !~ 'ubuntu'
+ group by component")
+sth.execute ; rows = sth.fetch_all
+pp rows
+
+puts "Also in Debian:"
+sth = dbh.prepare("select component, count(*) from ubuntu_sources where distribution = 'ubuntu' and release = '#{RELEASE}'
+AND source !~ '^language-(support|pack)-.*' AND source !~ '^kde-l10n-.*' AND source !~ 'ubuntu' AND source !~ 'launchpad'
+AND source in (select source from sources where distribution='debian' and release in ('sid', 'lenny'))
+ group by component")
+sth.execute ; rows = sth.fetch_all
+pp rows
+
+puts "Also in Debian, not diverged (version !~ /ubuntu/):"
+sth = dbh.prepare("select component, count(*) from ubuntu_sources where distribution = 'ubuntu' and release = '#{RELEASE}'
+AND source !~ '^language-(support|pack)-.*' AND source !~ '^kde-l10n-.*' AND source !~ 'ubuntu' AND source !~ 'launchpad'
+AND source in (select source from sources where distribution='debian' and release in ('sid', 'lenny'))
+AND version !~ 'ubuntu'
+ group by component")
+sth.execute ; rows = sth.fetch_all
+pp rows
+
+
+puts "Also in Debian, diverged (version ~ /ubuntu/):"
+sth = dbh.prepare("select component, count(*) from ubuntu_sources where distribution = 'ubuntu' and release = '#{RELEASE}'
+AND source !~ '^language-(support|pack)-.*' AND source !~ '^kde-l10n-.*' AND source !~ 'ubuntu' AND source !~ 'launchpad'
+AND source in (select source from sources where distribution='debian' and release in ('sid', 'lenny'))
+AND version ~ 'ubuntu'
+ group by component")
+sth.execute ; rows = sth.fetch_all
+pp rows
+
+puts "Also in Debian, diverged + new upstream (version ~ /-0ubuntu/):"
+sth = dbh.prepare("select component, count(*) from ubuntu_sources where distribution = 'ubuntu' and release = '#{RELEASE}'
+AND source !~ '^language-(support|pack)-.*' AND source !~ '^kde-l10n-.*' AND source !~ 'ubuntu' AND source !~ 'launchpad'
+AND source in (select source from sources where distribution='debian' and release in ('sid', 'lenny'))
+AND version ~ '-0ubuntu'
+ group by component")
+sth.execute ; rows = sth.fetch_all
+pp rows
+
+puts "diverged+new upstream (main):"
+sth = dbh.prepare("select source from ubuntu_sources where distribution = 'ubuntu' and release = '#{RELEASE}' and component = 'main'
+AND source !~ '^language-(support|pack)-.*' AND source !~ '^kde-l10n-.*' AND source !~ 'ubuntu' AND source !~ 'launchpad'
+AND source in (select source from sources where distribution='debian' and release in ('sid', 'lenny'))
+AND version ~ '-0ubuntu' order by source")
+sth.execute ; rows = sth.fetch_all
+rows.each do |r|
+  print  r[0] + ' '
+end
+puts
+puts
+
+puts "diverged+new upstream (universe):"
+sth = dbh.prepare("select source from ubuntu_sources where distribution = 'ubuntu' and release = '#{RELEASE}' and component = 'universe'
+AND source !~ '^language-(support|pack)-.*' AND source !~ '^kde-l10n-.*' AND source !~ 'ubuntu' AND source !~ 'launchpad'
+AND source in (select source from sources where distribution='debian' and release in ('sid', 'lenny'))
+AND version ~ '-0ubuntu' order by source")
+sth.execute ; rows = sth.fetch_all
+rows.each do |r|
+  print  r[0] + ' '
+end
+puts
+
+puts "diverged+new upstream, newer than in squeeze (main):"
+sth = dbh.prepare("select u.source, u.version, d.version from ubuntu_sources u, sources d
+where u.distribution = 'ubuntu' and u.release = '#{RELEASE}' and u.component = 'main'
+and d.distribution = 'debian' and d.release = 'squeeze'
+AND u.source !~ '^language-(support|pack)-.*' AND u.source !~ '^kde-l10n-.*' AND u.source !~ 'ubuntu' AND u.source !~ 'launchpad'
+AND u.source in (select source from sources where distribution='debian' and release in ('sid', 'lenny'))
+AND u.version ~ '-0ubuntu'
+AND u.source = d.source
+AND u.version > d.version
+order by source")
+sth.execute ; rows = sth.fetch_all
+rows.each do |r|
+  print  r[0] + ' '
+end
+puts
+puts
+
+puts "diverged+new upstream, newer than in squeeze (universe):"
+sth = dbh.prepare("select u.source, u.version, d.version from ubuntu_sources u, sources d
+where u.distribution = 'ubuntu' and u.release = '#{RELEASE}' and u.component = 'universe'
+and d.distribution = 'debian' and d.release = 'squeeze'
+AND u.source !~ '^language-(support|pack)-.*' AND u.source !~ '^kde-l10n-.*' AND u.source !~ 'ubuntu' AND u.source !~ 'launchpad'
+AND u.source in (select source from sources where distribution='debian' and release in ('sid', 'lenny'))
+AND u.version ~ '-0ubuntu'
+AND u.source = d.source
+AND u.version > d.version
+order by source")
+sth.execute ; rows = sth.fetch_all
+rows.each do |r|
+  print  r[0] + ' '
+end
+puts
+puts
+
+
+
+
+sth.finish


Property changes on: udd/web/cgi-bin/ubuntu_stats.cgi
___________________________________________________________________
Added: svn:executable
   + *

Added: udd/web/cgi-bin/ubuntu_wrong_version.cgi
===================================================================
--- udd/web/cgi-bin/ubuntu_wrong_version.cgi	                        (rev 0)
+++ udd/web/cgi-bin/ubuntu_wrong_version.cgi	2009-07-13 21:23:08 UTC (rev 1510)
@@ -0,0 +1,16 @@
+#!/usr/bin/ruby -w
+
+require 'dbi'
+require 'pp'
+RELEASE='karmic'
+
+puts "Content-type: text/plain\n\n"
+
+dbh = DBI::connect('DBI:Pg:dbname=udd;port=5441;host=localhost', 'guest')
+s = "select source, version, component from ubuntu_sources where distribution = 'ubuntu' and release = '#{RELEASE}' AND source not in (select source from sources where distribution='debian' and release in ('sid', 'squeeze', 'lenny')) AND version !~ 'ubuntu' and version ~ '-' order by component, source"
+sth = dbh.prepare(s)
+sth.execute ; rows = sth.fetch_all
+puts "# #{s}"
+rows.each do |r|
+  puts "#{r.join(' ')}"
+end


Property changes on: udd/web/cgi-bin/ubuntu_wrong_version.cgi
___________________________________________________________________
Added: svn:executable
   + *




More information about the Collab-qa-commits mailing list