Config file for import-bug-from-debian

This commit is contained in:
Stefano Rivera 2010-12-21 23:41:55 +02:00
parent 41cc2fa194
commit bd08a0c423
2 changed files with 48 additions and 19 deletions

View File

@ -18,15 +18,35 @@ Each \fIbug\fR may be provided either as a bug number or URL.
.SH OPTIONS
.TP
.BR \-b ", " \-\-browserless
Don't open the bug in a browser at the end.
.TP
.BR \-h ", " \-\-help
Display a help message and exit.
.TP
.BR \-n ", " \-\-dry\-run
Use the LP staging server so that changes are not permanent.
.B \-l \fIINSTANCE\fR, \fB\-\-lpinstance\fR=\fIINSTANCE\fR
Use the specified instance of Launchpad (e.g. "staging"), instead of
the default of "production".
.TP
.BR \-b ", " \-\-browserless
Don't open the bug in a browser at the end.
.B \-\-no\-conf
Do not read any configuration files, or configuration from environment
variables.
.SH ENVIRONMENT
All of the \fBCONFIGURATION VARIABLES\fR below are also supported as
environment variables.
Variables in the environment take precedence to those in configuration
files.
.SH CONFIGURATION VARIABLES
The following variables can be set in the environment or in
.BR ubuntu\-dev\-tools (5)
configuration files.
In each case, the script\-specific variable takes precedence over the
package\-wide variable.
.TP
.BR BACKPORTPACKAGE_LPINSTANCE ", " UBUNTUTOOLS_LPINSTANCE
The default value for \fB--lpinstance\fR.
.SH SEE ALSO
.BR ubuntu\-dev\-tools (5)
.SH AUTHORS
\fBimport\-bug\-from\-debian\fR was written by James Westby
<james.westby@ubuntu.com>,

View File

@ -1,7 +1,8 @@
#!/usr/bin/python
# -*- coding: UTF-8 -*-
# Copyright © 2009 James Westby <james.westby@ubuntu.com>
# Copyright © 2009 James Westby <james.westby@ubuntu.com>,
# 2010 Stefano Rivera <stefanor@ubuntu.com>
#
# ##################################################################
#
@ -21,12 +22,15 @@
#
# ##################################################################
from optparse import OptionParser
from optparse import OptionParser, SUPPRESS_HELP
import re
import SOAPpy
import sys
import subprocess
from ubuntutools.lp.libsupport import (get_launchpad, translate_api_web)
import SOAPpy
from ubuntutools.config import UDTConfig
from ubuntutools.lp.libsupport import get_launchpad, translate_api_web
bug_re = re.compile(r"bug=(\d+)")
@ -39,21 +43,26 @@ debbugs = SOAPpy.SOAPProxy(url, namespace)
#debbugs.config.dumpSOAPIn = 1
parser = OptionParser(usage="%prog [option] bug ...")
parser.add_option("-n", "--dry-run",
help="Use the staging server so that changes are not permanent",
dest="dry_run", action="store_true")
parser.add_option("-b", "--browserless",
help="Don't open the bug in the browser at the end",
dest="browserless", action="store_true")
help="Don't open the bug in the browser at the end",
dest="browserless", action="store_true")
parser.add_option("-l", "--lpinstance", metavar="INSTANCE",
help="Launchpad instance to connect to (default: production)",
dest="lpinstance", default=None)
parser.add_option("-n", "--dry-run",
help=SUPPRESS_HELP,
dest="lpinstance", action="store_const", const="staging")
parser.add_option("--no-conf", dest="no_conf", default=False,
help="Don't read config files or environment variables.",
action="store_true")
(options, args) = parser.parse_args()
if options.dry_run:
lp_server = 'staging'
else:
lp_server = 'production'
config = UDTConfig(options.no_conf)
if options.lpinstance is None:
options.lpinstance = config.get_value("LPINSTANCE")
try:
lp = get_launchpad("ubuntu-dev-tools", lp_server)
lp = get_launchpad("ubuntu-dev-tools", options.lpinstance)
except IOError, msg:
print msg
print "No credentials, can't continue"