2 from buildbot
.process
import base
3 from buildbot
.status
import builder
7 """I represent a set of potential Builds, all of the same source tree,
8 across a specified list of Builders. I can represent a build of a
9 specific version of the source tree (named by source.branch and
10 source.revision), or a build of a certain set of Changes
11 (source.changes=list)."""
13 def __init__(self
, builderNames
, source
, reason
=None, bsid
=None):
15 @param source: a L{buildbot.sourcestamp.SourceStamp}
17 self
.builderNames
= builderNames
20 self
.stillHopeful
= True
21 self
.status
= bss
= builder
.BuildSetStatus(source
, reason
,
24 def waitUntilSuccess(self
):
25 return self
.status
.waitUntilSuccess()
26 def waitUntilFinished(self
):
27 return self
.status
.waitUntilFinished()
29 def start(self
, builders
):
30 """This is called by the BuildMaster to actually create and submit
37 req
= base
.BuildRequest(self
.reason
, self
.source
, b
.name
)
39 self
.requests
.append(req
)
40 d
= req
.waitUntilFinished()
41 d
.addCallback(self
.requestFinished
, req
)
43 # tell our status about them
44 req_statuses
= [req
.status
for req
in self
.requests
]
45 self
.status
.setBuildRequestStatuses(req_statuses
)
49 b
.submitBuildRequest(req
)
51 def requestFinished(self
, buildstatus
, req
):
52 # TODO: this is where individual build status results are aggregated
53 # into a BuildSet-wide status. Consider making a rule that says one
54 # WARNINGS results in the overall status being WARNINGS too. The
55 # current rule is that any FAILURE means FAILURE, otherwise you get
57 self
.requests
.remove(req
)
58 results
= buildstatus
.getResults()
59 if results
== builder
.FAILURE
:
60 self
.status
.setResults(results
)
62 # oh, cruel reality cuts deep. no joy for you. This is the
63 # first failure. This flunks the overall BuildSet, so we can
64 # notify success watchers that they aren't going to be happy.
65 self
.stillHopeful
= False
66 self
.status
.giveUpHope()
67 self
.status
.notifySuccessWatchers()
69 # that was the last build, so we can notify finished watchers. If
70 # we haven't failed by now, we can claim success.
72 self
.status
.setResults(builder
.SUCCESS
)
73 self
.status
.notifySuccessWatchers()
74 self
.status
.notifyFinishedWatchers()