Package: reportbug
Version: 6.3.1
Severity: wishlist
Tags: patch

Hi,

It would be much appreciated if reportbug could assist reporters by
generating "ben" files for transition bugs.  I have developed a
prototype patch that seems to work reasonable and that can be used as
a basis for this.

For testing, I have tried to use it to generate the current APT ben
file[1].  It can be done by following [2].

The generated files are only intended for the "common cases".  In
"rare cases", people may need to use some of the additional
functionality provided by ben (e.g. the "edos checks").
  I think it would be fine to as them to fill out the fields manaully
for now.

~Niels

[1] Generated result:

"""
Ben file:

title = "apt";
is_affected = .depends ~ /libapt-pkg4.10|libapt-inst1.2/ | .depends ~ "libept1" 
| .depends ~ /libapt-pkg4.12|libapt-inst1.5|libept1.4.12/;
is_good = .depends ~ /libapt-pkg4.12|libapt-inst1.5|libept1.4.12/;
is_bad = .depends ~ /libapt-pkg4.10|libapt-inst1.2/ | .depends ~ "libept1";

"""

[2]

"""

[...]

Choose the request type: 8
Please enter the name of the package: apt
[...]

To assist the release team, please fill in the following
information. You will be asked to provide package names of the library
package(s) that are the source of the transition. If more than one
library is changing the name, please use a space separated
list. Alternatively you can use a regex by enclosing the regex in
slashes ("/"). Please ensure that the "old" regex does not match the
"new" packages.

Please enter old binary package name of the library (or a regex matching 
it):/libapt-pkg4.10|libapt-inst1.2/ libept1
Please enter new binary package name of the library (or a regex matching 
it):/libapt-pkg4.12|libapt-inst1.5|libept1.4.12/

[...]

"""
>From 5ef9469591107370a8edf8efd955b04fcac34955 Mon Sep 17 00:00:00 2001
From: Niels Thykier <ni...@thykier.net>
Date: Sun, 13 May 2012 10:40:14 +0200
Subject: [PATCH] debbugs.py: Generate a ben file for transition bugs

Signed-off-by: Niels Thykier <ni...@thykier.net>
---
 reportbug/debbugs.py |   47 ++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 46 insertions(+), 1 deletion(-)

diff --git a/reportbug/debbugs.py b/reportbug/debbugs.py
index 659f7dc..81d752e 100644
--- a/reportbug/debbugs.py
+++ b/reportbug/debbugs.py
@@ -496,7 +496,52 @@ def handle_debian_release(package, bts, ui, fromaddr, timeout, online=True, http
         body    = "nmu %s_%s . %s . -m \"%s\"\n" % (package, version, archs or "ALL", reason)
     elif tag == 'transition':
         subject = 'transition: %s' % (package)
-        body    = '(please explain about the transition: impacted packages, reason, ...)\n'
+        body    = '(please explain about the transition: impacted packages, reason, ...\n' \
+                  ' for more info see: https://wiki.debian.org/Teams/ReleaseTeam/Transitions)\n'
+        affected = '<Fill out>'
+        good = '<Fill out>'
+        bad = '<Fill out>'
+
+        ui.long_message('To assist the release team, please fill in the following information. '
+                        'You will be asked to provide package names of the library package(s) '
+                        'that are the source of the transition.  If more than one library is '
+                        'changing the name, please use a space separated list.  Alternatively '
+                        'you can use a regex by enclosing the regex in slashes ("/").  Please '
+                        'ensure that the "old" regex does not match the "new" packages.')
+
+        prompt = 'Please enter old binary package name of the library (or a regex matching it):'
+        tfrom = ui.get_string(prompt)
+        if tfrom:
+            prompt = 'Please enter new binary package name of the library (or a regex matching it):'
+            tto = ui.get_string(prompt)
+        else:
+            tto = None
+        if tfrom and tto:
+            # Compute a ben file from this.
+
+            # (quote if x does not start with a "/")
+            quote=lambda x: (x[0] == '/' and x) or '"%s"' % x
+
+            listbad = [quote(x) for x in tfrom.strip().split()]
+            listgood = [quote(x) for x in tto.strip().split()]
+
+            j = " | .depends ~ ".join
+            affected = ".depends ~ " + j(listbad + listgood)
+            good = ".depends ~ " + j(listgood)
+            bad = ".depends ~ " + j(listbad)
+
+
+        body += textwrap.dedent(u"""\
+
+               Ben file:
+
+               title = "%s";
+               is_affected = %s;
+               is_good = %s;
+               is_bad = %s;
+
+               """ % (package, affected, good, bad))
+
     elif tag == 'britney':
         subject = subject_britney
         body = ''
-- 
1.7.10

Reply via email to