10637.3.1
by Guilherme Salgado
Use the default python version instead of a hard-coded version |
1 |
#!/usr/bin/python -S
|
8687.15.22
by Karl Fogel
Add the copyright header block to the remaining .py files. |
2 |
#
|
3 |
# Copyright 2009 Canonical Ltd. This software is licensed under the
|
|
4 |
# GNU Affero General Public License version 3 (see the file LICENSE).
|
|
4678.6.12
by Bjorn Tillenius
add a script for importing debian bugs. |
5 |
|
4678.6.23
by Bjorn Tillenius
move DebianBugImportScript back into the actual script. |
6 |
"""Import Debian bugs into Launchpad, linking them to Ubuntu.
|
7 |
||
8 |
New bugs will be filed against the Debian source package in
|
|
9 |
Launchpad, with the real Debian bug linked as a bug watch.
|
|
10 |
||
11 |
An Ubuntu task will be created for each imported bug.
|
|
4678.6.12
by Bjorn Tillenius
add a script for importing debian bugs. |
12 |
"""
|
13 |
||
14 |
import _pythonpath |
|
15 |
||
4678.6.24
by Bjorn Tillenius
use the checkwatches db user. |
16 |
from canonical.config import config |
8356.1.9
by Leonard Richardson
Renamed the base script module in scripts/, which module_rename.py didn't touch because it wasn't under lib/. |
17 |
from lp.services.scripts.base import LaunchpadScript |
8523.3.16
by Gavin Panella
Fix an import in a script. |
18 |
from lp.bugs.scripts.importdebianbugs import import_debian_bugs |
4678.6.23
by Bjorn Tillenius
move DebianBugImportScript back into the actual script. |
19 |
|
20 |
||
21 |
class DebianBugImportScript(LaunchpadScript): |
|
4678.6.33
by Bjorn Tillenius
add docstring. |
22 |
"""Import Debian bugs into Launchpad, linking them to Ubuntu.
|
23 |
||
24 |
New bugs will be filed against the Debian source package in
|
|
25 |
Launchpad, with the real Debian bug linked as a bug watch.
|
|
26 |
||
27 |
An Ubuntu task will be created for each imported bug.
|
|
28 |
"""
|
|
4678.6.23
by Bjorn Tillenius
move DebianBugImportScript back into the actual script. |
29 |
|
30 |
usage = "%(prog)s [options] <debian-bug-1> ... <debian-bug-n>" |
|
31 |
description = __doc__ |
|
32 |
||
33 |
def add_my_options(self): |
|
34 |
self.parser.add_option( |
|
35 |
'-n', '--dry-run', action='store_true', |
|
36 |
help="Don't commit the DB transaction.", |
|
37 |
dest='dry_run', default=False) |
|
38 |
||
39 |
def main(self): |
|
40 |
if len(self.args) < 1: |
|
41 |
self.parser.print_help() |
|
42 |
return
|
|
43 |
||
4678.6.28
by Bjorn Tillenius
use a single list argument rather than *bugs_to_import |
44 |
import_debian_bugs(self.args) |
4678.6.23
by Bjorn Tillenius
move DebianBugImportScript back into the actual script. |
45 |
|
46 |
if self.options.dry_run: |
|
4678.6.29
by Bjorn Tillenius
improve dry-run message. |
47 |
self.logger.info("Dry run - rolling back the transaction.") |
4678.6.23
by Bjorn Tillenius
move DebianBugImportScript back into the actual script. |
48 |
self.txn.abort() |
49 |
else: |
|
50 |
self.logger.info("Committing the transaction.") |
|
51 |
self.txn.commit() |
|
4678.6.12
by Bjorn Tillenius
add a script for importing debian bugs. |
52 |
|
53 |
||
54 |
if __name__ == '__main__': |
|
55 |
script = DebianBugImportScript( |
|
4678.6.24
by Bjorn Tillenius
use the checkwatches db user. |
56 |
'canonical.launchpad.scripts.importdebianbugs', |
57 |
dbuser=config.checkwatches.dbuser) |
|
4678.6.12
by Bjorn Tillenius
add a script for importing debian bugs. |
58 |
script.run() |