lp-list-bugs: New tool.

This commit is contained in:
Colin Watson 2010-09-17 12:45:52 +01:00
parent bee6f01c4a
commit 0de4797ce0
4 changed files with 101 additions and 10 deletions

1
debian/changelog vendored
View File

@ -33,6 +33,7 @@ ubuntu-dev-tools (0.102) UNRELEASED; urgency=low
[ Colin Watson ]
* Fix NAME section of lp-set-dup(1).
* lp-list-bugs: New tool.
-- Benjamin Drung <bdrung@ubuntu.com> Fri, 17 Sep 2010 04:42:53 +0200

22
debian/copyright vendored
View File

@ -7,6 +7,7 @@ Upstream Authors:
Albin Tonnerre <lut1n.tne@gmail.com>
Benjamin Drung <bdrung@ubuntu.com>
Bryce Harrington <bryce@ubuntu.com>
Colin Watson <cjwatson@ubuntu.com>
Daniel Hahler <ubuntu@thequod.de>
Daniel Holbach <daniel.holbach@ubuntu.com>
Dustin Kirkland <kirkland@ubuntu.com>
@ -33,7 +34,7 @@ Upstream Authors:
Copyright:
(C) 2006-2009, Canonical Ltd.
(C) 2006-2010, Canonical Ltd.
(C) 2007, Albert Damen <albrt@gmx.net>
(C) 2006-2007, Albin Tonnerre <lut1n.tne@gmail.com>
© 2010, Benjamin Drung <bdrung@ubuntu.com>
@ -78,10 +79,11 @@ On Debian and Ubuntu systems, the complete text of the GNU General Public
License v2 can be found in `/usr/share/common-licenses/GPL-2'.
dch-repeat, errno, get-branches, get-build-deps, grab-attachments, grab-merge,
hugdaylist, manage-credentials, massfile, merge-changelog, mk-sbuild,
pbuilder-dist-simple, pull-debian-debdiff, pull-debian-source, pull-lp-source,
pull-revu-source, setup-packaging-environment, suspicious-source, ubuntu-build
and what-patch are licensed under the GNU General Public License, version 3:
hugdaylist, lp-list-bugs, manage-credentials, massfile, merge-changelog,
mk-sbuild, pbuilder-dist-simple, pull-debian-debdiff, pull-debian-source,
pull-lp-source, pull-revu-source, setup-packaging-environment,
suspicious-source, ubuntu-build and what-patch are licensed under the GNU
General Public License, version 3:
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -97,8 +99,8 @@ License v3 can be found in `/usr/share/common-licenses/GPL-3'.
The following scripts can be used, at your option, regarding any later
version of the previously specified license: 404main, dch-repeat, dgetlp,
get-build-deps, import-bug-from-debian, lp-project-upload, lp-set-dup,
manage-credentials, mk-sbuild-lv, pbuilder-dist, pull-debian-debdiff,
pull-debian-source, pull-lp-source, pull-revu-source, reverse-build-depends,
setup-packaging-environment, submittodebian, suspicious-source, syncpackage,
ubuntu-build, what-patch.
get-build-deps, import-bug-from-debian, lp-list-bugs, lp-project-upload,
lp-set-dup, manage-credentials, mk-sbuild-lv, pbuilder-dist,
pull-debian-debdiff, pull-debian-source, pull-lp-source, pull-revu-source,
reverse-build-depends, setup-packaging-environment, submittodebian,
suspicious-source, syncpackage, ubuntu-build, what-patch.

27
doc/lp-list-bugs.1 Normal file
View File

@ -0,0 +1,27 @@
.TH lp\-list\-bugs 1 2010-09-17 ubuntu-dev-tools
.SH NAME
lp\-list\-bugs \- briefly list status of Launchpad bugs
.SH DESCRIPTION
.B lp\-list\-bugs
takes one or more Launchpad bug numbers, and lists the status of each bug in a
concise format.
For example:
.PP
.RS
.nf
$ lp\-list\-bugs 3
Bug 3: Custom information for each translation team
rosetta: Fix Released
ubuntu: Invalid
mono (Ubuntu): Invalid
.fi
.RE
.SH OPTIONS
.TP
.BR \-h ", " \-\-help
Display a help message and exit.
.SH AUTHORS
.B lp\-list\-bugs
and this manual page were written by Colin Watson <cjwatson@ubuntu.com>.
Both are released under the terms of the GNU General Public License, version
3 or later.

61
lp-list-bugs Executable file
View File

@ -0,0 +1,61 @@
#! /usr/bin/python
# -*- coding: UTF-8 -*-
"""Briefly list status of Launchpad bugs."""
# Copyright (c) 2010 Canonical Ltd.
#
# lp-set-dup is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 3, or (at your option) any
# later version.
#
# lp-set-dup is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with lp-set-dup; see the file COPYING. If not, write to the Free
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
# 02110-1301, USA.
#
# Authors:
# Colin Watson <cjwatson@ubuntu.com>
import sys
from optparse import OptionParser
from ubuntutools.lp.libsupport import get_launchpad
from launchpadlib.errors import HTTPError
if __name__ == '__main__':
usage = "Usage: %prog <bug> [...]"
parser = OptionParser(usage)
options, args = parser.parse_args()
if len(args) < 1:
parser.error("Need at least one bug number")
try:
lp = get_launchpad('ubuntu-dev-tools')
except Exception, e:
print >>sys.stderr, 'Could not connect to Launchpad:', str(e)
sys.exit(2)
for bugnum in args:
try:
bug = lp.bugs[bugnum]
print "Bug %s: %s" % (bugnum, bug.title)
for task in bug.bug_tasks:
print " %s: %s" % (task.bug_target_name, task.status)
except HTTPError, e:
if e.response.status == 401:
print >>sys.stderr, \
("E: Don't have enough permissions to access bug %s" %
bugnum)
print >>sys.stderr, e.content
continue
elif e.response.status == 404:
print >>sys.stderr, "E: Bug %s not found" % bugnum
else:
raise