From 0de4797ce054196a97eecf9df31d17347abdc2e9 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Fri, 17 Sep 2010 12:45:52 +0100 Subject: [PATCH] lp-list-bugs: New tool. --- debian/changelog | 1 + debian/copyright | 22 +++++++++-------- doc/lp-list-bugs.1 | 27 ++++++++++++++++++++ lp-list-bugs | 61 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 101 insertions(+), 10 deletions(-) create mode 100644 doc/lp-list-bugs.1 create mode 100755 lp-list-bugs diff --git a/debian/changelog b/debian/changelog index 59b4cc5..99c9013 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 Fri, 17 Sep 2010 04:42:53 +0200 diff --git a/debian/copyright b/debian/copyright index 7abfbc0..0ca1ac9 100644 --- a/debian/copyright +++ b/debian/copyright @@ -7,6 +7,7 @@ Upstream Authors: Albin Tonnerre Benjamin Drung Bryce Harrington + Colin Watson Daniel Hahler Daniel Holbach Dustin Kirkland @@ -33,7 +34,7 @@ Upstream Authors: Copyright: - (C) 2006-2009, Canonical Ltd. + (C) 2006-2010, Canonical Ltd. (C) 2007, Albert Damen (C) 2006-2007, Albin Tonnerre © 2010, Benjamin Drung @@ -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. diff --git a/doc/lp-list-bugs.1 b/doc/lp-list-bugs.1 new file mode 100644 index 0000000..56fa3f7 --- /dev/null +++ b/doc/lp-list-bugs.1 @@ -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 . +Both are released under the terms of the GNU General Public License, version +3 or later. diff --git a/lp-list-bugs b/lp-list-bugs new file mode 100755 index 0000000..ea451c7 --- /dev/null +++ b/lp-list-bugs @@ -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 + +import sys + +from optparse import OptionParser + +from ubuntutools.lp.libsupport import get_launchpad +from launchpadlib.errors import HTTPError + +if __name__ == '__main__': + usage = "Usage: %prog [...]" + 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