1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 from buildbot import interfaces
17 from buildbot.process.properties import Properties
18
20 """I represent a request to a specific Builder to run a single build.
21
22 I am generated by db.getBuildRequestWithNumber, and am used to tell the
23 Build about what it ought to be building. I am also used by the Builder
24 to let hook functions decide which requests should be handled first.
25
26 I have a SourceStamp which specifies what sources I will build. This may
27 specify a specific revision of the source tree (so source.branch,
28 source.revision, and source.patch are used). The .patch attribute is
29 either None or a tuple of (patchlevel, diff), consisting of a number to
30 use in 'patch -pN', and a unified-format context diff.
31
32 Alternatively, the SourceStamp may specify a set of Changes to be built,
33 contained in source.changes. In this case, I may be mergeable with other
34 BuildRequests on the same branch.
35
36 @type source: a L{buildbot.sourcestamp.SourceStamp} instance.
37 @ivar source: the source code that this BuildRequest use
38
39 @type reason: string
40 @ivar reason: the reason this Build is being requested. Schedulers
41 provide this, but for forced builds the user requesting the
42 build will provide a string.
43
44 @type properties: Properties object
45 @ivar properties: properties that should be applied to this build
46 'owner' property is used by Build objects to collect
47 the list returned by getInterestedUsers
48
49 @ivar status: the IBuildStatus object which tracks our status
50
51 @ivar submittedAt: a timestamp (seconds since epoch) when this request
52 was submitted to the Builder. This is used by the CVS
53 step to compute a checkout timestamp, as well as the
54 master to prioritize build requests from oldest to
55 newest.
56 """
57
58 source = None
59 builder = None
60 startCount = 0
61 submittedAt = None
62
63 - def __init__(self, reason, source, builderName, properties=None):
72
75
78
80 """Return a reason for the merged build request."""
81 reasons = []
82 for req in [self] + others:
83 if req.reason and req.reason not in reasons:
84 reasons.append(req.reason)
85 return ", ".join(reasons)
86
87
88
90 """Cancel this request. This can only be successful if the Build has
91 not yet been started.
92
93 @return: a boolean indicating if the cancel was successful."""
94 if self.builder:
95 return self.builder.cancelBuildRequest(self)
96 return False
97
100