import-bug-from-debian: Add --package option, for importing bugs from

psuedo-packages.
This commit is contained in:
Stefano Rivera 2011-01-04 22:24:06 +02:00
parent 99f78224ac
commit 9c916053b1
3 changed files with 21 additions and 4 deletions

4
debian/changelog vendored
View File

@ -29,6 +29,8 @@ ubuntu-dev-tools (0.109) UNRELEASED; urgency=low
* pull-debian-debdiff: Rewrite in Python, and use snapshot.debian.org. * pull-debian-debdiff: Rewrite in Python, and use snapshot.debian.org.
* pull-lp-source: Support -d (LP: #681699) * pull-lp-source: Support -d (LP: #681699)
* suspicious-source: Whitelist Python source code. * suspicious-source: Whitelist Python source code.
* import-bug-from-debian: Add --package option, for importing bugs from
psuedo-packages.
[ Michael Bienia ] [ Michael Bienia ]
* ubuntutools/lp/lpapicache.py: Allow easier selection of 'staging' as LP * ubuntutools/lp/lpapicache.py: Allow easier selection of 'staging' as LP
@ -52,7 +54,7 @@ ubuntu-dev-tools (0.109) UNRELEASED; urgency=low
* add "add-patch" that provides the non-interactive version of * add "add-patch" that provides the non-interactive version of
edit-patch edit-patch
-- Benjamin Drung <bdrung@ubuntu.com> Mon, 27 Dec 2010 22:38:34 +0100 -- Stefano Rivera <stefanor@ubuntu.com> Tue, 04 Jan 2011 22:23:20 +0200
ubuntu-dev-tools (0.108) experimental; urgency=low ubuntu-dev-tools (0.108) experimental; urgency=low

View File

@ -4,7 +4,7 @@ import\-bug\-from\-debian \- Import bugs from Debian's BTS, and file
them against Ubuntu in LP. them against Ubuntu in LP.
.SH SYNOPSIS .SH SYNOPSIS
.B import\-bug\-from\-debian \fR[\fB\-nb\fR] \fIbug\fR... .B import\-bug\-from\-debian \fR[\fIoptions\fR] \fIbug\fR...
.br .br
.B import\-bug\-from\-debian \-h .B import\-bug\-from\-debian \-h
@ -28,6 +28,11 @@ Display a help message and exit.
Use the specified instance of Launchpad (e.g. "staging"), instead of Use the specified instance of Launchpad (e.g. "staging"), instead of
the default of "production". the default of "production".
.TP .TP
.B \-p \fIPACKAGE\fR, \fB\-\-package\fR=\fIPACKAGE\fR
Launchpad package to file bug against, if not the same source package
name as Debian.
Useful for importing removal bugs filed against \fBftp.debian.org\fR.
.TP
.B \-\-no\-conf .B \-\-no\-conf
Do not read any configuration files, or configuration from environment Do not read any configuration files, or configuration from environment
variables. variables.

View File

@ -54,6 +54,10 @@ def main():
parser.add_option("-n", "--dry-run", parser.add_option("-n", "--dry-run",
help=SUPPRESS_HELP, help=SUPPRESS_HELP,
dest="lpinstance", action="store_const", const="staging") dest="lpinstance", action="store_const", const="staging")
parser.add_option("-p", "--package", metavar="PACKAGE",
help="Launchpad package to file bug against "
"(default: Same as Debian)",
dest="package", default=None)
parser.add_option("--no-conf", dest="no_conf", default=False, parser.add_option("--no-conf", dest="no_conf", default=False,
help="Don't read config files or environment variables.", help="Don't read config files or environment variables.",
action="store_true") action="store_true")
@ -96,15 +100,21 @@ def main():
for bug in bugs: for bug in bugs:
bug = bug.value bug = bug.value
package = bug.package package = bug.package
ubupackage = package
if options.package:
ubupackage = options.package
bug_num = bug.bug_num bug_num = bug.bug_num
subject = bug.subject subject = bug.subject
log = debbugs.get_bug_log(bug_num) log = debbugs.get_bug_log(bug_num)
summary = log[0][0] summary = log[0][0]
target = ubuntu.getSourcePackage(name=package) target = ubuntu.getSourcePackage(name=ubupackage)
u_bug = launchpad.bugs.createBug(target=target, title=subject, u_bug = launchpad.bugs.createBug(target=target, title=subject,
description="Imported from Debian bug %d:\n\n%s" description="Imported from Debian bug %d:\n\n%s"
% (bug_num, summary)) % (bug_num, summary))
d_task = u_bug.addTask(target=debian.getSourcePackage(name=package)) d_sp = debian.getSourcePackage(name=package)
if d_sp is None and options.package:
d_sp = debian.getSourcePackage(name=options.package)
d_task = u_bug.addTask(target=d_sp)
d_watch = u_bug.addWatch(remote_bug=bug_num, bug_tracker=lp_debbugs) d_watch = u_bug.addWatch(remote_bug=bug_num, bug_tracker=lp_debbugs)
d_task.bug_watch = d_watch d_task.bug_watch = d_watch
d_task.lp_save() d_task.lp_save()