]> git.donarmstrong.com Git - debbugs.git/blobdiff - cgi/pkgreport.cgi
pkgreport already has use warnings, does not need -T
[debbugs.git] / cgi / pkgreport.cgi
index 17203a8c61790386e2c1c883b14cd8260a159505..8733d9a3198adfb1c9defc2f7eadeccc766c3e91 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -wT
+#!/usr/bin/perl -T
 # This script is part of debbugs, and is released
 # under the terms of the GPL version 2, or any later
 # version at your option.
@@ -52,7 +52,7 @@ use Debbugs::User;
 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::Packages qw(source_to_binary binary_to_source get_versions);
 
 use Debbugs::Status qw(splitpackages);
 
@@ -93,7 +93,7 @@ our %param = cgi_parameters(query => $q,
                            single => [qw(ordering archive repeatmerged),
                                       qw(bug-rev pend-rev sev-rev),
                                       qw(maxdays mindays version),
-                                      qw(data which dist newest),
+                                      qw(data which dist),
                                       qw(noaffects),
                                      ],
                            default => $default_params,
@@ -326,28 +326,40 @@ my %strings = ();
 my @bugs;
 
 # addusers for source and binary packages being searched for
-my $pkgsrc = getpkgsrc();
-my $srcpkg = getsrcpkgs();
-for my $package (# For binary packages, add the binary package
-                # and corresponding source package
-                make_list($param{package}||[]),
-                (map {defined $pkgsrc->{$_}?($pkgsrc->{$_}):()}
-                 make_list($param{package}||[]),
-                ),
-                # For source packages, add the source package
-                # and corresponding binary packages
-                make_list($param{src}||[]),
-                (map {defined $srcpkg->{$_}?($srcpkg->{$_}):()}
-                 make_list($param{src}||[]),
-                ),
-               ) {
-     next unless defined $package;
-     add_user($package.'@'.$config{usertag_package_domain},
-             \%ut,\%bugusertags,\%seen_users,\%cats,\%hidden)
-         if defined $config{usertag_package_domain};
+if (defined $config{usertag_package_domain}) {
+    my @possible_packages;
+    if (exists $param{package} and
+       defined $param{package}
+       ) {
+       # For binary packages, add the binary package and corresponding source package
+       push @possible_packages,
+           make_list($param{package});
+       push @possible_packages,
+           binary_to_source(source_only => 1,
+                            binary=>$param{package},
+                            @schema_arg,
+                           );
+    }
+    if (exists $param{src} and
+       defined $param{src}
+       ) {
+       # For source packages, add the source package and corresponding binary packages
+       push @possible_packages,
+           make_list($param{src});
+       push @possible_packages,
+           source_to_binary(binary_only => 1,
+                            source => $param{src},
+                            dist => [@{$config{distributions}}],
+                            @schema_arg,
+                           );
+    }
+    for my $package (@possible_packages) {
+       next unless defined $package and length $package;
+       add_user($package.'@'.$config{usertag_package_domain},
+                \%ut,\%bugusertags,\%seen_users,\%cats,\%hidden);
+    }
 }
 
-
 # walk through the keys and make the right get_bugs query.
 
 my $form_option_variables = {};
@@ -361,7 +373,6 @@ while (my ($key,$value) = splice @temp, 0, 2) {
      my @entries = ();
      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,
@@ -370,6 +381,7 @@ while (my ($key,$value) = splice @temp, 0, 2) {
                                           ($key eq 'src'?(arch => q(source)):()),
                                           no_source_arch => 1,
                                           return_archs => 1,
+                                          @schema_arg,
                                          );
               my $verdesc;
               if (keys %versions > 1) {
@@ -393,15 +405,11 @@ while (my ($key,$value) = splice @temp, 0, 2) {
               push @entries, $entry.$extra;
          }
      }
-     push @title,$value.' '.join(' or ', @entries) if @entries;
-}
-if (defined $param{newest}) {
-     my $newest_bug = newest_bug();
-     @bugs = ($newest_bug - $param{newest} + 1) .. $newest_bug;
-     push @title, 'in '.@bugs.' newest reports';
-     $param{bugs} = [exists $param{bugs}?make_list($param{bugs}):(),
-                    @bugs,
-                   ];
+     if ($key eq 'newest') {
+        push @title, 'in '.join(' or ',@entries).' newest reports';
+     } else {
+        push @title,$value.' '.join(' or ', @entries) if @entries;
+     }
 }
 
 my $title = $gBugs.' '.join(' and ', map {/ or /?"($_)":$_} @title);
@@ -409,7 +417,6 @@ my $title = $gBugs.' '.join(' and ', map {/ or /?"($_)":$_} @title);
 
 #yeah for magick!
 @bugs = get_bugs((map {exists $param{$_}?($_,$param{$_}):()}
-                 grep {$_ ne 'newest'}
                  keys %package_search_keys, 'archive'),
                 usertags => \%ut,
                 @schema_arg,