From: Don Armstrong Date: Thu, 6 Nov 2014 01:03:57 +0000 (-0800) Subject: Add affects to bugreport.cgi package info header (Closes: #609687). X-Git-Tag: release/2.6.0~247 X-Git-Url: https://git.donarmstrong.com/?p=debbugs.git;a=commitdiff_plain;h=1cda40c7b331de6c31df360b48ed28cbc7b4db5a Add affects to bugreport.cgi package info header (Closes: #609687). --- diff --git a/cgi/bugreport.cgi b/cgi/bugreport.cgi index 3899a9d..9064ca8 100755 --- a/cgi/bugreport.cgi +++ b/cgi/bugreport.cgi @@ -307,24 +307,30 @@ unless (%status) { #$|=1; -my %package; + my @packages = make_list($status{package}); -foreach my $pkg (@packages) { - 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, - }; - } + +my %packages_affects; +for my $p_a (qw(package affects)) { + foreach my $pkg (make_list($status{$p_a})) { + if ($pkg =~ /^src\:/) { + my ($srcpkg) = $pkg =~ /^src:(.*)/; + $packages_affects{$p_a}{$pkg} = + {maintainer => exists($maintainer{$srcpkg}) ? $maintainer{$srcpkg} : '(unknown)', + source => $srcpkg, + package => $pkg, + is_source => 1, + }; + } + else { + $packages_affects{$p_a}{$pkg} = + {maintainer => exists($maintainer{$pkg}) ? $maintainer{$pkg} : '(unknown)', + exists($pkgsrc{$pkg}) ? (source => $pkgsrc{$pkg}) : (), + package => $pkg, + }; + } + } } # fixup various bits of the status @@ -387,7 +393,8 @@ print $q->header(-type => "text/html", print fill_in_template(template => 'cgi/bugreport', variables => {status => \%status, - package => \%package, + package => $packages_affects{'package'}, + affects => $packages_affects{'affects'}, log => $log, bug_num => $ref, version_graph => $version_graph, diff --git a/debian/changelog b/debian/changelog index 584111e..7f8ef53 100644 --- a/debian/changelog +++ b/debian/changelog @@ -26,6 +26,7 @@ debbugs (2.4.2~exp2) UNRELEASED; urgency=low * Add reply links to individual bug messages with headers (closes: #412815). Thanks to martin krafft, Paul Wise, and Julien Valroff. * Fix XSS in version.cgi, thanks to Vlad Constantin (Closes: #762967). + * Add affects to bugreport.cgi package info header (Closes: #609687). [Thanks to Arnout Engelen: ] * Add Homepage (closes: #670555). diff --git a/templates/en_US/cgi/bugreport_pkginfo.tmpl b/templates/en_US/cgi/bugreport_pkginfo.tmpl index 872aff4..777928e 100644 --- a/templates/en_US/cgi/bugreport_pkginfo.tmpl +++ b/templates/en_US/cgi/bugreport_pkginfo.tmpl @@ -16,4 +16,16 @@ } $output; }

+{ my $output = ''; + if (keys %affects) { + $output .= q(

Affects: ). + join(q(, ), + package_links(package => [map {$_->{package}} grep {!$_->{is_source}} values %affects], + source => [map {$_->{source} } grep { $_->{is_source}} values %affects], + class => q(submitter), + ) + ).q(

); + } + $output; +}