[Collab-qa-commits] r898 - udd/src

neronus-guest at alioth.debian.org neronus-guest at alioth.debian.org
Thu Jun 26 12:38:36 UTC 2008


Author: neronus-guest
Date: 2008-06-26 12:38:35 +0000 (Thu, 26 Jun 2008)
New Revision: 898

Modified:
   udd/src/db_manager.py
   udd/src/setup-db.sql
   udd/src/sources_gatherer.py
   udd/src/test.yaml
Log:
Added popcon_average and popcon_sum views
fixed bug in sources_gatherer


Modified: udd/src/db_manager.py
===================================================================
--- udd/src/db_manager.py	2008-06-24 18:56:48 UTC (rev 897)
+++ udd/src/db_manager.py	2008-06-26 12:38:35 UTC (rev 898)
@@ -7,6 +7,7 @@
 """This scripts sets up and deletes the tables of the database"""
 
 TABLES = ('sources', 'packages', 'popcon')
+VIEWS = ('popcon_average', 'popcon_sum')
 
 def print_help():
   print "Usage: %s <config> <delete|setup>" % sys.argv[0]
@@ -14,9 +15,13 @@
 def delete(conn):
   c = conn.cursor()
 
+  for v in VIEWS:
+    c.execute("DROP VIEW " + v)
+
   for t in TABLES:
     c.execute("DROP TABLE " + t)
 
+
 def setup(conn, config):
   if 'script' not in config['setup']:
     raise aux.ConfigException('Script not specified in setup')

Modified: udd/src/setup-db.sql
===================================================================
--- udd/src/setup-db.sql	2008-06-24 18:56:48 UTC (rev 897)
+++ udd/src/setup-db.sql	2008-06-26 12:38:35 UTC (rev 898)
@@ -20,6 +20,24 @@
 CREATE TABLE popcon
   (Name text, vote int, olde int, recent int, nofiles int, UNIQUE (Name));
 
+CREATE VIEW popcon_average AS
+  SELECT sources.package, avg(vote + olde + recent + nofiles)
+    FROM sources, popcon,
+          (SELECT DISTINCT packages.name, packages.source FROM packages) as packages
+    WHERE sources.release = 'sid' AND
+          packages.source = sources.package AND
+	  popcon.name = packages.package
+    GROUP BY sources.package;
+
+CREATE VIEW popcon_sum AS
+  SELECT sources.package, sum(vote + olde + recent + nofiles)
+    FROM sources, popcon,
+         (SELECT DISTINCT packages.name, packages.source FROM packages) as packages
+    WHERE sources.release = 'sid' AND
+          packages.source = sources.package AND
+	  popcon.name = packages.package
+    GROUP BY sources.package;
+
 CREATE INDEX pkgs_name_idx ON Packages (Package);
 CREATE INDEX sources_id_idx ON sources (Package);
 CREATE INDEX pkgs_src_id_idx ON Packages USING btree (Source);
@@ -27,3 +45,6 @@
 GRANT SELECT ON Packages TO PUBLIC;
 GRANT SELECT ON sources TO PUBLIC;
 GRANT SELECT ON popcon TO PUBLIC;
+
+GRANT SELECT ON popcon_average TO PUBLIC;
+GRANT SELECT ON popcon_sum TO PUBLIC;

Modified: udd/src/sources_gatherer.py
===================================================================
--- udd/src/sources_gatherer.py	2008-06-24 18:56:48 UTC (rev 897)
+++ udd/src/sources_gatherer.py	2008-06-26 12:38:35 UTC (rev 898)
@@ -1,5 +1,5 @@
 #/usr/bin/env python
-# Last-Modified: <Sun Jun 22 20:43:14 2008>
+# Last-Modified: <Thu Jun 26 10:20:28 2008>
 
 import debian_bundle.deb822
 import gzip
@@ -122,7 +122,7 @@
 	($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16,
 	$17, $18, $19, $20, $21, $22, $23, $24, $25, $26, $27, $28, '%s', '%s',
 	'%s')"""\
-	% (src_cfg['distribution'], comp, src_cfg['release'])
+	% (src_cfg['distribution'], src_cfg['release'], comp)
       cur.execute(query)
 
       aux.print_debug("Reading file " + path)

Modified: udd/src/test.yaml
===================================================================
--- udd/src/test.yaml	2008-06-24 18:56:48 UTC (rev 897)
+++ udd/src/test.yaml	2008-06-26 12:38:35 UTC (rev 898)
@@ -7,7 +7,7 @@
     delete: python db_manager.py
     src-pkg: python srcs_and_pkgs.py
     popcon: python popcon_gatherer.py
-    # src-pkg: python sources_gatherer.py
+    #src-pkg: python sources_gatherer.py
   debug: 1
 
   archs:
@@ -26,7 +26,7 @@
         script: setup-db.sql
 
 debian-lenny:
-  type: packages
+  type: src-pkg
   archs: [alpha, amd64, arm, armel, hppa,
           i386, ia64, mips,
           mipsel, powerpc, s390, sparc]       




More information about the Collab-qa-commits mailing list