add 'bitesize' script

This commit is contained in:
Daniel Holbach 2011-05-09 14:48:54 +02:00
parent 328def15a2
commit eee6501a18
4 changed files with 110 additions and 1 deletions

71
bitesize Executable file
View File

@ -0,0 +1,71 @@
#!/usr/bin/python
"""Add 'bitesize' tag to bugs and add a comment."""
# Copyright (c) 2011 Canonical Ltd.
#
# bitesize 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.
#
# bitesize 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:
# Daniel Holbach <daniel.holbach@canonical.com>
import sys
from optparse import OptionParser
from launchpadlib.launchpad import Launchpad
from launchpadlib.errors import HTTPError
def die(message):
print >> sys.stderr, "Fatal: " + message
sys.exit(1)
def main():
usage = "Usage: %prog <bug number>"
opt_parser = OptionParser(usage)
(options, args) = opt_parser.parse_args()
if len(args) < 1:
opt_parser.error("Need at least one bug number.")
launchpad = None
try:
launchpad = Launchpad.login_with("ubuntu-dev-tools", "production")
except ImportError:
suggestion = "check whether python-launchpadlib is installed"
if launchpad is None:
die("Couldn't setup Launchpad for the ubuntu-dev-tools consumer; %s" % \
(suggestion, ))
# check that the new main bug isn't a duplicate
try:
bug = launchpad.bugs[args[0]]
except HTTPError, error:
if error.response.status == 401:
print >> sys.stderr, ("E: Don't have enough permissions to access "
"bug %s") % (args[0])
die(error.content)
else:
raise
if 'bitesize' not in bug.tags:
bug.tags += ['bitesize']
content = """I'm marking this bug as 'bitesize' as it looks like an issue that
is easy to fix and suitable for newcomers in Ubuntu development. If you need
any help with fixing it, talk to me (https://launchpad.net/~%s) about it.""" % \
(launchpad.me.name)
bug.newMessage(content=content, subject="bitesize bug")
bug.lp_save()
if __name__ == '__main__':
main()

7
debian/changelog vendored
View File

@ -1,5 +1,6 @@
ubuntu-dev-tools (0.124) UNRELEASED; urgency=low
[ Stefano Rivera ]
* mk-sbuild:
- Disable daemons with a policy-rc.d script (like pbuilder does)
- Move package installation after option parsing.
@ -12,7 +13,11 @@ ubuntu-dev-tools (0.124) UNRELEASED; urgency=low
code name.
- Support Debian experimental.
-- Stefano Rivera <stefanor@debian.org> Sun, 24 Apr 2011 20:35:51 +0200
[ Daniel Holbach ]
* bitesize, doc/bitesize.1: add script to tag a bug as bitesize and add a
comment that you are willing to help with fixing the bug.
-- Daniel Holbach <daniel.holbach@ubuntu.com> Mon, 09 May 2011 14:33:48 +0200
ubuntu-dev-tools (0.122) unstable; urgency=low

2
debian/copyright vendored
View File

@ -86,6 +86,7 @@ License: GPL-2+
version 2 can be found in the /usr/share/common-licenses/GPL-2 file.
Files: ack-sync
doc/bitesize.1
doc/edit-patch.1
doc/get-branches.1
doc/grab-attachments.1
@ -96,6 +97,7 @@ Files: ack-sync
doc/merge-changelog.1
doc/setup-packaging-environment.1
doc/syncpackage.1
bitesize
edit-patch
get-branches
grab-attachments

31
doc/bitesize.1 Normal file
View File

@ -0,0 +1,31 @@
.TH bitesize "1" "May 9 2010" "ubuntu-dev-tools"
.SH NAME
Add \fIbitesize\fI tag to bugs and add a comment.
lp\-set\-dup \- mark one or more bugs as duplicate of another bug
.SH SYNOPSIS
.B bitesize \fR<\fIbug number\fI>\fR
.br
.B bitesize \-\-help
.SH DESCRIPTION
\fBbitesize\fR adds a bitesize tag to the bug, if it's not there yet. It
also adds a comment to the bug indicating that you are willing to help with
fixing it.
It checks for permission to operate on a given bug first,
then perform required tasks on Launchpad.
.SH OPTIONS
Listed below are the command line options for \fBbitesize\fR:
.TP
.BR \-h ", " \-\-help
Display a help message and exit.
.SH SEE ALSO
.BR ubuntu\-dev\-tools (5)
.SH AUTHORS
\fBbitesize\fR and this manual page were written by Daniel Holbach
<daniel.holbach@canonical.com>.
.PP
Both are released under the terms of the GNU General Public License, version 3.