]> git.donarmstrong.com Git - debbugs.git/commitdiff
[project @ 2003-01-28 22:59:47 by cjwatson]
authorcjwatson <>
Wed, 29 Jan 2003 06:59:47 +0000 (22:59 -0800)
committercjwatson <>
Wed, 29 Jan 2003 06:59:47 +0000 (22:59 -0800)
Display package, maintainer, and source links correctly when a bug is filed
against multiple packages; patch from H. S. Teoh, #172710. (Multi-package
bugs can't yet be displayed in the correct set of pkgreport.cgi pages,
though.)

cgi/bugreport.cgi
cgi/common.pl

index 8c755e9d1a52ae967b37ad56ab2b372339fcd962..b2c82cf3d202539cffba19b69f5fdb56e222934e 100755 (executable)
@@ -81,7 +81,7 @@ EOF
 $|=1;
 
 $tpack = lc $status{'package'};
-$tpack =~ s/[^-+._a-z0-9()].*$//;
+my @tpacks = splitpackages($tpack);
 
 if  ($status{severity} eq 'normal') {
        $showseverity = '';
@@ -92,8 +92,7 @@ if  ($status{severity} eq 'normal') {
 }
 
 $indexentry .= "<p>$showseverity";
-$indexentry .= "Package: <a href=\"" . pkgurl($status{package}) . "\">"
-           .htmlsanit($status{package})."</a>;\n";
+$indexentry .= htmlpackagelinks($status{package});
 
 $indexentry .= "Reported by: <a href=\"" . submitterurl($status{originator})
               . "\">" . htmlsanit($status{originator}) . "</a>;\n";
@@ -127,14 +126,17 @@ if (length($status{done})) {
 
 $indexentry .= join(";\n", @descstates) . ";\n<br>" if @descstates;
 
-my ($tmaint, $tsrc);
-$tmaint = defined($maintainer{$tpack}) ? $maintainer{$tpack} : '(unknown)';
-$tsrc = defined($pkgsrc{$tpack}) ? $pkgsrc{$tpack} : '(unknown)';
-$descriptivehead= $indexentry."Maintainer for $status{package} is\n".
+$descriptivehead = $indexentry;
+foreach my $pkg (@tpacks) {
+    my $tmaint = defined($maintainer{$pkg}) ? $maintainer{$pkg} : '(unknown)';
+    my $tsrc = defined($pkgsrc{$pkg}) ? $pkgsrc{$pkg} : '(unknown)';
+
+    $descriptivehead .= "Maintainer for $pkg is\n".
             '<a href="'.mainturl($tmaint).'">'.htmlsanit($tmaint).'</a>';
-$descriptivehead.= ";\nSource for $status{package} is\n".
-           '<a href="'.srcurl($tsrc)."\">$tsrc</a>" if ($tsrc ne "(unknown)");
-$descriptivehead.= ".</p>";
+    $descriptivehead .= ";\nSource for $pkg is\n".
+            '<a href="'.srcurl($tsrc)."\">$tsrc</a>" if ($tsrc ne "(unknown)");
+    $descriptivehead .= ".\n<br>";
+}
 
 open L, "<$buglog" or &quit("open log for $ref: $!");
 if ($buglog !~ m#^\Q$gSpoolDir/db-h/#) {
index d45b9debc80d45801771551e6dc5bfe72867c4ae..72f41886a3217ebc10efd8dd32e028bcdd6249e3 100644 (file)
@@ -106,6 +106,30 @@ sub quit {
 #    exit 0;
 #}
 
+# Split a package string from the status file into a list of package names.
+sub splitpackages {
+    my $pkgs = shift;
+    return unless defined $pkgs;
+    return split /[ \t?,()]+/, $pkgs;
+}
+
+# Generate a comma-separated list of HTML links to each package given in
+# $pkgs. $pkgs may be empty, in which case an empty string is returned, or
+# it may be a comma-separated list of package names.
+sub htmlpackagelinks {
+    my $pkgs = shift;
+    return unless defined $pkgs and $pkgs ne '';
+    my @pkglist = splitpackages($pkgs);
+
+    return 'Package' . (@pkglist > 1 ? 's' : '') . ': ' .
+           join(', ',
+                map {
+                    '<a href="' . pkgurl($_) . '">' .
+                    '<strong>' . htmlsanit($_) . '</strong></a>'
+                } @pkglist
+           ) . ";\n";
+}
+
 sub htmlindexentry {
     my $ref = shift;
     my %status = %{getbugstatus($ref)};
@@ -127,9 +151,7 @@ sub htmlindexentrystatus {
         $showseverity = "Severity: <em>$status{severity}</em>;\n";
     }
 
-    $result .= "Package: <a href=\"" . pkgurl($status{"package"}) . "\">"
-               . "<strong>" . htmlsanit($status{"package"}) . "</strong></a>;\n"
-               if (length($status{"package"}));
+    $result .= htmlpackagelinks($status{"package"});
     $result .= $showseverity;
     $result .= "Reported by: <a href=\"" . submitterurl($status{originator})
                . "\">" . htmlsanit($status{originator}) . "</a>";