[Collab-qa-commits] r957 - in udd/src: . udd

neronus-guest at alioth.debian.org neronus-guest at alioth.debian.org
Mon Jul 28 14:50:29 UTC 2008


Author: neronus-guest
Date: 2008-07-28 14:50:28 +0000 (Mon, 28 Jul 2008)
New Revision: 957

Modified:
   udd/src/setup-db.sql
   udd/src/udd/popcon_gatherer.py
Log:
Added insts column to popcon table


Modified: udd/src/setup-db.sql
===================================================================
--- udd/src/setup-db.sql	2008-07-28 14:40:31 UTC (rev 956)
+++ udd/src/setup-db.sql	2008-07-28 14:50:28 UTC (rev 957)
@@ -22,7 +22,7 @@
   UNIQUE (package));
 
 CREATE TABLE popcon
-  (Name text, vote int, olde int, recent int, nofiles int, distribution text, UNIQUE (Name, distribution));
+  (Name text, insts int, vote int, olde int, recent int, nofiles int, distribution text, UNIQUE (Name, distribution));
 
 CREATE TABLE bugs
   (id int, package text, source text, arrival timestamp, status text,

Modified: udd/src/udd/popcon_gatherer.py
===================================================================
--- udd/src/udd/popcon_gatherer.py	2008-07-28 14:40:31 UTC (rev 956)
+++ udd/src/udd/popcon_gatherer.py	2008-07-28 14:50:28 UTC (rev 957)
@@ -32,7 +32,7 @@
 
     cur = self.cursor()
 
-    cur.execute("PREPARE pop_insert AS INSERT INTO popcon (name, vote, olde, recent, nofiles, distribution) VALUES ($1, $2, $3, $4, $5, '%s')" % my_config['distribution'])
+    cur.execute("PREPARE pop_insert AS INSERT INTO popcon (name, insts, vote, olde, recent, nofiles, distribution) VALUES ($1, $2, $3, $4, $5, $6, '%s')" % my_config['distribution'])
 
     popcon = gzip.open(my_config['path'])
 
@@ -50,10 +50,11 @@
       try:
 	(name, vote, old, recent, nofiles) = data.split()
 	if ascii_match.match(name) == None:
-	  print name
-	continue
-	query = "EXECUTE pop_insert('%s', %s, %s, %s, %s)" %\
-	    (name, vote, old, recent, nofiles)
+	  print "Skipping line %d of file %s as it contains illegal characters: %s" % (linenr, my_config['path'], line)
+	  continue
+	query = "EXECUTE pop_insert('%s', %s, %s, %s, %s, %s)" %\
+	    (name, int(vote) + int(old) + int(recent) + int(nofiles), vote, old, recent, nofiles)
+	print query
 	cur.execute(query)
       except ValueError:
 	continue




More information about the Collab-qa-commits mailing list