Package: reportbug Version: 4.5 Severity: normal Tags: patch Hi,
Here is a patch to run reportbug on a specific bug, instead of a package thanks to -N or --bugnumber option. Bye, Carl Chenet -- Package-specific info: ** Environment settings: DEBEMAIL="[email protected]" 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
>From a992a9ba63ce0cffa97064b8a45d3d7cebbfab31 Mon Sep 17 00:00:00 2001 From: chaica <[email protected]> Date: Wed, 12 Aug 2009 02:52:46 +0200 Subject: [PATCH] run reportbug on a specific bug --- bin/reportbug | 37 ++++++++++++++++++++++++++++++++++--- man/reportbug.1 | 3 +++ reportbug/ui/text_ui.py | 6 +++++- 3 files changed, 42 insertions(+), 4 deletions(-) diff --git a/bin/reportbug b/bin/reportbug index 68f18d0..4bd83bd 100755 --- a/bin/reportbug +++ b/bin/reportbug @@ -36,6 +36,7 @@ import commands import rfc822 import gettext import textwrap +import re from reportbug import utils from reportbug import ( @@ -77,6 +78,7 @@ except IOError: MIN_USER_ID = 250 quietly = False reporttitle= '' +foundpackage = '' # Cheat for now. # ewrite() may put stuff on the status bar or in message boxes depending on UI @@ -772,6 +774,8 @@ def main(): parser.add_option('-n', '--mh', '--nmh', action='store_const', dest='mua', help='send the report using mh/nmh', const=utils.MUA['mh']) + parser.add_option('-N', '--bugnumber', action='store_true', + dest='bugnumber',help='Specify a bug number to look for') parser.add_option('--mua', dest='mua', help='send the report using the specified mailer') parser.add_option('--mta', dest='mta', help='send the report using the ' @@ -991,6 +995,10 @@ class UI(object): rtype = self.options.type or sysinfo.get('type') attachments = self.options.attachments pgp_addr = self.options.keyid + bugnumber = self.options.bugnumber + + if bugnumber: + dontquery = True if self.options.body: body = textwrap.fill(self.options.body) @@ -1184,6 +1192,29 @@ class UI(object): issource = installed = usedavail = False status = None + exinfo = None + try: + if bugnumber: + reportre = re.compile(r'^#?(\d+)$') + match = reportre.match(package) + if match: + report = int(match.group(1)) + exinfo = ui.show_report(report, 'debian', self.options.mirrors, + self.options.http_proxy, queryonly=True, + title=VERSION, + archived=False) + if foundpackage: + package = foundpackage + if not exinfo: + dontquery = False + bugnumber = False + else: + efail("The report bug number you have provided does not match usual pattern.\n") + except NoBugs: + efail('No bug reports found.\n') + except NoReport: + efail('Exiting.\n') + if not pkgversion and self.options.querydpkg and \ sysinfo.get('query-dpkg', True): ewrite("Getting status for %s...\n", package) @@ -1378,7 +1409,7 @@ class UI(object): if not pkgversion or usedavail or (not pkgavail and not self.options.pkgversion): - if not (isvirtual or notatty): + if not bugnumber and not (isvirtual or notatty): pkgversion = ui.get_string('Please enter the version of the ' 'package this report applies to ' '(blank OK)', empty_ok=True, force_prompt=True) @@ -1474,7 +1505,8 @@ class UI(object): dontquery = True special = True - exinfo = None + + if not (dontquery or notatty or self.options.kudos): pkg, src = package, issource if self.options.query_src: @@ -1633,7 +1665,6 @@ For more details, please see: http://www.debian.org/devel/wnpp/''') subject_ok = True else: ewrite("Providing a subject is mandatory.\n") - # Check to make sure the bug still exists to avoid auto-reopens if subject and pkgversion: if not ui.yes_no('Does this bug still exist in version %s ' diff --git a/man/reportbug.1 b/man/reportbug.1 index 6c5f69f..de4634a 100644 --- a/man/reportbug.1 +++ b/man/reportbug.1 @@ -269,6 +269,9 @@ and .B mh mail systems) to edit and send it. .TP +.B \-N, \-\-bugnumber +Access only the bug report identified by its report number. +.TP .B \-o FILE, \-\-output=FILE Instead of sending an email, redirect it to the specified filename. .TP diff --git a/reportbug/ui/text_ui.py b/reportbug/ui/text_ui.py index 450d7c3..83e05fd 100644 --- a/reportbug/ui/text_ui.py +++ b/reportbug/ui/text_ui.py @@ -401,12 +401,16 @@ def show_report(number, system, mirrors, if not info: ewrite('No report available: #%s\n', number) - return + raise NoBugs + + # extract the package name + foundpackage = info[1][0].split('Package: ')[1].split('\n')[0] (title, messages) = info # save report subject in main m = sys.modules['__main__'] m.reporttitle = ' '.join(title.split()[2:]) + m.foundpackage = foundpackage current_message = 0 skip_pager = False -- 1.6.2.3
_______________________________________________ Reportbug-maint mailing list [email protected] http://lists.alioth.debian.org/mailman/listinfo/reportbug-maint
