]> git.donarmstrong.com Git - debbugs.git/commitdiff
* Stop hard coding the path to spool in age-1
authorDon Armstrong <don@donarmstrong.com>
Thu, 25 Sep 2008 02:51:50 +0000 (19:51 -0700)
committerDon Armstrong <don@donarmstrong.com>
Thu, 25 Sep 2008 02:51:50 +0000 (19:51 -0700)
 * Fix affects usage
 * Support bugs= in pkgreport.cgi
 * Comment out CGI::Alert usage for the time being; eventually we'll
   probably replace it with an optional home-grown replacement that is
   less sucky.
 * Handle maint='' in get_bugs instead of out in pkgreport (this
   enables this search to work from soap)

Debbugs/Bugs.pm
Debbugs/CGI.pm
cgi/bugreport.cgi
cgi/pkgreport.cgi
cgi/search.cgi
debian/changelog
scripts/age-1

index 36bcc7b487e6c6c1c3d84de20c66aff68445b104..dfcb0c52ba805383593e00335ce79269cf590248 100644 (file)
@@ -430,6 +430,14 @@ sub get_bugs_by_idx{
                              );
      my %bugs = ();
 
+     # If we're given an empty maint (unmaintained packages), we can't
+     # handle it, so bail out here
+     for my $maint (make_list(exists $param{maint}?$param{maint}:[])) {
+         if (defined $maint and $maint eq '') {
+              die "Can't handle empty maint (unmaintained packages) in get_bugs_by_idx";
+         }
+     }
+
      # We handle src packages, maint and maintenc by mapping to the
      # appropriate binary packages, then removing all packages which
      # don't match all queries
