From: doogie <> Date: Sat, 17 Nov 2001 14:31:40 +0000 (-0800) Subject: [project @ 2001-11-17 06:31:40 by doogie] X-Git-Tag: release/2.6.0~1092 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=517c36b2085743cf9b42dac1f79e8de8e65cdbe1;p=debbugs.git [project @ 2001-11-17 06:31:40 by doogie] * Add new sub to common.pl(getsrcpkgs), that, when given source package, returnsr a list of all packages that come from that source. * Modified pkgreport.cgi to use getsrcpkgs * Modified the call to getbugs(), so that it could use the package index. --- diff --git a/cgi/common.pl b/cgi/common.pl index e80d4889..9ae3acb6 100644 --- a/cgi/common.pl +++ b/cgi/common.pl @@ -451,6 +451,17 @@ sub getbugstatus { return \%status; } +sub getsrcpkgs { + my $src = shift; + + my %pkgsrc = %{getpkgsrc()}; + my @pkgs; + foreach ( keys %pkgsrc ) { + push @pkgs, $_ if $pkgsrc{$_} eq $src; + } + return @pkgs; +} + sub buglog { my $bugnum = shift; diff --git a/cgi/pkgreport.cgi b/cgi/pkgreport.cgi index 39049a0a..ec85d432 100755 --- a/cgi/pkgreport.cgi +++ b/cgi/pkgreport.cgi @@ -63,7 +63,7 @@ if (defined $pkg) { } elsif (defined $src) { $tag = "source $src"; my %pkgsrc = %{getpkgsrc()}; - @bugs = @{getbugs(sub { my %d=@_; return $src eq $d{"pkg"} || ( defined( $pkgsrc{$d{"pkg"}} ) && $src eq $pkgsrc{$d{"pkg"}} ) }, 'source', $src) }; + @bugs = @{getbugs(sub {my %d=@_; return $pkg eq $d{"pkg"}}, 'package', getsrcpkgs($src))}; } elsif (defined $maint) { my %maintainers = %{getmaintainers()}; $tag = "maintainer $maint"; @@ -131,11 +131,8 @@ if (defined $pkg || defined $src) { . htmlsanit($maint) . ".

\n"; } my %pkgsrc = %{getpkgsrc()}; - my @pkgs; - $src = $pkgsrc{ $pkg } if ( $pkg && !$src ); - foreach ( keys %pkgsrc ) { - push @pkgs, $_ if $pkgsrc{$_} eq $src && ( ( $pkg && !( $_ eq $pkg ) ) || ( !$pkg && $src ) ); - } + my @pkgs = getsrcpkgs($pkg ? $pkgsrc{ $pkg } : $src); + @pkgs = grep( !/^$pkg$/, @pkgs ) if ( $pkg ); if ( @pkgs ) { @pkgs = sort @pkgs; if ($pkg) { @@ -148,7 +145,7 @@ if (defined $pkg || defined $src) { } if ($pkg) { my $stupidperl = ${debbugs::gPackagePages}; - printf "

You might like to refer to the %s package page, or to the source package %s's bug page.

\n", urlsanit("http://${debbugs::gPackagePages}/$pkg"), htmlsanit("$pkg"), urlsanit(srcurl($src)), $src; + printf "

You might like to refer to the %s package page, or to the source package %s's bug page.

\n", urlsanit("http://${debbugs::gPackagePages}/$pkg"), htmlsanit("$pkg"), urlsanit(srcurl($pkg)), $pkgsrc{$pkg}; } } elsif (defined $maint || defined $maintenc) { print "

Note that maintainers may use different Maintainer fields for\n";