14291.1.2
by Jeroen Vermeulen
Lint. |
1 |
# Copyright 2010-2011 Canonical Ltd. This software is licensed under the
|
7675.687.68
by Michael Nelson
Adding buildfarmbuildjob file which I missed previously. |
2 |
# GNU Affero General Public License version 3 (see the file LICENSE).
|
3 |
||
4 |
__metaclass__ = type |
|
5 |
__all__ = [ |
|
6 |
'BuildFarmBuildJob', |
|
7 |
]
|
|
8 |
||
9 |
||
10 |
from zope.interface import implements |
|
11 |
||
11458.1.1
by Jelmer Vernooij
Move enums of buildmaster. |
12 |
from lp.buildmaster.enums import BuildStatus |
7675.687.68
by Michael Nelson
Adding buildfarmbuildjob file which I missed previously. |
13 |
from lp.buildmaster.model.buildfarmjob import BuildFarmJobOld |
14606.3.1
by William Grant
Merge canonical.database into lp.services.database. |
14 |
from lp.services.database.constants import UTC_NOW |
7675.687.68
by Michael Nelson
Adding buildfarmbuildjob file which I missed previously. |
15 |
from lp.soyuz.interfaces.buildfarmbuildjob import IBuildFarmBuildJob |
16 |
||
17 |
||
18 |
class BuildFarmBuildJob(BuildFarmJobOld): |
|
19 |
"""See `IBuildFaramBuildJob`."""
|
|
20 |
implements(IBuildFarmBuildJob) |
|
14291.1.2
by Jeroen Vermeulen
Lint. |
21 |
|
7675.687.68
by Michael Nelson
Adding buildfarmbuildjob file which I missed previously. |
22 |
def __init__(self, build): |
23 |
"""Store the build for this package build farm job.
|
|
24 |
||
25 |
XXX 2010-04-12 michael.nelson bug=536700
|
|
26 |
The build param will no longer be necessary once BuildFarmJob is
|
|
27 |
itself a concrete class. This class (PackageBuildFarmJob)
|
|
28 |
will also be renamed PackageBuild and turned into a concrete class.
|
|
29 |
"""
|
|
30 |
super(BuildFarmBuildJob, self).__init__() |
|
31 |
self.build = build |
|
32 |
||
33 |
def getTitle(self): |
|
34 |
"""See `IBuildFarmJob`."""
|
|
35 |
return self.build.title |
|
36 |
||
37 |
def jobStarted(self): |
|
38 |
"""See `IBuildFarmJob`."""
|
|
7675.687.92
by Michael Nelson
Changes for buildd-dispatching.txt |
39 |
self.build.status = BuildStatus.BUILDING |
7675.687.68
by Michael Nelson
Adding buildfarmbuildjob file which I missed previously. |
40 |
# The build started, set the start time if not set already.
|
7675.687.92
by Michael Nelson
Changes for buildd-dispatching.txt |
41 |
self.build.date_started = UTC_NOW |
7675.687.68
by Michael Nelson
Adding buildfarmbuildjob file which I missed previously. |
42 |
if self.build.date_first_dispatched is None: |
43 |
self.build.date_first_dispatched = UTC_NOW |
|
44 |
||
45 |
def jobReset(self): |
|
46 |
"""See `IBuildFarmJob`."""
|
|
7675.687.92
by Michael Nelson
Changes for buildd-dispatching.txt |
47 |
self.build.status = BuildStatus.NEEDSBUILD |
7675.687.68
by Michael Nelson
Adding buildfarmbuildjob file which I missed previously. |
48 |
|
49 |
def jobAborted(self): |
|
50 |
"""See `IBuildFarmJob`."""
|
|
7675.687.92
by Michael Nelson
Changes for buildd-dispatching.txt |
51 |
self.build.status = BuildStatus.NEEDSBUILD |
14206.1.2
by Julian Edwards
merge a chunk of the backed-out change from r14192 |
52 |
|
53 |
def jobCancel(self): |
|
54 |
"""See `IBuildFarmJob`."""
|
|
55 |
self.build.status = BuildStatus.CANCELLED |