]> git.donarmstrong.com Git - debbugs.git/commitdiff
[project @ 2001-11-17 00:40:03 by doogie]
authordoogie <>
Sat, 17 Nov 2001 08:40:03 +0000 (00:40 -0800)
committerdoogie <>
Sat, 17 Nov 2001 08:40:03 +0000 (00:40 -0800)
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
cgi/common.pl
cgi/pkgreport.cgi
scripts/config.debian
scripts/config.in

index 817970f7ffb08b2cf6511b8ce5c02b3f0783480c..a5de4d74328e58423cd246be2ab700f10d170c09 100755 (executable)
@@ -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 .= ";\n<strong>Forwarded</strong> 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".
-            '<A href="http://'.$debbugs::gWebDomain.'/db/ma/l'.&maintencoded($tmaint).'.html">'.htmlsanit($tmaint).'</A>.';
+            '<A href="http://'.$debbugs::gWebDomain.'/db/ma/l'.&maintencoded($tmaint).'.html">'.htmlsanit($tmaint).'</A>';
+$descriptivehead.= ";\n<br>Source for $status{package} is\n".
+           '<A href="'.srcurl($tsrc)."\">$tsrc</A>";
+$descriptivehead.= ".";
 
 my $buglog = buglog($ref);
 open L, "<$buglog" or &quit("open log for $ref: $!");
index 1894a612dd640e68601eb31d54a69b497195e4a2..e80d4889f7bfd6ca3c96207ef6b515d4ef83af54 100644 (file)
@@ -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(<MM>) {
+       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;
index 46eb9d084790affc02aff82d95ed7d45db2b9a51..39049a0af8beedbe94ef5f71fc2b5527e015ec2c 100755 (executable)
@@ -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 "<HTML><HEAD>\n" .
 print "<H1>" . "$debbugs::gProject$Archived $debbugs::gBug report logs: $tag" .
       "</H1>\n";
 
-if (defined $pkg) {
+if (defined $pkg || defined $src) {
     my %maintainers = %{getmaintainers()};
-    if (defined $maintainers{$pkg}) {
-        print "<p>Maintainer for $pkg is <a href=\"" 
-              . mainturl($maintainers{$pkg}) . "\">"
-              . htmlsanit($maintainers{$pkg}) . "</a>.</p>\n";
+    my $maint = $pkg ? $maintainers{$pkg} : $maintainers{$src} ? $maintainers{$src} : undef;
+    if (defined $maint) {
+        print "<p>Maintainer for " . ( defined($pkg) ? $pkg : "source package $src" ) . " is <a href=\"" 
+              . mainturl($maint) . "\">"
+              . htmlsanit($maint) . "</a>.</p>\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:<br>\n";
+       } else {
+               print "You may want to refer to the following packages' individual bug pages:<br>\n";
+       }
+       print join( ", ", map( "<A href=\"" . pkgurl($_) . "\">$_</A>", @pkgs ) );
+       print "\n";
+    }
+    if ($pkg) {
+       my $stupidperl = ${debbugs::gPackagePages};
+       printf "<p>You might like to refer to the <a href=\"%s\">%s package page</a>, or to the source package <a href=\"%s\">%s</a>'s bug page.</p>\n", urlsanit("http://${debbugs::gPackagePages}/$pkg"), htmlsanit("$pkg"), urlsanit(srcurl($src)), $src;
     }
-    print "<p>Note that with multi-binary packages there may be other\n";
-    print "reports filed under the different binary package names.</p>\n";
-    print "\n";
-my $stupidperl = ${debbugs::gPackagePages};
-    printf "<p>You might like to refer to the <a href=\"%s\">%s package page</a></p>\n", urlsanit("http://${debbugs::gPackagePages}/$pkg"), htmlsanit("$pkg");
 } elsif (defined $maint || defined $maintenc) {
     print "<p>Note that maintainers may use different Maintainer fields for\n";
     print "different packages, so there may be other reports filed under\n";
index 22ecfcda9ddaebab142403c67a8ba8535b4ef3a0..d9962fa0dc8347f0bdf3fb01c16e6c8b11457231 100644 (file)
@@ -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";
index b0ba4aa812d814d42461e46b39090786aa1c416b..59119cee3ba5b9eb175f62d3b896409b7833b5c1 100644 (file)
@@ -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";