10899.3.11
by Aaron Bentley
Update script to use system python. |
1 |
#!/usr/bin/python -S
|
10899.2.3
by Aaron Bentley
Add daily builds script, rename SourcePackageRecipe.requestDailyBuilds. |
2 |
#
|
3 |
# Copyright 2010 Canonical Ltd. This software is licensed under the
|
|
4 |
# GNU Affero General Public License version 3 (see the file LICENSE).
|
|
5 |
||
6 |
# pylint: disable-msg=W0403
|
|
7 |
||
8 |
"""Request builds for stale daily build recipes."""
|
|
9 |
||
10 |
__metaclass__ = type |
|
11 |
||
12 |
import _pythonpath |
|
10899.2.4
by Aaron Bentley
Fix lint issues. |
13 |
|
14 |
import transaction |
|
10899.2.3
by Aaron Bentley
Add daily builds script, rename SourcePackageRecipe.requestDailyBuilds. |
15 |
from zope.component import getUtility |
16 |
||
17 |
from canonical.config import config |
|
18 |
# fix circular import issue
|
|
19 |
import canonical.launchpad.interfaces |
|
20 |
from lp.code.interfaces.sourcepackagerecipebuild import ( |
|
21 |
ISourcePackageRecipeBuildSource,) |
|
22 |
from lp.services.scripts.base import LaunchpadCronScript |
|
23 |
from canonical.launchpad.webapp.errorlog import globalErrorUtility |
|
24 |
||
25 |
||
26 |
class RequestDailyBuilds(LaunchpadCronScript): |
|
27 |
"""Run create merge proposal jobs."""
|
|
28 |
||
29 |
def __init__(self): |
|
30 |
name = 'request_daily_builds' |
|
31 |
dbuser = config.request_daily_builds.dbuser |
|
32 |
LaunchpadCronScript.__init__(self, name, dbuser) |
|
33 |
||
34 |
def main(self): |
|
35 |
globalErrorUtility.configure(self.name) |
|
36 |
source = getUtility(ISourcePackageRecipeBuildSource) |
|
12070.1.1
by Tim Penhey
Log the recipes that are having daily builds requested. |
37 |
builds = source.makeDailyBuilds(self.logger) |
10899.2.3
by Aaron Bentley
Add daily builds script, rename SourcePackageRecipe.requestDailyBuilds. |
38 |
self.logger.info('Requested %d daily builds.' % len(builds)) |
39 |
transaction.commit() |
|
40 |
||
41 |
||
42 |
if __name__ == '__main__': |
|
43 |
script = RequestDailyBuilds() |
|
44 |
script.lock_and_run() |