Control: tags -1 patch

On Wed, Nov 14, 2012 at 04:08:32AM +0200, Bob Bib wrote:
> Package: bugs.debian.org
> Followup-For: Bug #636689
>
> Andreas Beckmann,
> I second that.
>
> Here are some current examples:
>
> 1) bug #678289: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=678289
> shown at the affected binary package bug list: http://bugs.debian.org/cgi-
> bin/pkgreport.cgi?package=pcmanfm
> but not at the source one: http://bugs.debian.org/cgi-
> bin/pkgreport.cgi?src=pcmanfm
>
> 2) bug #686843: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=686843
> shown here: http://bugs.debian.org/cgi-bin/pkgreport.cgi?package=wine
> but not there: http://bugs.debian.org/cgi-bin/pkgreport.cgi?src=wine

I have attached a patch which hopefully fixes this. I have only tested
it by extracting the new function to a separate perl script; it may or
may not function incorrectly as-is, so beware!

Regards,
James
>From ad7ade559908b4a8609cf136add743c664697f31 Mon Sep 17 00:00:00 2001
From: James Clarke <jrt...@jrtc27.com>
Date: Sun, 29 Jan 2017 22:01:26 +0000
Subject: [PATCH] Show affects on binary packages for source packages

Closes: #636689
---
 Debbugs/Bugs.pm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/Debbugs/Bugs.pm b/Debbugs/Bugs.pm
index e678aff..57206ae 100644
--- a/Debbugs/Bugs.pm
+++ b/Debbugs/Bugs.pm
@@ -450,6 +450,9 @@ sub get_bugs_by_idx{
          delete @param{qw(maint src)};
          $param{package} = [@packages];
      }
+     if (exists $param{affects}) {
+         $param{affects} = __handle_affects((affects,$param{affects}));
+     }
      my $keys = grep {$_ !~ /^(archive|usertags|bugs)$/} keys(%param);
      die "Need at least 1 key to search by" unless $keys;
      my $arc = $param{archive} ? '-arc':'';
@@ -753,6 +756,25 @@ sub __handle_pkg_src_and_maint{
      return grep {$packages{$_} >= $package_keys} keys %packages;
 }
 
+sub __handle_affects {
+     my %param = validate_with(params => \@_,
+                              spec   => {affects   => {type => SCALAR|ARRAYREF,
+                                                       optional => 0,
+                                                      },
+                                        },
+                              allow_extra => 1,
+                             );
+
+     my @affects = make_list($param{affects});
+     my %affects;
+     @affects{@affects} = (1) x @affects;
+     for my $affect ((make_list(map {my $key=$_;
+                                    $key =~ /^src:(.*)$/?getsrcpkgs($_):$key} 
make_list($param{affects})))) {
+         $affects{$affect} = 1;
+     }
+     return keys %affects;
+}
+
 my %field_match = (
     'subject' => \&__contains_field_match,
     'tags' => sub {
-- 
2.11.0

Reply via email to