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 from buildbot import interfaces
39 from buildbot.process.properties import Properties
40
42 """I represent a request to a specific Builder to run a single build.
43
44 I am generated by db.getBuildRequestWithNumber, and am used to tell the
45 Build about what it ought to be building. I am also used by the Builder
46 to let hook functions decide which requests should be handled first.
47
48 I have a SourceStamp which specifies what sources I will build. This may
49 specify a specific revision of the source tree (so source.branch,
50 source.revision, and source.patch are used). The .patch attribute is
51 either None or a tuple of (patchlevel, diff), consisting of a number to
52 use in 'patch -pN', and a unified-format context diff.
53
54 Alternatively, the SourceStamp may specify a set of Changes to be built,
55 contained in source.changes. In this case, I may be mergeable with other
56 BuildRequests on the same branch.
57
58 @type source: a L{buildbot.sourcestamp.SourceStamp} instance.
59 @ivar source: the source code that this BuildRequest use
60
61 @type reason: string
62 @ivar reason: the reason this Build is being requested. Schedulers
63 provide this, but for forced builds the user requesting the
64 build will provide a string.
65
66 @type properties: Properties object
67 @ivar properties: properties that should be applied to this build
68 'owner' property is used by Build objects to collect
69 the list returned by getInterestedUsers
70
71 @ivar status: the IBuildStatus object which tracks our status
72
73 @ivar submittedAt: a timestamp (seconds since epoch) when this request
74 was submitted to the Builder. This is used by the CVS
75 step to compute a checkout timestamp, as well as the
76 master to prioritize build requests from oldest to
77 newest.
78 """
79
80 source = None
81 builder = None
82 startCount = 0
83 submittedAt = None
84
85 - def __init__(self, reason, source, builderName, properties=None):
94
97
100
102 """Return a reason for the merged build request."""
103 reasons = []
104 for req in [self] + others:
105 if req.reason and req.reason not in reasons:
106 reasons.append(req.reason)
107 return ", ".join(reasons)
108
109
110
112 """Cancel this request. This can only be successful if the Build has
113 not yet been started.
114
115 @return: a boolean indicating if the cancel was successful."""
116 if self.builder:
117 return self.builder.cancelBuildRequest(self)
118 return False
119
122