[Reportbug-maint] Bug#222621: querybts: Could provide option to
Carl Chenet
chaica at ohmytux.com
Thu Jul 23 21:44:32 UTC 2009
Package: reportbug
Version: 4.5
Severity: normal
Tags: patch
Hi,
Here is a patch to allow "querybts --buglist package" to provide a list of the bugs for the given package.
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 67eafb04227f5a3b9e44f01abbc307a7a0ae8b9d Mon Sep 17 00:00:00 2001
From: chaica <chaica at ohmytux.com>
Date: Thu, 23 Jul 2009 23:39:20 +0200
Subject: [PATCH] querybts provides only a bug list
---
bin/querybts | 17 ++++++++++++++---
man/querybts.1 | 3 +++
reportbug/ui/text_ui.py | 17 ++++++++++++++++-
3 files changed, 33 insertions(+), 4 deletions(-)
diff --git a/bin/querybts b/bin/querybts
index 5f66f21..43b89d0 100755
--- a/bin/querybts
+++ b/bin/querybts
@@ -51,6 +51,7 @@ USAGE = ("querybts - Examine the state of a debbugs server.\n\n"
"Usage: querybts [options] {<package> | <report number> [report2] ...}\n"
"Supported options (see man page for long forms):\n"
" -A: Browse archived bugs.\n"
+ " -b: Display a bug list for the given package.\n"
" -B: Specify an alternate debbugs BTS. *\n"
" -h: Display this help message.\n"
" -s: Query for source packages rather than binary packages.\n"
@@ -66,6 +67,7 @@ def main():
use_browser = source = False
mirrors = None
mbox = False
+ buglist = False
args = utils.parse_config_files()
for option, arg in args.items():
@@ -80,11 +82,12 @@ def main():
try:
(opts, args) = getopt.getopt(
- sys.argv[1:], 'AB:hlmsuvw', ['help', 'version',
+ sys.argv[1:], 'AB:bhlmsuvw', ['help', 'version',
'bts=', 'web', 'mbox',
'archive', 'source',
'http_proxy=', 'proxy=',
- 'ui=', 'interface='])
+ 'ui=', 'interface=',
+ 'buglist'])
except getopt.error, msg:
print msg
sys.exit(1)
@@ -100,6 +103,8 @@ def main():
http_proxy = arg
elif option in ('-m', '--mbox'):
mbox = True
+ elif option in ('-b', '--buglist'):
+ buglist = True
elif option in ('--archive', '-A'):
archived = True
elif option in ('-s', '--source'):
@@ -142,6 +147,9 @@ def main():
sys.exit(1)
if use_browser:
+ if use_browser and buglist:
+ print "--mbox and --web won't work together."
+ sys.exit(1)
package = args[0]
m = re.match('^#?(\d+)$', package)
if m:
@@ -153,6 +161,9 @@ def main():
return
if mbox:
+ if mbox and buglist:
+ print "--mbox and --buglist won't work together."
+ sys.exit(1)
for bugnum in args:
m = re.match('^#?(\d+)$', bugnum)
if not m:
@@ -204,7 +215,7 @@ def main():
archived=archived)
ui.handle_bts_query(package, system, mirrors, http_proxy,
queryonly=True, title=VERSION, archived=archived,
- source=source)
+ source=source, buglist=buglist)
except NoPackage:
ui.long_message('Package appears not to exist in the BTS.\n')
except NoBugs:
diff --git a/man/querybts.1 b/man/querybts.1
index 708b57b..bf3fd31 100644
--- a/man/querybts.1
+++ b/man/querybts.1
@@ -36,6 +36,9 @@ You can specify
.B help
to get a list of supported servers.
.TP
+.B \-b, \-\-buglist
+Provide only the bug list of a given package.
+.TP
.B \-m, \-\-mbox
Retrieve the given bug number as a mailbox file, instead of viewing
it. It will be dumped to standard output.
diff --git a/reportbug/ui/text_ui.py b/reportbug/ui/text_ui.py
index e6f7360..ba1e18b 100644
--- a/reportbug/ui/text_ui.py
+++ b/reportbug/ui/text_ui.py
@@ -462,7 +462,7 @@ def show_report(number, system, mirrors,
def handle_bts_query(package, bts, mirrors=None, http_proxy="",
queryonly=False, title="", screen=None, archived='no',
- source=False, version=None):
+ source=False, version=None, buglist=None):
root = debianbts.SYSTEMS[bts].get('btsroot')
if not root:
ewrite('%s bug tracking system has no web URL; bypassing query\n',
@@ -503,6 +503,21 @@ def handle_bts_query(package, bts, mirrors=None, http_proxy="",
bug_re = re.compile(r'#(\d+) \[[^]]+\] \[[^]]+\] (.*) Reported by.*')
hierarchy_new = []
+ if buglist:
+ for entry in hierarchy:
+ # second item is a list of bugs report
+ for bug in entry[1]:
+ match = bug_re.match(bug)
+ if match:
+ # we take the info we need (bug number and subject)
+ #bugs_new.append("#" + match.group(1) + " " + match.group(2))
+ # and at the same time create a list of bug number
+ #bugs.append(int(match.group(1)))
+ msg = "#" + match.group(1) + " " + match.group(2)
+ msg = msg.encode(charset, 'replace')
+ print msg
+ sys.exit(0)
+
for entry in hierarchy:
# first item is the title of the section
entry_new = entry[0]
--
1.6.2.3
More information about the Reportbug-maint
mailing list