]> git.donarmstrong.com Git - debbugs.git/blobdiff - cgi/pkgreport.cgi
[project @ 2001-11-22 01:47:41 by doogie]
[debbugs.git] / cgi / pkgreport.cgi
index ec85d4321a282601e36d1ecfe6c03ffaeddb0d6c..d2d933994fe39486a32ba9a657010ace5c976a5b 100755 (executable)
@@ -17,21 +17,58 @@ my %param = readparse();
 
 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'})) { 
-} elsif (defined ($severity = $param{'severity'})) { 
-       $status = $param{'status'} || 'open';
-} else {
-       quit("You have to choose something to select by");
+my %which = (
+       'pkg' => \$pkg,
+       'src' => \$src,
+       'maint' => \$maint,
+       'maintenc' => \$maintenc,
+       'submitter' => \$submitter,
+       'severity' => \$severity,
+       );
+my @allowedEmpty = ( 'maint' );
+
+my $found;
+foreach ( keys %which ) {
+       $status = $param{'status'} || 'open' if /^severity$/;
+       if (($found = $param{$_})) {
+               ${ $which{$_} } = $found;
+               last;
+       }
+}
+if (!$found) {
+       foreach ( @allowedEmpty ) {
+               if (exists($param{$_})) {
+                       ${ $which{$_} } = '';
+                       $found = 1;
+                       last;
+               }
+       }
 }
+if (!$found) {
+       my $which;
+       if (($which = $param{'which'})) {
+               if (grep( /^\Q$which\E$/, @allowedEmpty)) {
+                       ${ $which{$which} } = $param{'data'};
+                       $found = 1;
+               } elsif (($found = $param{'data'})) {
+                       ${ $which{$which} } = $found if (exists($which{$which}));
+               }
+       }
+}
+quit("You have to choose something to select by") if (!$found);
 
 my $repeatmerged = ($param{'repeatmerged'} || "yes") eq "yes";
 my $archive = ($param{'archive'} || "no") eq "yes";
 my $include = $param{'include'} || "";
 my $exclude = $param{'exclude'} || "";
+my $raw_sort = ($param{'raw'} || "no") eq "yes";
+my $bug_rev = ($param{'bug-rev'} || "no") eq "yes";
+my $pend_rev = ($param{'pend-rev'} || "no") eq "yes";
+my $sev_rev = ($param{'sev-rev'} || "no") eq "yes";
+my $pend_exc = $param{'&pend-exc'} || $param{'pend-exc'} || "";
+my $pend_inc = $param{'&pend-inc'} || $param{'pend-inc'} || "";
+my $sev_exc = $param{'&sev-exc'} || $param{'sev-exc'} || "";
+my $sev_inc = $param{'&sev-inc'} || $param{'sev-inc'} || "";
 
 my $Archived = $archive ? " Archived" : "";
 
@@ -54,6 +91,14 @@ set_option("include", { map {if (m/^(.*):(.*)$/) { ($1,$2) } else { ($_,1) }} (s
        if ($include);
 set_option("exclude", { map {if (m/^(.*):(.*)$/) { ($1,$2) } else { ($_,1) }} (split /[\s,]+/, $exclude) })
        if ($exclude);
+set_option("raw", $raw_sort);
+set_option("bug-rev", $bug_rev);
+set_option("pend-rev", $pend_rev);
+set_option("sev-rev", $sev_rev);
+set_option("pend-exc", $pend_exc);
+set_option("pend-inc", $pend_inc);
+set_option("sev-exc", $sev_exc);
+set_option("sev-inc", $sev_inc);
 
 my $tag;
 my @bugs;
@@ -62,8 +107,9 @@ if (defined $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 $pkg eq $d{"pkg"}}, 'package', getsrcpkgs($src))};
+  my @pkgs = getsrcpkgs($src);
+  push @pkgs, $src if ( !grep(/^\Q$src\E$/, @pkgs) );
+  @bugs = @{getbugs(sub {my %d=@_; return $pkg eq $d{"pkg"}}, 'package', @pkgs)};
 } elsif (defined $maint) {
   my %maintainers = %{getmaintainers()};
   $tag = "maintainer $maint";
@@ -132,20 +178,26 @@ if (defined $pkg || defined $src) {
     }
     my %pkgsrc = %{getpkgsrc()};
     my @pkgs = getsrcpkgs($pkg ? $pkgsrc{ $pkg } : $src);
-    @pkgs = grep( !/^$pkg$/, @pkgs ) if ( $pkg );
+    @pkgs = grep( !/^\Q$pkg\E$/, @pkgs ) if ( $pkg );
     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 "You may want to refer to the following individual bug pages:<br>\n";
        }
+       push @pkgs, $src if ( $src && !grep(/^\Q$src\E$/, @pkgs) );
        print join( ", ", map( "<A href=\"" . pkgurl($_) . "\">$_</A>", @pkgs ) );
-       print "\n";
+       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($pkg)), $pkgsrc{$pkg};
+       printf "<p>You might like to refer to the <a href=\"%s\">%s package page</a>", urlsanit("http://${debbugs::gPackagePages}/$pkg"), htmlsanit("$pkg");
+       if ($pkgsrc{ $pkg }) {
+           printf ", or to the source package <a href=\"%s\">%s</a>'s bug page.</p>\n", srcurl($pkg), htmlsanit($pkgsrc{$pkg});
+       } else {
+           printf ".\n";
+       }
     }
 } elsif (defined $maint || defined $maintenc) {
     print "<p>Note that maintainers may use different Maintainer fields for\n";