[Reportbug-maint] Bug#304006: would be useful to add tags also after writing the report

Carl Chenet chaica at ohmytux.com
Mon Jul 27 21:58:36 UTC 2009


Package: reportbug
Version: 4.5
Severity: normal
Tags: patch

Hi,

Here is a new patch. It should be ok this time.

Bye,
Carl Chenet

-- Package-specific info:
** Environment settings:
DEBEMAIL="chaica at ohmytux.com"
DEBFULLNAME="Carl Chenet"
INTERFACE="text"

** /home/chaica/.reportbugrc:
reportbug_version "4.5"
mode novice
ui text
smtphost "smtp.free.fr"

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.26-1-686 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages reportbug depends on:
ii  apt                           0.7.21     Advanced front-end for dpkg
ii  python                        2.5.4-2    An interactive high-level object-o
ii  python-reportbug              4.5        Python modules for interacting wit

reportbug recommends no packages.

Versions of packages reportbug suggests:
pn  debconf-utils                 <none>     (no description available)
ii  debsums                       2.0.44     verification of installed package 
pn  dlocate                       <none>     (no description available)
ii  exim4                         4.69-9     metapackage to ease Exim MTA (v4) 
ii  exim4-daemon-light [mail-tran 4.69-9     lightweight Exim MTA (v4) daemon
ii  file                          5.00-1     Determines file type using "magic"
ii  gnupg                         1.4.9-4    GNU privacy guard - a free PGP rep
pn  python-gnome2-extras          <none>     (no description available)
pn  python-gtk2                   <none>     (no description available)
pn  python-urwid                  <none>     (no description available)
pn  python-vte                    <none>     (no description available)

-- no debconf information
-------------- next part --------------
>From 91cf0e3dc8a085f99dda2a6e5b3ed62aa4ab8f19 Mon Sep 17 00:00:00 2001
From: chaica <chaica at ohmytux.com>
Date: Mon, 27 Jul 2009 23:50:55 +0200
Subject: [PATCH] add tags in the last menu v2

---
 bin/reportbug |   45 +++++++++++++++++++++++++++++++++++++--------
 1 files changed, 37 insertions(+), 8 deletions(-)

diff --git a/bin/reportbug b/bin/reportbug
index 7d71023..d2f99c1 100755
--- a/bin/reportbug
+++ b/bin/reportbug
@@ -75,7 +75,6 @@ except IOError:
 
 # Magic constant time
 MIN_USER_ID = 250
-
 quietly = False
 reporttitle= ''
 
@@ -145,11 +144,12 @@ def include_file_in_report(message, message_filename,
     return (message, message_filename, attachment_filenames)
 
 def handle_editing(filename, dmessage, options, sendto, attachments, package,
-                   editor=None, charset='utf-8'):
+                   severity, editor=None, charset='utf-8', tags=''):
     if not editor:
         editor = options.editor
     editor = utils.which_editor(editor)
     message = None
+    patch = False
     skip_editing = False
     while True:
         if not skip_editing:
@@ -189,10 +189,10 @@ def handle_editing(filename, dmessage, options, sendto, attachments, package,
         if not subject:
             ui.long_message('No subject found in message.  Please edit again.\n')
 
-        menuopts = "Ynaceilmpqd"
+        menuopts = "Ynaceilmpqdt"
 
         if not changed or not subject:
-            menuopts = "ynacEilmpqd"
+            menuopts = "ynacEilmpqdt"
 
         # cfr Debian BTS #293361
         if package == 'wnpp':
@@ -219,7 +219,8 @@ def handle_editing(filename, dmessage, options, sendto, attachments, package,
                                'c': "Change editor and re-edit.",
                                'e': 'Re-edit the bug report.',
                                'l': 'Pipe the message through the pager.',
-                               'p': 'Print message to stdout.',
+                               'p': 'print message to stdout.',
+                               't': 'Add tags.',
                                'm': "Choose a mailer to edit the report."})
 
         if x in ('a', 'i'):
@@ -287,6 +288,31 @@ def handle_editing(filename, dmessage, options, sendto, attachments, package,
                 os.popen(pager, 'w').write(message.encode(charset, 'replace'))
             else:
                 sys.stdout.write(message.encode(charset, 'replace'))
+        elif x == 't':
+            newtaglist = []
+            skip_editing = True
+            ntags = debianbts.TAGS
+            tagorder = debianbts.TAGLIST
+            newtaglist = ui.select_multiple(
+                'Do any of the following apply to this report?', ntags,
+                'Please select tags: ', order=tagorder,
+                extras=debianbts.EXTRA_TAGS)
+            if newtaglist:
+                oldtags = ''
+                newtags = ''
+                if tags:
+                    oldtags = 'Tags: ' + tags
+                    newtaglist += tags.split()
+                    # suppress twins in the tag list
+                    newtaglist = list(set(newtaglist))
+                    newtags = 'Tags: ' + ' '.join(newtaglist)
+                else:
+                    oldtags = 'Severity: ' + severity + '\n'
+                    newtags = oldtags + 'Tags: ' + ' '.join(newtaglist) + '\n'
+                if 'patch' in newtaglist:
+                    patch = True
+                message = message.replace(oldtags, newtags)
+                open(filename, 'w').write(message.encode(charset, 'replace'))
         elif x == 'y':
             if message == dmessage:
                 x = ui.select_options(
@@ -305,7 +331,7 @@ def handle_editing(filename, dmessage, options, sendto, attachments, package,
             else:
                 break
 
-    return open(filename).read()
+    return open(filename).read(), patch
 
 def find_package_for(filename, notatty=False, pathonly=False):
     ewrite("Finding package for '%s'...\n", filename)
@@ -1851,9 +1877,12 @@ For more details, please see: http://www.debian.org/devel/wnpp/''')
             fh.close()
             oldmua = mua or self.options.mua
             if not self.options.body and not self.options.bodyfile:
-                message = handle_editing(filename, message, self.options,
+                message, haspatch = handle_editing(filename, message, self.options,
                                          sendto, attachments, package,
-                                         charset=charset)
+                                         severity, charset=charset, tags=tags)
+                if haspatch:
+                    patch = True    
+
             if not oldmua and self.options.mua:
                 mua = self.options.mua
             if mua:
-- 
1.6.2.3



More information about the Reportbug-maint mailing list