[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [UDD] Splitting email phrase and address in bugs.submitter ?



Le mardi 24 mars 2009 à 17:01 +0100, Olivier Berger a écrit :
> Le samedi 21 mars 2009 à 19:27 +0100, Lucas Nussbaum a écrit :
> 
> > I would prefer to do that at import-time, like it is done for the
> > sources and uploaders table (maintainer being split in maintainer_name
> > and maintainer_email).
> > 
> > The reason it is not done for the bugs importer is just that people have
> > been lazy :-) I would very much appreciate a patch.
> > 
> 
> Will try and do that.
> 

Here's a proposed patch.

I'm no perl hacker, so this may as well be nonsense... and I certainly
didn't test it, having no access to a running UDD (well, the acquisition
part).

Hope this helps anyway.

Best regards,
-- 
Olivier BERGER <olivier.berger@it-sudparis.eu>
http://www-public.it-sudparis.eu/~berger_o/ - OpenPGP-Id: 1024D/6B829EEC
Ingénieur Recherche - Dept INF
Institut TELECOM, SudParis (http://www.it-sudparis.eu/), Evry (France)
Index: sql/setup.sql
===================================================================
--- sql/setup.sql	(révision 1421)
+++ sql/setup.sql	(copie de travail)
@@ -103,7 +103,7 @@
 
 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_address text, owner text, done text, title text,
      last_modified timestamp, forwarded text, affects_stable boolean,
     affects_testing boolean, affects_unstable boolean,
     affects_experimental boolean);
Index: udd/bugs_gatherer.pl
===================================================================
--- udd/bugs_gatherer.pl	(révision 1421)
+++ udd/bugs_gatherer.pl	(copie de travail)
@@ -13,6 +13,7 @@
 use DBI qw{:sql_types};
 use YAML::Syck;
 use Time::Local;
+use Email::Address;
 
 use Debbugs::Bugs qw{get_bugs};
 use Debbugs::Status qw{read_bug get_bug_status bug_presence};
@@ -177,7 +178,7 @@
 	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_address, 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_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)");
@@ -262,9 +263,20 @@
 			}
 		}
 
+		my ($submitter_name, $submitter_address);
+
+		my $address = ( Email::Address->parse($bug{originator}) )[0];
+		if ($address) {
+		    $submitter_name = $address->phrase;
+		    $submitter_address = $address->address;
+		} else {
+		    $submitter_name = '';
+		    $submitter_address = '';
+		}
+
 		# 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_address, $bug{owner}, $bug{done}, $bug{subject}, $bug{forwarded}, $bug{log_modified},
 			$present_in_stable, $present_in_testing, $present_in_unstable, $present_in_experimental) or die $!;
 
 		my $src;

Attachment: signature.asc
Description: Ceci est une partie de message =?ISO-8859-1?Q?num=E9riquement?= =?ISO-8859-1?Q?_sign=E9e?=


Reply to: