1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#!/usr/bin/python -S
#
# Copyright 2010-2011 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
# pylint: disable-msg=W0403
import _pythonpath
import time
from lp.bugs.scripts.bzremotecomponentfinder import (
BugzillaRemoteComponentFinder,
)
from lp.services.config import config
from lp.services.scripts.base import LaunchpadCronScript
class UpdateRemoteComponentsFromBugzilla(LaunchpadCronScript):
def add_my_options(self):
self.parser.add_option(
"-b", "--bugtracker", dest="bugtracker",
help="Update only the bug tracker with this name in launchpad")
def main(self):
start_time = time.time()
finder = BugzillaRemoteComponentFinder(
self.logger)
finder.getRemoteProductsAndComponents(
bugtracker_name=self.options.bugtracker)
run_time = time.time() - start_time
print("Time for this run: %.3f seconds." % run_time)
if __name__ == "__main__":
updater = UpdateRemoteComponentsFromBugzilla(
"updatebugzillaremotecomponents",
dbuser=config.updatebugzillaremotecomponents.dbuser)
updater.lock_and_run()
|