From 51af9ad60bb22b58023f5dc49a7cd11d6ca8e640 Mon Sep 17 00:00:00 2001 From: doogie <> Date: Sat, 17 Nov 2001 00:40:03 -0800 Subject: [PATCH] [project @ 2001-11-17 00:40:03 by doogie] Add support for searching by source package. pkgreport.cgi takes src=, and both pkgreport.cgi and bugreport.cgi have enhanced html headers now. --- cgi/bugreport.cgi | 9 +++++++-- cgi/common.pl | 23 +++++++++++++++++++++++ cgi/pkgreport.cgi | 43 ++++++++++++++++++++++++++++++++----------- scripts/config.debian | 3 ++- scripts/config.in | 3 ++- 5 files changed, 66 insertions(+), 15 deletions(-) diff --git a/cgi/bugreport.cgi b/cgi/bugreport.cgi index 817970f..a5de4d7 100755 --- a/cgi/bugreport.cgi +++ b/cgi/bugreport.cgi @@ -18,6 +18,7 @@ my %param = readparse(); my $tail_html; my %maintainer = %{getmaintainers()}; +my %pkgsrc = %{getpkgsrc()}; my $ref = $param{'bug'} || quit("No bug number"); my $msg = $param{'msg'} || ""; @@ -82,11 +83,15 @@ if (length($status{done})) { $indexentry .= ";\nForwarded to ".htmlsanit($status{forwarded}); } -my ($short, $tmaint); +my ($short, $tmaint, $tsrc); $short = $ref; $short =~ s/^\d+/#$&/; $tmaint = defined($maintainer{$tpack}) ? $maintainer{$tpack} : '(unknown)'; +$tsrc = defined($pkgsrc{$tpack}) ? $pkgsrc{$tpack} : '(unknown)'; $descriptivehead= $indexentry.$submitted.";\nMaintainer for $status{package} is\n". - ''.htmlsanit($tmaint).'.'; + ''.htmlsanit($tmaint).''; +$descriptivehead.= ";\n
Source for $status{package} is\n". + '$tsrc"; +$descriptivehead.= "."; my $buglog = buglog($ref); open L, "<$buglog" or &quit("open log for $ref: $!"); diff --git a/cgi/common.pl b/cgi/common.pl index 1894a61..e80d488 100644 --- a/cgi/common.pl +++ b/cgi/common.pl @@ -154,6 +154,14 @@ sub pkgurl { return urlsanit($debbugs::gCGIDomain . "pkgreport.cgi" . "?" . "$params"); } +sub srcurl { + my $ref = shift; + my $params = "src=$ref"; + $params .= "&archive=yes" if ($common_archive); + $params .= "&repeatmerged=yes" if ($common_repeatmerged); + return urlsanit($debbugs::gCGIDomain . "pkgreport.cgi" . "?" . "$params"); +} + sub urlsanit { my $url = shift; $url =~ s/%/%25/g; @@ -389,6 +397,21 @@ sub getmaintainers { return \%maintainer; } +sub getpkgsrc { + my %pkgsrc; + + open(MM,"$gPackageSource") or &quit("open $gPackageSource: $!"); + while() { + next unless m/^(\S+)\s+(\S.*\S)\s*$/; + ($a,$b)=($1,$2); + $a =~ y/A-Z/a-z/; + $pkgsrc{$a}= $b; + } + close(MM); + + return \%pkgsrc +} + sub getbugdir { my ( $bugnum, $ext ) = @_; my $archdir = sprintf "%02d", $bugnum % 100; diff --git a/cgi/pkgreport.cgi b/cgi/pkgreport.cgi index 46eb9d0..39049a0 100755 --- a/cgi/pkgreport.cgi +++ b/cgi/pkgreport.cgi @@ -15,9 +15,10 @@ nice(5); my %param = readparse(); -my ($pkg, $maint, $maintenc, $submitter, $severity, $status); +my ($pkg, $src, $maint, $maintenc, $submitter, $severity, $status); if (defined ($pkg = $param{'pkg'})) { +} elsif (defined ($src = $param{'src'})) { } elsif (defined ($maint = $param{'maint'})) { } elsif (defined ($maintenc = $param{'maintenc'})) { } elsif (defined ($submitter= $param{'submitter'})) { @@ -59,6 +60,10 @@ my @bugs; if (defined $pkg) { $tag = "package $pkg"; @bugs = @{getbugs(sub {my %d=@_; return $pkg eq $d{"pkg"}}, 'package', $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) }; } elsif (defined $maint) { my %maintainers = %{getmaintainers()}; $tag = "maintainer $maint"; @@ -117,18 +122,34 @@ print "\n" . print "

" . "$debbugs::gProject$Archived $debbugs::gBug report logs: $tag" . "

\n"; -if (defined $pkg) { +if (defined $pkg || defined $src) { my %maintainers = %{getmaintainers()}; - if (defined $maintainers{$pkg}) { - print "

Maintainer for $pkg is " - . htmlsanit($maintainers{$pkg}) . ".

\n"; + my $maint = $pkg ? $maintainers{$pkg} : $maintainers{$src} ? $maintainers{$src} : undef; + if (defined $maint) { + print "

Maintainer for " . ( defined($pkg) ? $pkg : "source package $src" ) . " is " + . 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 ) ); + } + if ( @pkgs ) { + @pkgs = sort @pkgs; + if ($pkg) { + print "You may want to refer to the following packages that are part of the same source:
\n"; + } else { + print "You may want to refer to the following packages' individual bug pages:
\n"; + } + print join( ", ", map( "$_", @pkgs ) ); + print "\n"; + } + 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; } - print "

Note that with multi-binary packages there may be other\n"; - print "reports filed under the different binary package names.

\n"; - print "\n"; -my $stupidperl = ${debbugs::gPackagePages}; - printf "

You might like to refer to the %s package page

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

Note that maintainers may use different Maintainer fields for\n"; print "different packages, so there may be other reports filed under\n"; diff --git a/scripts/config.debian b/scripts/config.debian index 22ecfcd..d9962fa 100644 --- a/scripts/config.debian +++ b/scripts/config.debian @@ -1,5 +1,5 @@ # This is the bugs.debian.org debbugs configuration file. -# $Id: config.debian,v 1.12 2001/08/16 06:58:08 joy Exp $ +# $Id: config.debian,v 1.13 2001/11/17 00:40:03 doogie Exp $ # Domains $gEmailDomain = "bugs.debian.org"; @@ -73,3 +73,4 @@ $gMaintainerFileOverride = "$gConfigDir/Maintainers.override"; $gUnknownMaintainerEmail = "unknown-package\@qa.debian.org"; $gPseudoDescFile = "$gConfigDir/pseudo-packages.description"; +$gPackageSource = "$gConfigDir/indices/sources"; diff --git a/scripts/config.in b/scripts/config.in index b0ba4aa..59119ce 100644 --- a/scripts/config.in +++ b/scripts/config.in @@ -1,6 +1,6 @@ # This is the template debbugs configuration file. # You *must* edit it in order for debbugs to work. -# $Id: config.in,v 1.13 2001/04/24 19:10:26 doogie Exp $ +# $Id: config.in,v 1.14 2001/11/17 00:40:03 doogie Exp $ # Domains $gEmailDomain = "bugs.something"; # e.g. bugs.debian.org @@ -69,3 +69,4 @@ $gAJIndex = "/debian/home/ajt/ajbug/pkgindex"; # AJ's package index $gMaintainerFile = "$gConfigDir/Maintainers"; $gMaintainerFileOverride = "$gConfigDir/Maintainers.override"; $gPseudoDescFile = "$gConfigDir/pseudo-packages.description"; +$gPackageSource = "$gConfigDir/indices/sources"; -- 2.39.2