[Collab-qa-commits] r1539 - in udd: . sql udd
Lucas Nussbaum
lucas at alioth.debian.org
Fri Jul 24 14:40:24 UTC 2009
Author: lucas
Date: 2009-07-24 14:40:23 +0000 (Fri, 24 Jul 2009)
New Revision: 1539
Modified:
udd/config-org.yaml
udd/sql/setup.sql
udd/sql/upgrade.sql
udd/udd/bugs_gatherer.pl
Log:
split emails in the bugs and archived_bugs table. based on a patch by Olivier Berger.
Modified: udd/config-org.yaml
===================================================================
--- udd/config-org.yaml 2009-07-24 12:05:21 UTC (rev 1538)
+++ udd/config-org.yaml 2009-07-24 14:40:23 UTC (rev 1539)
@@ -20,7 +20,6 @@
ftpnew: module udd.ftpnew_gatherer
screenshots: module udd.screenshot_gatherer
dehs: module udd.dehs_gatherer
- debug: 1
timestamp-dir: /org/udd.debian.org/timestamps
lock-dir: /org/udd.debian.org/locks
archs:
Modified: udd/sql/setup.sql
===================================================================
--- udd/sql/setup.sql 2009-07-24 12:05:21 UTC (rev 1538)
+++ udd/sql/setup.sql 2009-07-24 14:40:23 UTC (rev 1539)
@@ -115,7 +115,9 @@
CREATE TABLE bugs
(id int PRIMARY KEY, package text, source text, arrival timestamp, status text,
- severity bugs_severity, submitter text, owner text, done text, title text,
+ severity bugs_severity, submitter text, submitter_name text,
+ submitter_email text, owner text, owner_name text, owner_email text,
+ done text, done_name text, done_email text, title text,
last_modified timestamp, forwarded text, affects_stable boolean,
affects_testing boolean, affects_unstable boolean,
affects_experimental boolean);
@@ -141,7 +143,9 @@
CREATE TABLE archived_bugs
(id int PRIMARY KEY, package text, source text, arrival timestamp, status text,
- severity bugs_severity, submitter text, owner text, done text, title text,
+ severity bugs_severity, submitter text, submitter_name text,
+ submitter_email text, owner text, owner_name text, owner_email text,
+ done text, done_name text, done_email text, title text,
last_modified timestamp, forwarded text, affects_stable boolean,
affects_testing boolean, affects_unstable boolean,
affects_experimental boolean);
Modified: udd/sql/upgrade.sql
===================================================================
--- udd/sql/upgrade.sql 2009-07-24 12:05:21 UTC (rev 1538)
+++ udd/sql/upgrade.sql 2009-07-24 14:40:23 UTC (rev 1539)
@@ -203,4 +203,16 @@
);
GRANT SELECT ON lintian TO PUBLIC;
-
+-- split emails in bugs
+ALTER TABLE bugs add submitter_name TEXT;
+ALTER TABLE bugs add submitter_email TEXT;
+ALTER TABLE bugs add owner_name TEXT;
+ALTER TABLE bugs add owner_email TEXT;
+ALTER TABLE bugs add done_name TEXT;
+ALTER TABLE bugs add done_email TEXT;
+ALTER TABLE archived_bugs add submitter_name TEXT;
+ALTER TABLE archived_bugs add submitter_email TEXT;
+ALTER TABLE archived_bugs add owner_name TEXT;
+ALTER TABLE archived_bugs add owner_email TEXT;
+ALTER TABLE archived_bugs add done_name TEXT;
+ALTER TABLE archived_bugs add done_email TEXT;
Modified: udd/udd/bugs_gatherer.pl
===================================================================
--- udd/udd/bugs_gatherer.pl 2009-07-24 12:05:21 UTC (rev 1538)
+++ udd/udd/bugs_gatherer.pl 2009-07-24 14:40:23 UTC (rev 1539)
@@ -19,6 +19,7 @@
use Debbugs::Packages qw{binarytosource getpkgsrc};
use Debbugs::Config qw{:globals %config};
use Debbugs::User;
+use Mail::Address;
#use Debbugs::User qw{read_usertags};
$YAML::Syck::ImplicitTyping = 1;
@@ -126,15 +127,17 @@
our $t;
our $timing;
-
- run_usertags($config, $source, $dbh);
- print "Inserting usertags: ",(time() - $t),"s\n" if $timing;
- $t = time();
-
my %src_config = %{$config->{$source}};
my $table = $src_config{table};
my $archived_table = $src_config{'archived-table'};
+ if (!$src_config{debug}) {
+ run_usertags($config, $source, $dbh);
+ print "Inserting usertags: ",(time() - $t),"s\n" if $timing;
+ $t = time();
+ }
+
+
my %pkgsrc = %{getpkgsrc()};
my @modified_bugs;
@@ -177,14 +180,14 @@
my $location = $src_config{archived} ? 'archive' : 'db_h';
$table = $src_config{archived} ? $archived_table : $table;
# Read all bugs
- my $insert_bugs_handle = $dbh->prepare("INSERT INTO $table (id, package, source, arrival, status, severity, submitter, owner, done, title, forwarded, last_modified, affects_stable, affects_testing, affects_unstable, affects_experimental) VALUES (\$1, \$2, \$3, \$4::abstime, \$5, \$6, \$7, \$8, \$9, \$10, \$11, \$12::abstime, \$13, \$14, \$15, \$16)");
+ my $insert_bugs_handle = $dbh->prepare("INSERT INTO $table (id, package, source, arrival, status, severity, submitter, submitter_name, submitter_email, owner, owner_name, owner_email, done, done_name, done_email, title, forwarded, last_modified, affects_stable, affects_testing, affects_unstable, affects_experimental) VALUES (\$1, \$2, \$3, \$4::abstime, \$5, \$6, \$7, \$8, \$9, \$10, \$11, \$12, \$13, \$14, \$15, \$16, \$17, \$18::abstime, \$19, \$20, \$21, \$22)");
my $insert_bugs_packages_handle = $dbh->prepare("INSERT INTO ${table}_packages (id, package, source) VALUES (\$1, \$2, \$3)");
my $insert_bugs_found_handle = $dbh->prepare("INSERT INTO ${table}_found_in (id, version) VALUES (\$1, \$2)");
my $insert_bugs_fixed_handle = $dbh->prepare("INSERT INTO ${table}_fixed_in (id, version) VALUES (\$1, \$2)");
my $insert_bugs_merged_handle = $dbh->prepare("INSERT INTO ${table}_merged_with (id, merged_with) VALUES (\$1, \$2)");
my $insert_bugs_tags_handle = $dbh->prepare("INSERT INTO ${table}_tags (id, tag) VALUES (\$1, \$2)");
$insert_bugs_handle->bind_param(4, undef, SQL_INTEGER);
- $insert_bugs_handle->bind_param(12, undef, SQL_INTEGER);
+ $insert_bugs_handle->bind_param(18, undef, SQL_INTEGER);
$t = time();
foreach my $bug_nr (@modified_bugs) {
@@ -204,7 +207,6 @@
# are assumed to be epoch (i.e. bug #4170)
map {
if($bug{$_}) {
- #$bug{$_} = "$bug{$_}::abstime";
$bug{$_} = int($bug{$_});
} else {
$bug{$_} = 0;
@@ -214,6 +216,30 @@
my $source = exists($pkgsrc{$bug{package}}) ? $pkgsrc{$bug{package}} : $bug{package};
+ # split emails
+ my (@addr, $submitter_name, $submitter_email, $owner_name, $owner_email, $done_name, $done_email);
+ @addr = Mail::Address->parse($bug{originator});
+ $submitter_name = $addr[0]->phrase;
+ $submitter_email = $addr[0]->address;
+
+ if ($bug{owner}) {
+ @addr = Mail::Address->parse($bug{owner});
+ $owner_name = $addr[0]->phrase;
+ $owner_email = $addr[0]->address;
+ } else {
+ $owner_name = '';
+ $owner_email = '';
+ }
+
+ if ($bug{done}) {
+ @addr = Mail::Address->parse($bug{done});
+ $done_name = $addr[0]->phrase;
+ $done_email = $addr[0]->address;
+ } else {
+ $done_name = '';
+ $done_email = '';
+ }
+
#Calculate bug presence in distributions
my ($present_in_stable, $present_in_testing, $present_in_unstable, $present_in_experimental);
if($src_config{archived}) {
@@ -264,7 +290,9 @@
# Insert data into bugs table
$insert_bugs_handle->execute($bug_nr, $bug{package}, $source, $bug{date}, $bug{pending},
- $bug{severity}, $bug{originator}, $bug{owner}, $bug{done}, $bug{subject}, $bug{forwarded}, $bug{log_modified},
+ $bug{severity}, $bug{originator}, $submitter_name, $submitter_email, $bug{owner},
+ $owner_name, $owner_email, $bug{done}, $done_name, $done_email, $bug{subject},
+ $bug{forwarded}, $bug{log_modified},
$present_in_stable, $present_in_testing, $present_in_unstable, $present_in_experimental) or die $!;
my $src;
More information about the Collab-qa-commits
mailing list