]> git.donarmstrong.com Git - debbugs.git/commitdiff
allow specifying the dist in source_to_binary (for DB actions)
authorDon Armstrong <don@donarmstrong.com>
Sat, 14 Apr 2018 00:04:18 +0000 (17:04 -0700)
committerDon Armstrong <don@donarmstrong.com>
Sat, 14 Apr 2018 00:04:18 +0000 (17:04 -0700)
Debbugs/CGI/Pkgreport.pm
Debbugs/Packages.pm

index 01e661f30d987fff3cee189cab1803e6c1a4607d..4adb3628b1650deffad16b62c5090380a64c7d89 100644 (file)
@@ -119,7 +119,15 @@ sub generate_package_info{
               "This means that this package no longer exists (or never existed). ".
                   "Please do not report new bugs against this package. </p>\n";
      }
-     my @pkgs = getsrcpkgs($srcforpkg);
+     my @pkgs = source_to_binary(source => $srcforpkg,
+                                hash_slice(%param,qw(schema)),
+                                binary_only => 1,
+                                # if there are distributions, only bother to
+                                # show packages which are currently in a
+                                # distribution.
+                                @{$config{distributions}//[]} ?
+                                (dist => [@{$config{distributions}}]) : (),
+                               );
      @pkgs = grep( !/^\Q$package\E$/, @pkgs );
      if ( @pkgs ) {
          @pkgs = sort @pkgs;
index 6762d9aba4cbc2f9544331d9580b87c32e1a23dc..936bd76688b867ae9d9d3f6c660687d651746c80 100644 (file)
@@ -404,8 +404,8 @@ empty list in list context.
 =item version -- binary package version(s) as a SCALAR or ARRAYREF;
 optional, defaults to all versions.
 
-=item arch -- binary package architecture(s) as a SCALAR or ARRAYREF;
-optional, defaults to all architectures.
+=item dist -- list of distributions to return corresponding binary packages for
+as a SCALAR or ARRAYREF.
 
 =item binary_only -- return only the source name (forced on if in SCALAR
 context), defaults to false. [If in LIST context, returns a list of binary
@@ -430,6 +430,9 @@ sub source_to_binary{
                                         version => {type => SCALAR|ARRAYREF,
                                                     optional => 1,
                                                    },
+                                        dist => {type => SCALAR|ARRAYREF,
+                                                 optional => 1,
+                                                },
                                         binary_only => {default => 0,
                                                        },
                                         scalar_only => {default => 0,
@@ -477,6 +480,18 @@ sub source_to_binary{
                          distinct => 1,
                         },
                         );
+           if (exists $param{dist}) {
+               $bin_rs = $bin_rs->
+                   search({-or =>
+                          {'suite.codename' => [make_list($param{dist})],
+                           'suite.suite_name' => [make_list($param{dist})],
+                          }},
+                          {join => {'bin_vers' =>
+                                   {'bin_associations' =>
+                                    'suite'
+                                   }},
+                           });
+           }
            push @binaries,
                map {$_->{pkg}} $bin_rs->all;
            if ($param{scalar_only}) {