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

neronus-guest at alioth.debian.org neronus-guest at alioth.debian.org
Thu Jul 24 16:34:21 UTC 2008


Author: neronus-guest
Date: 2008-07-24 16:34:20 +0000 (Thu, 24 Jul 2008)
New Revision: 929

Modified:
   udd/src/setup-db.sql
   udd/src/test.yaml
   udd/src/udd/bugs_gatherer.pl
   udd/src/udd/popcon_gatherer.py
Log:
trivial change in popcon_gatherer.py
added source column to bugs table


Modified: udd/src/setup-db.sql
===================================================================
--- udd/src/setup-db.sql	2008-07-24 12:48:04 UTC (rev 928)
+++ udd/src/setup-db.sql	2008-07-24 16:34:20 UTC (rev 929)
@@ -25,7 +25,7 @@
   (Name text, vote int, olde int, recent int, nofiles int, distribution text, UNIQUE (Name, distribution));
 
 CREATE TABLE bugs
-  (id int, package text, arrival timestamp, status text,
+  (id int, package text, source text, arrival timestamp, status text,
      severity text, tags text, submitter text, owner text, title text,
      last_modified timestamp, affects_stable boolean,
     affects_testings boolean, affects_unstable boolean, UNIQUE (id));

Modified: udd/src/test.yaml
===================================================================
--- udd/src/test.yaml	2008-07-24 12:48:04 UTC (rev 928)
+++ udd/src/test.yaml	2008-07-24 16:34:20 UTC (rev 929)
@@ -1,5 +1,5 @@
 general:
-  dbname: udd-test
+  dbname: udd
   types:
     sources: module udd.sources_gatherer
     packages: module udd.packages_gatherer

Modified: udd/src/udd/bugs_gatherer.pl
===================================================================
--- udd/src/udd/bugs_gatherer.pl	2008-07-24 12:48:04 UTC (rev 928)
+++ udd/src/udd/bugs_gatherer.pl	2008-07-24 16:34:20 UTC (rev 929)
@@ -1,5 +1,5 @@
 #!/usr/bin/perl
-# Last-Modified: <Wed Jul 23 14:44:51 2008>
+# Last-Modified: <Thu Jul 24 13:05:26 2008>
 
 use strict;
 use warnings;
@@ -11,6 +11,7 @@
 
 use Debbugs::Bugs qw{get_bugs};
 use Debbugs::Status qw{readbug get_bug_status bug_presence};
+use Debbugs::Packages qw{binarytosource getpkgsrc};
 
 use POSIX qw{strftime};
 
@@ -36,6 +37,10 @@
 	$dbh->prepare("DELETE from bug_fixed_in")->execute();
 	$dbh->prepare("DELETE FROM bug_merged_with")->execute();
 
+	my %pkgsrcmap = %{getpkgsrc()};
+
+	my $counter = 0;
+
 	# Read all bugs
 	foreach my $bug_nr (get_bugs()) {
 		my %bug = %{get_bug_status($bug_nr)};
@@ -46,6 +51,13 @@
 		my @found_versions = map { $dbh->quote($_) } @{$bug{found_versions}};
 		my @fixed_versions = map { $dbh->quote($_) } @{$bug{fixed_versions}};
 
+		my $source = binarytosource($bug{package});
+		if(not defined $source) {
+			$source = 'NULL';
+		} else {
+			$source = $dbh->quote($source);
+		}
+
 		#Calculate bug presence in distributions
 		my $present_in_stable =
 			bug_presence(bug => $bug_nr, status => \%bug,
@@ -78,7 +90,7 @@
 		#my $bug_status = get_bug_status(bug => $bug_nr, status => \%bug);
 
 		# Insert data into bugs table
-		my $query = "INSERT INTO bugs VALUES ($bug_nr, '$bug{package}', '$date', \
+		my $query = "INSERT INTO bugs VALUES ($bug_nr, '$bug{package}', $source, '$date', \
 		             $bug{pending}, '$bug{severity}', '$bug{keywords}', $bug{originator}, $bug{owner}, \
 					 $bug{subject}, '$log_modified', $present_in_stable,
 					 $present_in_testing, $present_in_unstable)";
@@ -99,6 +111,7 @@
 			$query = "INSERT INTO bug_merged_with VALUES ($bug_nr, $mergee)";
 			$dbh->prepare($query)->execute() or die $!;
 		}
+		print "$counter\n" if ++$counter % 500 == 0;
 	}
 
 	$dbh->commit();

Modified: udd/src/udd/popcon_gatherer.py
===================================================================
--- udd/src/udd/popcon_gatherer.py	2008-07-24 12:48:04 UTC (rev 928)
+++ udd/src/udd/popcon_gatherer.py	2008-07-24 16:34:20 UTC (rev 929)
@@ -43,8 +43,9 @@
 	cur.execute("INSERT INTO popcon (name, vote, distribution) VALUES ('_submissions', %s, '%s')" % (data, my_config['distribution']))
       try:
 	(name, vote, old, recent, nofiles) = data.split()
-	cur.execute("EXECUTE pop_insert('%s', %s, %s, %s, %s)" %\
-	    (name, vote, old, recent, nofiles))
+	query = "EXECUTE pop_insert('%s', %s, %s, %s, %s)" %\
+	    (name, vote, old, recent, nofiles)
+	cur.execute(query)
       except ValueError:
 	continue
 




More information about the Collab-qa-commits mailing list