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
42
|
#!/usr/bin/python -S
#
# Copyright 2010 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
# pylint: disable-msg=W0403
"""Request builds for stale daily build recipes."""
__metaclass__ = type
import _pythonpath
import transaction
from zope.component import getUtility
from lp.services.config import config
from lp.code.interfaces.sourcepackagerecipebuild import (
ISourcePackageRecipeBuildSource,)
from lp.services.scripts.base import LaunchpadCronScript
from lp.services.webapp.errorlog import globalErrorUtility
class RequestDailyBuilds(LaunchpadCronScript):
"""Run create merge proposal jobs."""
def __init__(self):
name = 'request_daily_builds'
dbuser = config.request_daily_builds.dbuser
LaunchpadCronScript.__init__(self, name, dbuser)
def main(self):
globalErrorUtility.configure(self.name)
source = getUtility(ISourcePackageRecipeBuildSource)
builds = source.makeDailyBuilds(self.logger)
self.logger.info('Requested %d daily builds.' % len(builds))
transaction.commit()
if __name__ == '__main__':
script = RequestDailyBuilds()
script.lock_and_run()
|