]> git.donarmstrong.com Git - debbugs.git/blobdiff - Debbugs/Bugs.pm
Stop URLs at " too. Thanks to Vincent Lefevre (Closes: #766354).
[debbugs.git] / Debbugs / Bugs.pm
index e16ef83a0e9a7a66b829cb9f7021d848e41ccbde..e4f8cc8825e7fc887949a17c213d2a3115e7f548 100644 (file)
@@ -55,7 +55,7 @@ use Params::Validate qw(validate_with :types);
 use IO::File;
 use Debbugs::Status qw(splitpackages get_bug_status);
 use Debbugs::Packages qw(getsrcpkgs getpkgsrc);
-use Debbugs::Common qw(getparsedaddrs getmaintainers getmaintainers_reverse make_list);
+use Debbugs::Common qw(getparsedaddrs package_maintainer getmaintainers make_list);
 use Fcntl qw(O_RDONLY);
 use MLDBM qw(DB_File Storable);
 use List::Util qw(first);
@@ -325,7 +325,7 @@ sub bug_filter {
                                                          optional => 1,
                                                         },
                                          repeat_merged => {type => BOOLEAN,
-                                                           optional => 1,
+                                                           default => 1,
                                                           },
                                          include => {type => HASHREF,
                                                      optional => 1,
@@ -572,20 +572,27 @@ sub get_bugs_flatfile{
      }
      my $unmaintained_packages = 0;
      # unmaintained packages is a special case
-     for my $maint (make_list(exists $param{maint}?$param{maint}:[])) {
+     my @maints = make_list(exists $param{maint}?$param{maint}:[]);
+     $param{maint} = [];
+     for my $maint (@maints) {
          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}):(),
+              $param{function} = [(exists $param{function}?
+                                   (ref $param{function}?@{$param{function}}:$param{function}):()),
                                   sub {my %d=@_;
-                                       foreach my $try (splitpackages($d{"pkg"})) {
+                                       foreach my $try (make_list($d{"pkg"})) {
+                                            next unless length $try;
+                                            ($try) = $try =~ m/^(?:src:)?(.+)/;
                                             return 1 if not exists $maintainers{$try};
                                        }
                                        return 0;
                                   }
                                  ];
          }
+         elsif (defined $maint and $maint ne '') {
+              push @{$param{maint}},$maint;
+         }
      }
      # We handle src packages, maint and maintenc by mapping to the
      # appropriate binary packages, then removing all packages which
@@ -616,7 +623,7 @@ sub get_bugs_flatfile{
      }
      my @bugs;
      BUG: while (<$flatfile>) {
-         next unless m/^(\S+)\s+(\d+)\s+(\d+)\s+(\S+)\s+\[\s*([^]]*)\s*\]\s+(\w+)\s+(.*)$/;
+         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};
          if (exists $param{package}) {
@@ -735,10 +742,8 @@ sub __handle_pkg_src_and_maint{
      }
      if (exists $param{maint}) {
          my $key_inc = 0;
-         my $maint_rev = getmaintainers_reverse();
          my %_temp_p = ();
-         for my $package (map { exists $maint_rev->{$_}?@{$maint_rev->{$_}}:()}
-                          make_list($param{maint})) {
+         for my $package (package_maintainer(maintainer=>$param{maint})) {
               $packages{$package}++ unless exists $_temp_p{$package};
               $_temp_p{$package} = 1;
               $key_inc = 1;
@@ -770,7 +775,11 @@ sub __bug_matches {
     my ($hash, $status) = @_;
     foreach my $key( keys( %$hash ) ) {
         my $value = $hash->{$key};
+       next unless exists $field_match{$key};
        my $sub = $field_match{$key};
+       if (not defined $sub) {
+           die "No defined subroutine for key: $key";
+       }
        return 1 if ($sub->($key, $value, $status));
     }
     return 0;