@@ -532,6 +540,9 @@ sub get_bugs_flatfile{
 #                                        dist      => {type => SCALAR|ARRAYREF,
 #                                                      optional => 1,
 #                                                     },
+                                         bugs      => {type => SCALAR|ARRAYREF,
+                                                       optional => 1,
+                                                      },
                                          archive   => {type => BOOLEAN,
                                                        default => 1,
                                                       },
@@ -559,6 +570,23 @@ sub get_bugs_flatfile{
          @usertag_bugs{make_list(@{$param{usertags}}{make_list($param{tag})})
                        } = (1) x make_list(@{$param{usertags}}{make_list($param{tag})});
      }
+     my $unmaintained_packages = 0;
+     # unmaintained packages is a special case
+     for my $maint (make_list(exists $param{maint}?$param{maint}:[])) {
+         if (defined $maint and $maint eq '' and not $unmaintained_packages) {
+              $unmaintained_packages = 1;
+              our %maintainers = %{getmaintainers()};
+              $param{function} = [exists $param{function}?
+                                  (ref $param{function}?@{$param{function}}:$param{function}):(),
+                                  sub {my %d=@_;
+                                       foreach my $try (splitpackages($d{"pkg"})) {
+                                            return 1 if not exists $maintainers{$try};
+                                       }
+                                       return 0;
+                                  }
+                                 ];
+         }
+     }
      # We handle src packages, maint and maintenc by mapping to the
      # appropriate binary packages, then removing all packages which
      # don't match all queries
@@ -569,7 +597,7 @@ sub get_bugs_flatfile{
         exists $param{src} or
         exists $param{maint}) {
          delete @param{qw(maint src)};
-         $param{package} = [@packages];
+         $param{package} = [@packages] if @packages;
      }
      my $grep_bugs = 0;
      my %bugs;
@@ -577,15 +605,17 @@ sub get_bugs_flatfile{
          $bugs{$_} = 1 for make_list($param{bugs});
          $grep_bugs = 1;
      }
-     if (exists $param{owner} or exists $param{correspondent} or exists $param{affects}) {
-         $bugs{$_} = 1 for get_bugs_by_idx(exists $param{correspondent}?(correspondent => $param{correspondent}):(),
-                                           exists $param{owner}?(owner => $param{owner}):(),
-                                           exists $param{affects}?(affects => $param{affects}):(),
+     # These queries have to be handled by get_bugs_by_idx
+     if (exists $param{owner}
+        or exists $param{correspondent}
+        or exists $param{affects}) {
+         $bugs{$_} = 1 for get_bugs_by_idx(map {exists $param{$_}?($_,$param{$_}):()}
+                                           qw(owner correspondent affects),
                                           );
          $grep_bugs = 1;
      }
      my @bugs;
-     while (<$flatfile>) {
+     BUG: while (<$flatfile>) {
          next unless m/^(\S+)\s+(\d+)\s+(\d+)\s+(\S+)\s+\[\s*([^]]*)\s*\]\s+(\w+)\s+(.*)$/;
          my ($pkg,$bug,$time,$status,$submitter,$severity,$tags) = ($1,$2,$3,$4,$5,$6,$7);
          next if $grep_bugs and not exists $bugs{$bug};
@@ -629,14 +659,16 @@ sub get_bugs_flatfile{
               my @bug_tags = split ' ', $tags;
               my @packages = splitpackages($pkg);
               my $package = (@packages > 1)?\@packages:$packages[0];
-              next unless
-                   $param{function}->(pkg       => $package,
-                                      bug       => $bug,
-                                      status    => $status,
-                                      submitter => $submitter,
-                                      severity  => $severity,
-                                      tags      => \@bug_tags,
-                                     );
+              for my $function (make_list($param{function})) {
+                   next BUG unless
+                        $function->(pkg       => $package,
+                                    bug       => $bug,
+                                    status    => $status,
+                                    submitter => $submitter,
+                                    severity  => $severity,
+                                    tags      => \@bug_tags,
+                                   );
+              }
          }
          push @bugs, $bug;
      }
index 1ba47996744eeb2ec4358db4da55910e30d9ba8e..cceeb36cdddf8df589536e2c24bf604be3c5a7b4 100644 (file)
@@ -350,8 +350,10 @@ our @package_search_key_order = (package   => 'in package',
                                 submitter => 'submitted by',
                                 owner     => 'owned by',
                                 status    => 'with status',
+                                affects   => 'which affect package',
                                 correspondent => 'with mail from',
                                 newest        => 'newest bugs',
+                                bugs          => 'in bug',
                                );
 our %package_search_keys = @package_search_key_order;
 
index d01a286bf39e9097db6efc2e8f27fb0620bdab0c..f3c7ff6f59789cf00987a75d4fd9b73da05149f7 100755 (executable)
@@ -76,6 +76,11 @@ if (not defined $buglog) {
                      -type => "text/html",
                      -charset => 'utf-8',
                     );
+     print fill_in_template(template=>'cgi/no_such_bug',
+                           variables => {modify_time => strftime('%a, %e %b %Y %T UTC', gmtime),
+                                         bug_num     => $ref,
+                                        },
+                          );
      exit 0;
 }
 
index 2a69dfd1497713f05f4fa327173e186561fcb1ff..3ddad9bf17431dc1f97cd5cc192d5104a5448fe0 100755 (executable)
@@ -24,6 +24,8 @@ use Debbugs::Common qw(getparsedaddrs make_list getmaintainers getpseudodesc);
 use Debbugs::Bugs qw(get_bugs bug_filter newest_bug);
 use Debbugs::Packages qw(getsrcpkgs getpkgsrc get_versions);
 
+use Debbugs::Status qw(splitpackages);
+
 use Debbugs::CGI qw(:all);
 
 use Debbugs::CGI::Pkgreport qw(:all);
@@ -77,10 +79,15 @@ if (exists $param{form_options} and defined $param{form_options}) {
          next unless exists $param{$incexc};
          $param{$incexc} = [grep /\S\:\S/, make_list($param{$incexc})];
      }
+     for my $key (keys %package_search_keys) {
+         next unless exists $param{key};
+         $param{$key} = [map {split /\s*,\s*/} make_list($param{$key})];
+     }
      # kill off keys for which empty values are meaningless
-     for my $key (qw(package src submitter severity status dist)) {
+     for my $key (qw(package src submitter affects severity status dist)) {
          next unless exists $param{$key};
-         $param{$key} = [grep {length $_}  make_list($param{$key})];
+         $param{$key} = [grep {defined $_ and length $_}
+                         make_list($param{$key})];
      }
      print $q->redirect(munge_url('pkgreport.cgi?',%param));
      exit 0;
@@ -332,8 +339,9 @@ my @temp = @package_search_key_order;
 while (my ($key,$value) = splice @temp, 0, 2) {
      next unless exists $param{$key};
      my @entries = ();
-     $param{$key} = [map {split /\s*,\s*/} make_list($param{$key})];
-     for my $entry (grep {defined $_ and length $_ } make_list($param{$key})) {
+     for my $entry (make_list($param{$key})) {
+         # we'll handle newest below
+         next if $key eq 'newest';
          my $extra = '';
          if (exists $param{dist} and ($key eq 'package' or $key eq 'src')) {
               my %versions = get_versions(package => $entry,
@@ -358,39 +366,34 @@ while (my ($key,$value) = splice @temp, 0, 2) {
               }
               $extra= " ($verdesc)" if keys %versions;
          }
-         push @entries, $entry.$extra;
+         if ($key eq 'maint' and $entry eq '') {
+              push @entries, "no one (packages without maintainers)"
+         }
+         else {
+              push @entries, $entry.$extra;
+         }
      }
      push @title,$value.' '.join(' or ', @entries) if @entries;
 }
-my $title = $gBugs.' '.join(' and ', map {/ or /?"($_)":$_} @title);
-@title = ();
-
-# we have to special case the maint="" search, unfortunatly.
-if (defined $param{maint} and $param{maint} eq "" or ref($param{maint}) and not @{$param{maint}}) {
-     my %maintainers = %{getmaintainers()};
-     @bugs = get_bugs(function =>
-                     sub {my %d=@_;
-                          foreach my $try (splitpackages($d{"pkg"})) {
-                               return 1 if not exists $maintainers{$try};
-                          }
-                          return 0;
-                     }
-                    );
-     $title = $gBugs.' in packages with no maintainer';
-}
-elsif (defined $param{newest}) {
+if (defined $param{newest}) {
      my $newest_bug = newest_bug();
      @bugs = ($newest_bug - $param{newest} + 1) .. $newest_bug;
-     $title = @bugs.' newest '.$gBugs;
-}
-else {
-     #yeah for magick!
-     @bugs = get_bugs((map {exists $param{$_}?($_,$param{$_}):()}
-                      keys %package_search_keys, 'archive'),
-                     usertags => \%ut,
-                    );
+     push @title, 'in '.@bugs.' newest reports';
+     $param{bugs} = [exists $param{bugs}?make_list($param{bugs}):(),
+                    @bugs,
+                   ];
 }
 
+my $title = $gBugs.' '.join(' and ', map {/ or /?"($_)":$_} @title);
+@title = ();
+
+#yeah for magick!
+@bugs = get_bugs((map {exists $param{$_}?($_,$param{$_}):()}
+                 grep {$_ ne 'newest'}
+                 keys %package_search_keys, 'archive'),
+                usertags => \%ut,
+               );
+
 if (defined $param{version}) {
      $title .= " at version $param{version}";
 }
index 03d2cc571c119a1f9ee176beff32a472b887f20f..b1f5e09f84724a8b3e38377db960073d275b7ce9 100755 (executable)
@@ -14,7 +14,7 @@ BEGIN{
 
 use CGI::Simple;
 
-use CGI::Alert 'don@donarmstrong.com';
+# use CGI::Alert 'nobody@example.com';
 
 use Search::Estraier;
 use Debbugs::Config qw(:config);
index 949ef46a33283457dd7b94858bfd19561fce95ab..7e3d7685a70aeffe5058d0ae9b9a380b34af8487 100644 (file)
@@ -224,6 +224,8 @@ debbugs (2.4.2) UNRELEASED; urgency=low
     extra status box (closes: #499990) Thanks to James Vega for the patch.
   * Return 404 when a bug number that does not exist is used
     (closes: #499997)
+  * Comment out CGI::Alert use for the time being (closes: #499681)
+  * No longer hard-code paths in age-1 (closes: #499682)
 
   
  -- Colin Watson <cjwatson@debian.org>  Fri, 20 Jun 2003 18:57:25 +0100
index cc2e72da1dd91618a41553ae1477470a3c76c2b0..65c39d7f3f5516e751d66e2be93059a8ee172e0b 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # $Id: age-1.in,v 1.3 2002/01/06 10:46:24 ajt Exp $
 set -e
-cd /var/lib/debbugs/spool/db-h
+cd "$(perl -MDebbugs::Config=:config -e 'print $config{spool_dir}')"
 test -f ./-3.log && rm ./-3.log
 test -f ./-2.log && mv ./-2.log ./-3.log
 test -f ./-1.log && mv ./-1.log ./-2.log