[Collab-qa-commits] r1086 - in udd: . src src/schema src/udd web/cgi-bin

neronus-guest at alioth.debian.org neronus-guest at alioth.debian.org
Tue Aug 12 15:13:02 UTC 2008


Author: neronus-guest
Date: 2008-08-12 15:13:01 +0000 (Tue, 12 Aug 2008)
New Revision: 1086

Modified:
   udd/TODO
   udd/src/schema/upload_history
   udd/src/test.yaml
   udd/src/udd/orphaned_packages_gatherer.py
   udd/src/udd/upload_history_gatherer.py
   udd/web/cgi-bin/package_bug_count.cgi
   udd/web/cgi-bin/package_rc_bug_count.cgi
   udd/web/cgi-bin/removal_candidates.cgi
Log:
web/*: Fixed web scripts
TODO: rt_affects_* tristate: won't do
      PREPARE/EXECUTE for bugs: done
      access information on wiki: done
      two new TODOs
orpahend_packages: fixed typo
upload_history: added two new fields



Modified: udd/TODO
===================================================================
--- udd/TODO	2008-08-12 11:52:04 UTC (rev 1085)
+++ udd/TODO	2008-08-12 15:13:01 UTC (rev 1086)
@@ -16,9 +16,10 @@
   update process doesn't run twice.
 - (prio: high) user documentation, on the Debian wiki.
   - what UDD is ("elevator pitch")
-  - how do I connect?
   - tables structure, in a relatively friendly format
   - some example queries
+- (prio: medium) primary key for tables which have none yet
+- (prio: medium) should we give access from alioth?
 
 packages/sources
 ----------------
@@ -31,12 +32,6 @@
 - (prio: medium) generate output using bts2ldap format, and check that the
   result matches a fresh bts2ldap run done by Lucas
 - (prio: medium) Optimize bugs importing (again)
-  + use PREPARE/EXECUTE.
-- (prio: high) Tricky problem with affects_*: some bugs (e.g #245548) were
-  filed against an experimental version, and fixed in that experimental
-  version. So the BTS doesn't know if they affect unstable or not. We mark
-  them as affecting unstable, currently. Maybe we need a tri-state found,
-  fixed, unknown.
 
 Other data sources
 ------------------

Modified: udd/src/schema/upload_history
===================================================================
--- udd/src/schema/upload_history	2008-08-12 11:52:04 UTC (rev 1085)
+++ udd/src/schema/upload_history	2008-08-12 15:13:01 UTC (rev 1086)
@@ -1,5 +1,12 @@
 CREATE TABLE %(table)s
- (package text, version text, date timestamp with time zone, changed_by text,
-  maintainer text, nmu boolean, signed_by text, key_id text);
+ (id serial, package text, version text, date timestamp with time zone,
+ changed_by text, maintainer text, nmu boolean, signed_by text, key_id text,
+ closes int);
 
+CREATE TABLE %(table)s_architecture
+ (id int, architecture text,
+ PRIMARY KEY (id, architecture));
+  
+
 GRANT SELECT ON %(table)s TO PUBLIC;
+GRANT SELECT ON %(table)s_architecture TO PUBLIC;

Modified: udd/src/test.yaml
===================================================================
--- udd/src/test.yaml	2008-08-12 11:52:04 UTC (rev 1085)
+++ udd/src/test.yaml	2008-08-12 15:13:01 UTC (rev 1086)
@@ -26,13 +26,6 @@
     netbsd-i386, hurd-powerpc, kfreebsd-powerpc, netbsd-powerpc, hurd-sparc,
     kfreebsd-sparc, netbsd-sparc, darwin-i386, freebsd-i386, openbsd-i386, darwin-powerpc]
 
-delete:
-  type: delete
-
-setup:
-        type: setup
-        script: setup-db.sql
-
 debian-lenny:
   type: src-pkg
   archs: [alpha, amd64, arm, armel, hppa,
@@ -176,7 +169,7 @@
   path: /tmp/upload-history
   schema: upload_history
   table: upload_history
-  update-command: if [ ! -e /tmp/upload-history/ ]; then mkdir /tmp/upload-history/; fi; rm -rf /tmp/upload-history/*; wget -r --no-parent -nd -A debian-devel-* -P /tmp/upload-history http://giunched.web.cs.unibo.it/nokeys/
+  update-command: if [ ! -e /tmp/upload-history/ ]; then mkdir /tmp/upload-history/; fi; rm -rf /tmp/upload-history/*; wget -r --no-parent -nd -A debian-devel-* -P /tmp/upload-history http://qa.debian.org/~filippo/ddc/
 
 bugs:
   type: bugs

Modified: udd/src/udd/orphaned_packages_gatherer.py
===================================================================
--- udd/src/udd/orphaned_packages_gatherer.py	2008-08-12 11:52:04 UTC (rev 1085)
+++ udd/src/udd/orphaned_packages_gatherer.py	2008-08-12 15:13:01 UTC (rev 1086)
@@ -44,7 +44,7 @@
     #for the new data:
     cur = self.cursor()
     cur2 = self.cursor()
-    cur.execute("SELECT id, title, arrival FROM %s WHERE package = 'wnpp' AND status != 'done' AND title ~* '^(ITA|RFA|O):' AND id NOT IN (SELECT id from %s WHERE id > merged_with)" % (self.my_config['unarchived-table'], self.my_config['unarchive-table'] + '_merged_with'))
+    cur.execute("SELECT id, title, arrival FROM %s WHERE package = 'wnpp' AND status != 'done' AND title ~* '^(ITA|RFA|O):' AND id NOT IN (SELECT id from %s WHERE id > merged_with)" % (self.my_config['unarchived-table'], self.my_config['unarchived-table'] + '_merged_with'))
     rows = cur.fetchall()
 
     cur2.execute("DELETE FROM %s" % self.my_config['table'])

Modified: udd/src/udd/upload_history_gatherer.py
===================================================================
--- udd/src/udd/upload_history_gatherer.py	2008-08-12 11:52:04 UTC (rev 1085)
+++ udd/src/udd/upload_history_gatherer.py	2008-08-12 15:13:01 UTC (rev 1086)
@@ -1,4 +1,4 @@
-# Last-Modified: <Mon Aug 11 15:55:07 2008>
+# Last-Modified: <Tue Aug 12 15:09:13 2008>
 # This file is part of the Ultimate Debian Database Project
 
 from gatherer import gatherer
@@ -17,16 +17,26 @@
     if not 'path' in self.my_config:
       raise aux.ConfigException('path not specified for source ' + source)
 
+  def drop(self):
+    cur = self.cursor()
+    cur.execute("DROP TABLE %s" % self.my_config['table'])
+    cur.execute("DROP TABLE %s" % self.my_config['table'] + '_architecture')
+
+
   def run(self):
     path = self.my_config['path']
 
     cursor = self.cursor()
 
     cursor.execute("DELETE FROM " + self.my_config['table'])
+    cursor.execute("DELETE FROM " + self.my_config['table'] + '_architecture')
 
     cursor.execute("PREPARE uh_insert AS INSERT INTO %s VALUES \
-	($1, $2, $3, $4, $5, $6, $7, $8)" % self.my_config['table'])
+	($1, $2, $3, $4, $5, $6, $7, $8, $9)" % self.my_config['table'])
+    cursor.execute("PREPARE uh_arch_insert AS INSERT INTO %s VALUES \
+	($1, $2)" % (self.my_config['table'] + '_architecture'))
 
+    id = 0
     for name in glob(path + '/debian-devel-*'):
       print name
       f = None
@@ -35,7 +45,7 @@
       else:
 	f = open(name)
       
-      current = {}
+      current = {'id': id}
       last_field = None
       line_count = 0
       for line in f:
@@ -43,14 +53,19 @@
 	line = line.strip()
 	# Stupid multi-line maintainer fields *grml*
 	if line == '':
-	  query = "EXECUTE uh_insert(%(Source)s, %(Version)s, %(Date)s, %(Changed-By)s, \
+	  for arch in set(current['Architecture'].split()):
+	    current['arch'] = arch
+	    query = "EXECUTE uh_arch_insert(%(id)s, %(arch)s)"
+	    cursor.execute(query, current)
+	  query = "EXECUTE uh_insert(%(id)s, %(Source)s, %(Version)s, %(Date)s, %(Changed-By)s, \
 	      %(Maintainer)s, %(NMU)s, %(Key)s, %(Signed-By)s)"
 	  try:
 	    cursor.execute(query, current)
 	  except psycopg2.ProgrammingError, s:
 	    print "Error at line %d of file %s" % (line_count, name)
 	    raise
-	  current = {}
+	  id += 1
+	  current = {'id': id}
 	  last_field = None
 	  continue
 

Modified: udd/web/cgi-bin/package_bug_count.cgi
===================================================================
--- udd/web/cgi-bin/package_bug_count.cgi	2008-08-12 11:52:04 UTC (rev 1085)
+++ udd/web/cgi-bin/package_bug_count.cgi	2008-08-12 15:13:01 UTC (rev 1086)
@@ -8,10 +8,10 @@
 
 my $dbh = DBI->connect("dbi:Pg:dbname=udd") or die $!;
 my $sth = $dbh->prepare(<<EOF
-	SELECT package, COUNT(id) AS nr FROM bugs_unarchived as bugs
+	SELECT package, COUNT(id) AS nr FROM bugs
 	WHERE
 		NOT (affects_stable OR affects_testing OR affects_unstable)
-		AND NOT EXISTS (SELECT 1 FROM bug_tags WHERE bug_tags.id = bugs.id AND bug_tags.tag = 'fixed')
+		AND NOT EXISTS (SELECT 1 FROM bugs_tags WHERE bugs_tags.id = bugs.id AND bugs_tags.tag = 'fixed')
 	GROUP BY package ORDER BY nr DESC
 EOF
 	);

Modified: udd/web/cgi-bin/package_rc_bug_count.cgi
===================================================================
--- udd/web/cgi-bin/package_rc_bug_count.cgi	2008-08-12 11:52:04 UTC (rev 1085)
+++ udd/web/cgi-bin/package_rc_bug_count.cgi	2008-08-12 15:13:01 UTC (rev 1086)
@@ -9,17 +9,17 @@
 my $dbh = DBI->connect("dbi:Pg:dbname=udd") or die $!;
 my $sth = $dbh->prepare(<<EOF
 SELECT b.package, COUNT(b.id)
-FROM bugs_unarchived b
+FROM bugs b
 WHERE 
         (b.severity IN ('serious', 'grave', 'critical'))
     AND 
         b.affects_testing
     AND(
-            NOT EXISTS (SELECT tag FROM bug_tags t WHERE b.id=t.id AND t.tag IN ('sid', 'sarge', 'etch', 'experimental'))
+            NOT EXISTS (SELECT tag FROM bugs_tags t WHERE b.id=t.id AND t.tag IN ('sid', 'sarge', 'etch', 'experimental'))
         OR
-                EXISTS (SELECT tag FROM bug_tags t WHERE b.id=t.id AND t.tag = 'lenny')
+                EXISTS (SELECT tag FROM bugs_tags t WHERE b.id=t.id AND t.tag = 'lenny')
     )
-    AND NOT EXISTS (SELECT tag FROM bug_tags t WHERE b.id=t.id AND t.tag = 'lenny-ignore')
+    AND NOT EXISTS (SELECT tag FROM bugs_tags t WHERE b.id=t.id AND t.tag = 'lenny-ignore')
     AND(
             EXISTS (SELECT package FROM packages p WHERE p.package = b.package AND p.distribution = 'debian' AND p.release = 'lenny')
         OR

Modified: udd/web/cgi-bin/removal_candidates.cgi
===================================================================
--- udd/web/cgi-bin/removal_candidates.cgi	2008-08-12 11:52:04 UTC (rev 1085)
+++ udd/web/cgi-bin/removal_candidates.cgi	2008-08-12 15:13:01 UTC (rev 1086)
@@ -8,7 +8,7 @@
 
 my $s = <<EOF
 select sources.source, id, insts, arrival, last_modified, title
-from sources, bugs AS bugs, popcon_src
+from sources, bugs, popcon_src
 where sources.distribution = 'debian' and sources.release = 'lenny'
 and bugs.source = sources.source
 and id in (select id from bugs_rt_affects_testing)




More information about the Collab-qa-commits mailing list