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

Bug#695508: udd: bugs.cgi - bugs filed against multiple packages is not associated with a source



Hi Lucas,

On Sat, Dec 29, 2012 at 12:05:38PM +0100, Lucas Nussbaum wrote:
> > I could try to create a patch, but I don't know where to get the data to do
> > the test, so I'll leave that to someone else.

> If you could write a basic patch, I could try to test it myself.
> 
> Alternatively, you could get the BTS data using rsync:
> $ rsync bugs-mirror.debian.org::
> bts-spool-db   	[bugs-mirror.debian.org] active bug spool
> bts-spool-archive	[bugs-mirror.debian.org] archived bug spool
> bts-spool-index	[bugs-mirror.debian.org] bug index files
> bts-versions   	[bugs-mirror.debian.org] bts package version information
> But I'm not sure it's worth the trouble.

To run the bugs import, a number of files from /srv/bugs.debian.org/etc are
also needed. I don't know if they are available somewhere.

Most of the necessary files can be empty or generated from other data, so I
was able to do some basic testing, and I created a patch (attached) that
should fix the import part of this bug.

Cheers,

Ivo

commit 6d5d39cfc8b207ed14392a88ca4de042474c74d9
Author: Ivo De Decker <ivo.dedecker@ugent.be>
Date:   Sat Jan 5 20:35:39 2013 +0100

    properly lookup source package for bugs against multiple packages

diff --git a/udd/bugs_gatherer.pl b/udd/bugs_gatherer.pl
index f90bfa0..c1df691 100644
--- a/udd/bugs_gatherer.pl
+++ b/udd/bugs_gatherer.pl
@@ -29,6 +29,7 @@ $YAML::Syck::ImplicitTyping = 1;
 #Used for measuring time
 our $t;
 our $timing = 0;
+my %pkgsrc = %{getpkgsrc()};
 our @archs = grep {  !/(^m68k$|^kfreebsd|^hurd)/ } @{$config{default_architectures}};
 
 # Return the list of usernames
@@ -96,6 +97,30 @@ sub without_duplicates {
 	return (grep { ($h{$_}++ == 0) || 0 } @_);
 }
 
+sub get_source {
+	my $pkg = shift;
+
+	if ($pkg =~ m/,/) {
+		my @pkgs = split(/\s*[, ]\s*/, $pkg);
+		my %srcs = ();
+		foreach my $p (@pkgs) {
+			my $src = get_source($p);
+			$srcs{$src} = 1;
+		}
+		return join(",",sort keys %srcs);
+
+	} else {
+		my $srcpkg;
+		if ($pkg =~ /^src:(.*)/)
+		{
+			$srcpkg = $1;
+		} else {
+			$srcpkg = exists($pkgsrc{$pkg}) ? $pkgsrc{$pkg} : $pkg;
+		}
+		return $srcpkg;
+	}
+}
+
 sub run_usertags {
 	my ($config, $source, $dbh) = @_;
 	my %src_config = %{$config->{$source}};
@@ -140,8 +165,6 @@ sub run {
 	}
 
 
-	my %pkgsrc = %{getpkgsrc()};
-
 	my @modified_bugs;
 
 	if($src_config{archived}) {
@@ -218,13 +241,7 @@ sub run {
 			}
 		} qw{date log_modified done_date};
 
-		my $srcpkg;
-		if ($bug{package} =~ /^src:(.*)/)
-		{
-			$srcpkg = $1;
-		} else {
-			$srcpkg = exists($pkgsrc{$bug{package}}) ? $pkgsrc{$bug{package}} : $bug{package};
-		}
+		my $srcpkg = get_source($bug{package});
 
 		# split emails
 		my (@addr, $submitter_name, $submitter_email, $owner_name, $owner_email, $done_name, $done_email);
@@ -321,12 +338,7 @@ sub run {
 
 		my $src;
 		foreach my $pkg (keys %{{ map { $_ => 1 } split(/\s*[, ]\s*/, $bug{package})}}) {
-			if ($pkg =~ /^src:(.*)/)
-			{
-				$src = $1;
-			} else {
-				$src = exists($pkgsrc{$pkg}) ? $pkgsrc{$pkg} : $pkg;
-			}
+			$src = get_source($pkg);
 			$insert_bugs_packages_handle->execute($bug_nr, $pkg, $src) or die $!;
 		}
 

Reply to: