From: cjwatson <> Date: Wed, 29 Jan 2003 06:59:47 +0000 (-0800) Subject: [project @ 2003-01-28 22:59:47 by cjwatson] X-Git-Tag: release/2.6.0~964 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;ds=sidebyside;h=673d85547f13a3c564996d47a88d2d737f1ef07c;p=debbugs.git [project @ 2003-01-28 22:59:47 by cjwatson] 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.) --- diff --git a/cgi/bugreport.cgi b/cgi/bugreport.cgi index 8c755e9..b2c82cf 100755 --- a/cgi/bugreport.cgi +++ b/cgi/bugreport.cgi @@ -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 .= "

$showseverity"; -$indexentry .= "Package: " - .htmlsanit($status{package}).";\n"; +$indexentry .= htmlpackagelinks($status{package}); $indexentry .= "Reported by: " . htmlsanit($status{originator}) . ";\n"; @@ -127,14 +126,17 @@ if (length($status{done})) { $indexentry .= join(";\n", @descstates) . ";\n
" 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". ''.htmlsanit($tmaint).''; -$descriptivehead.= ";\nSource for $status{package} is\n". - '$tsrc" if ($tsrc ne "(unknown)"); -$descriptivehead.= ".

"; + $descriptivehead .= ";\nSource for $pkg is\n". + '$tsrc" if ($tsrc ne "(unknown)"); + $descriptivehead .= ".\n
"; +} open L, "<$buglog" or &quit("open log for $ref: $!"); if ($buglog !~ m#^\Q$gSpoolDir/db-h/#) { diff --git a/cgi/common.pl b/cgi/common.pl index d45b9de..72f4188 100644 --- a/cgi/common.pl +++ b/cgi/common.pl @@ -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 { + '' . + '' . htmlsanit($_) . '' + } @pkglist + ) . ";\n"; +} + sub htmlindexentry { my $ref = shift; my %status = %{getbugstatus($ref)}; @@ -127,9 +151,7 @@ sub htmlindexentrystatus { $showseverity = "Severity: $status{severity};\n"; } - $result .= "Package: " - . "" . htmlsanit($status{"package"}) . ";\n" - if (length($status{"package"})); + $result .= htmlpackagelinks($status{"package"}); $result .= $showseverity; $result .= "Reported by: " . htmlsanit($status{originator}) . "";