[Reportbug-maint] Bug#304006: It would be useful to add tags also after writing the report
Carl Chenet
chaica at ohmytux.com
Sun Jul 19 20:57:49 UTC 2009
Package: reportbug
Version: 4.5
Severity: normal
Tags: patch
Hi, This is a patch in order to allow users to provide tags in the last reportbug menu.
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 746b08063eb5560522b381e74078db7dbf3e3f89 Mon Sep 17 00:00:00 2001
From: chaica <chaica at bureau.(none)>
Date: Sat, 18 Jul 2009 16:44:45 +0200
Subject: [PATCH] add tags in the last menu
---
bin/reportbug | 42 +++++++++++++++++++++++++++++++++++++-----
1 files changed, 37 insertions(+), 5 deletions(-)
diff --git a/bin/reportbug b/bin/reportbug
index ff48d77..8ddb3d5 100755
--- a/bin/reportbug
+++ b/bin/reportbug
@@ -74,7 +74,8 @@ except IOError:
# Magic constant time
MIN_USER_ID = 250
-
+# Store tags given in the last reportbug menu
+NEWTAGLIST = []
quietly = False
# Cheat for now.
@@ -187,10 +188,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':
@@ -217,7 +218,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 a tag.',
'm': "Choose a mailer to edit the report."})
if x in ('a', 'i'):
@@ -279,12 +281,25 @@ def handle_editing(filename, dmessage, options, sendto, attachments, package,
stopmsg(filename)
sys.exit(1)
elif x in ('l', 'p'):
- skip_editing = True
+ skip_editing = true
if x == 'l':
pager = os.environ.get('PAGER', 'sensible-pager')
os.popen(pager, 'w').write(message.encode(charset, 'replace'))
else:
sys.stdout.write(message.encode(charset, 'replace'))
+ elif x == 't':
+ global NEWTAGLIST
+ skip_editing = True
+ tags = debianbts.TAGS
+ tagorder = debianbts.TAGLIST
+ #newtaglist = []
+ #newtaglist = ui.select_multiple(
+ NEWTAGLIST = ui.select_multiple(
+ 'Do any of the following apply to this report?', tags,
+ 'Please select tags: ', order=tagorder,
+ extras=debianbts.EXTRA_TAGS)
+ #for newtag in newtaglist:
+ # NEWTAGLIST.append(newtag)
elif x == 'y':
if message == dmessage:
x = ui.select_options(
@@ -1832,6 +1847,23 @@ For more details, please see: http://www.debian.org/devel/wnpp/''')
message = handle_editing(filename, message, self.options,
sendto, attachments, package,
charset=charset)
+ # include new tags defined in the last reportbug menu
+ global NEWTAGLIST
+ 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'
+
+ message = message.replace(oldtags, newtags)
+
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