From: Don Armstrong <don@donarmstrong.com>
Date: Wed, 20 May 2009 16:27:22 +0000 (-0700)
Subject:  * fix the src:package bits for bugreport.cgi
X-Git-Tag: release/2.6.0~461^2~27
X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=f3e9030c5d22122dc4e7a4713b1c3413592a0d02;p=debbugs.git

 * fix the src:package bits for bugreport.cgi
---

diff --git a/Debbugs/CGI.pm b/Debbugs/CGI.pm
index 3285d526..d305aed7 100644
--- a/Debbugs/CGI.pm
+++ b/Debbugs/CGI.pm
@@ -404,7 +404,7 @@ sub package_links {
 				       %options,
 				       $type => $_,
 				      ),
-			     $_);
+			     ($type eq 'src'?'src:':'').$_);
 		       } make_list($param{$type}) if exists $param{$type};
      }
      for my $type (qw(maint owner submitter correspondent)) {
diff --git a/cgi/bugreport.cgi b/cgi/bugreport.cgi
index a151b219..790e1a2c 100755
--- a/cgi/bugreport.cgi
+++ b/cgi/bugreport.cgi
@@ -292,10 +292,20 @@ my %package;
 my @packages = splitpackages($status{package});
 
 foreach my $pkg (@packages) {
-     $package{$pkg} = {maintainer => exists($maintainer{$pkg}) ? $maintainer{$pkg} : '(unknown)',
-		       exists($pkgsrc{$pkg}) ? (source => $pkgsrc{$pkg}) : (),
-		       package    => $pkg,
-		      };
+     if ($pkg =~ /^src\:/) {
+	  my ($srcpkg) = $pkg =~ /^src:(.*)/;
+	  $package{$pkg} = {maintainer => exists($maintainer{$srcpkg}) ? $maintainer{$srcpkg} : '(unknown)',
+			    source     => $srcpkg,
+			    package    => $pkg,
+			    is_source  => 1,
+			   };
+     }
+     else {
+	  $package{$pkg} = {maintainer => exists($maintainer{$pkg}) ? $maintainer{$pkg} : '(unknown)',
+			    exists($pkgsrc{$pkg}) ? (source => $pkgsrc{$pkg}) : (),
+			    package    => $pkg,
+			   };
+     }
 }
 
 # fixup various bits of the status
diff --git a/templates/en_US/cgi/bugreport_pkginfo.tmpl b/templates/en_US/cgi/bugreport_pkginfo.tmpl
index 4a39ba37..872aff44 100644
--- a/templates/en_US/cgi/bugreport_pkginfo.tmpl
+++ b/templates/en_US/cgi/bugreport_pkginfo.tmpl
@@ -1,14 +1,15 @@
 <div class="pkginfo">
   <p>{if (keys %package > 1) { q(Packages)} else {q(Package)}}:
-     {join(q(, ),package_links(package => [map {$_->{package}} values %package],
+     {join(q(, ),package_links(package => [map {$_->{package}} grep {!$_->{is_source}} values %package],
+                               source  => [map {$_->{source} } grep { $_->{is_source}} values %package],
                                class => q(submitter),
                               )
           )};
 {my $output ='';
  for my $package (values %package) {
-     $output .= q(Maintainer for ).package_links(package=>$package->{package}).qq( is ).
+     $output .= q(Maintainer for ).package_links($package->{is_source}?(source=>$package->{source}):(package=>$package->{package})).qq( is ).
                 package_links(maintainer => $package->{maintainer}).qq(; );
-     if (exists $package->{source}) {
+     if (exists $package->{source} and not $package->{is_source}) {
      	$output .= q(Source for ).package_links(package=>$package->{package}).qq( is ).
         	    package_links(source => $package->{source}).qq(. );
      }