Control: tags -1 + patch

On Wed, 09 Nov 2011 13:54:31 +0100 Didier Raboud wrote:

> I think that when filing "RM" bugs for source packages, reportbug 
> could automatically add those pseudo-headers:
> 
> X-Debbugs-CC: ${src:package}@packages.debian.org
> Control: affects -1 + src:${src:package}

I prepared the attached patch, which fixes this bug #648185 and also
bug #692995 about doing the same for release.d.o unblock bugs, as well
as adding the same headers for all other release.d.o package related
bugs. The release team haven't yet approved this approach though.

-- 
bye,
pabs

https://wiki.debian.org/PaulWise
From 1f8366ea32dc4792b06e6cc6f980916c05f4861e Mon Sep 17 00:00:00 2001
From: Paul Wise <p...@debian.org>
Date: Sun, 28 Aug 2022 08:30:29 +0800
Subject: [PATCH] Notify packages of bugs against pseudo-packages that affect
 them

X-Debbugs-CC the @packages.debian.org address for the source package so that
the primary maintainer address and anyone subscribed to that address or to the
package itself will get a mail containing the bug report.

Also mark the bugs as affecting the source package, so that people who aren't
subscribed to the maintainer/package will notice the bug reports too.

Implements: https://bugs.debian.org/692995
Implements: https://bugs.debian.org/648185
---
 reportbug/debbugs.py | 13 +++++++++++--
 test/test_debbugs.py |  8 +++++++-
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/reportbug/debbugs.py b/reportbug/debbugs.py
index dd74aac..bba4efc 100644
--- a/reportbug/debbugs.py
+++ b/reportbug/debbugs.py
@@ -254,6 +254,11 @@ def check_package_info(package):
 
     return None
 
+def add_affects_package(info):
+    src_pkg = info[12] or package
+    pseudos.append('Control: affects -1 + src:%s' % src_pkg)
+    pseudos.append('X-Debbugs-Cc: %s...@packages.debian.org' % src_pkg)
+    ui.log_message('Your report will be carbon-copied to the package maintainer.\n')
 
 def handle_debian_ftp(package, bts, ui, fromaddr, timeout, online=True, http_proxy=None):
     """
@@ -347,6 +352,8 @@ def handle_debian_ftp(package, bts, ui, fromaddr, timeout, online=True, http_pro
         else:
             section, priority = info[16], info[10]
 
+            add_affects_package(info)
+
     if tag == 'override':
         pseudos.append('User: ftp.debian....@packages.debian.org')
         pseudos.append('Usertags: override')
@@ -593,6 +600,8 @@ def handle_debian_release(package, bts, ui, fromaddr, timeout, online=True, http
                        'n': 'Exit without filing a report.'})
             if cont == 'n':
                 sys.exit(1)
+        else:
+            add_affects_package(info)
 
     if tag in ('binnmu', 'unblock', stable_pu, oldstable_pu, 'rm'):
         if tag.endswith('-pu'):
@@ -951,6 +960,8 @@ def handle_wnpp(package, bts, ui, fromaddr, timeout, online=True, http_proxy=Non
             package = info[12] or package
             long_desc = info[13]
 
+            add_affects_package(info)
+
         if tag == 'O' and info and info[9] in \
                 ('required', 'important', 'standard'):
             severity = 'important'
@@ -971,8 +982,6 @@ def handle_wnpp(package, bts, ui, fromaddr, timeout, online=True, http_proxy=Non
                     'The package description is:\n') % (orphstr, package)
             body = body + long_desc + '\n'
 
-        pseudos.append(f'Control: affects -1 src:{package}')
-
     if short_desc:
         subject = '%s: %s -- %s' % (tag, package, short_desc)
     else:
diff --git a/test/test_debbugs.py b/test/test_debbugs.py
index 3e507f9..b5495e9 100644
--- a/test/test_debbugs.py
+++ b/test/test_debbugs.py
@@ -45,6 +45,8 @@ class TestSpecials(unittest.TestCase):
                 [
                     'User: ftp.debian....@packages.debian.org',
                     'Usertags: remove',
+                    'Control: affects -1 + src:reportbug',
+                    'X-Debbugs-Cc: report...@packages.debian.org',
                 ],
                 '', False
             )
@@ -53,7 +55,11 @@ class TestSpecials(unittest.TestCase):
             debbugs.handle_debian_ftp('reportbug', '', MockUI('override', 'reportbug', 'utils', 'important', None), None, 60),
             (
                 'override: reportbug:utils/important', 'normal', [],
-                ['User: ftp.debian....@packages.debian.org', 'Usertags: override', 'X-Debbugs-Cc: debian-b...@lists.debian.org'],
+                [
+                    'Control: affects -1 + src:reportbug',
+                    'X-Debbugs-Cc: report...@packages.debian.org',
+                    'X-Debbugs-Cc: debian-b...@lists.debian.org',
+                ],
                 '(Describe here the reason for this change)', False
             )
         )
-- 
2.37.2

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to