Merge lp:~michael.nelson/launchpad/487009-db-more-soyuz-extraction into lp:launchpad/db-devel

Proposed by Michael Nelson
Status: Merged
Approved by: Henning Eggers
Approved revision: not available
Merged at revision: not available
Proposed branch: lp:~michael.nelson/launchpad/487009-db-more-soyuz-extraction
Merge into: lp:launchpad/db-devel
Prerequisite: lp:~michael.nelson/launchpad/487009-db-generalise-ibuilder-1b
Diff against target: 565 lines (+246/-191)
5 files modified
lib/lp/buildmaster/interfaces/buildfarmjobbehavior.py (+19/-4)
lib/lp/buildmaster/model/buildfarmjobbehavior.py (+14/-0)
lib/lp/soyuz/interfaces/builder.py (+0/-13)
lib/lp/soyuz/model/binarypackagebuildbehavior.py (+206/-0)
lib/lp/soyuz/model/builder.py (+7/-174)
To merge this branch: bzr merge lp:~michael.nelson/launchpad/487009-db-more-soyuz-extraction
Reviewer Review Type Date Requested Status
Henning Eggers (community) code Approve
Review via email: mp+15533@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Michael Nelson (michael.nelson) wrote :

= Summary =

This branch continues on from the prerequisite at:

https://code.edge.launchpad.net/~michael.nelson/launchpad/487009-db-generalise-ibuilder-1b/+merge/15477

and extracts most of the remaining soyuz-specific binary build logic from IBuilder and into the custom BinaryPackageBuildBehavior to which IBuilder delegates for binary builds, in particular leaving the IBuilder.startBuild() method looking like:

http://pastebin.ubuntu.com/332947/

with verifyBuildRequest() and dispatchBuildToSlave() now being delegated to the current build behavior.

I will have one further branch that:
 * extracts IBuilder.getBuildRecords()
 * extracts IBuilder.slaveStatus()
 * adds documentation for the IBuildFarmJobBehavior with examples for adding further behaviors.

== Pre-implementation notes ==

See the pre-implementation notes on bug 487009.

== Implementation details ==

== Tests ==

bin/test -vv -t doc/builder.txt -t doc/buildd-dispatching.txt

== Demo and Q/A ==

We will need to Q/A this on dogfood.

= Launchpad lint =

lib/lp/soyuz/model/builder.py
    23: [F0401] Unable to import 'lazr.delegates' (No module named delegates)

Revision history for this message
Henning Eggers (henninge) wrote :

Thank you for doing this important groundwork for our bridging-the-gap strategy. It will benefit all of us and most importantly Ubuntu.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/buildmaster/interfaces/buildfarmjobbehavior.py'
--- lib/lp/buildmaster/interfaces/buildfarmjobbehavior.py 2009-12-02 08:50:30 +0000
+++ lib/lp/buildmaster/interfaces/buildfarmjobbehavior.py 2009-12-02 08:50:31 +0000
@@ -11,7 +11,7 @@
11 'IBuildFarmJobBehavior',11 'IBuildFarmJobBehavior',
12 ]12 ]
1313
14from zope.interface import Interface14from zope.interface import Attribute, Interface
1515
1616
17class BuildBehaviorMismatch(Exception):17class BuildBehaviorMismatch(Exception):
@@ -23,6 +23,9 @@
2323
24class IBuildFarmJobBehavior(Interface):24class IBuildFarmJobBehavior(Interface):
2525
26 status = Attribute(
27 "Generated status information for this particular job.")
28
26 def setBuilder(builder):29 def setBuilder(builder):
27 """Sets the associated builder reference for this instance."""30 """Sets the associated builder reference for this instance."""
2831
@@ -33,6 +36,18 @@
33 :param build_queue_item: A BuildQueueItem to build.36 :param build_queue_item: A BuildQueueItem to build.
34 :param logger: A logger to be used to log diagnostic information.37 :param logger: A logger to be used to log diagnostic information.
35 """38 """
36 # A number of other methods to go here that can be customised for each of39
37 # the different build types (branch build, recipe build, translation40 def dispatchBuildToSlave(build_queue_item, logger):
38 # build etc.)41 """Dispatch a specific build to the slave.
42
43 :param build_queue_item: The `BuildQueueItem` that will be built.
44 :logger: A logger to be used to log diagnostic information.
45 """
46
47 def verifyBuildRequest(build_queue_item, logger):
48 """Carry out any pre-build checks.
49
50 :param build_queue_item: The `BuildQueueItem` that is to be built.
51 :logger: A logger to be used to log diagnostic information.
52 """
53
3954
=== modified file 'lib/lp/buildmaster/model/buildfarmjobbehavior.py'
--- lib/lp/buildmaster/model/buildfarmjobbehavior.py 2009-12-02 08:50:30 +0000
+++ lib/lp/buildmaster/model/buildfarmjobbehavior.py 2009-12-02 08:50:31 +0000
@@ -33,6 +33,10 @@
33 """The builder should be set once and not changed."""33 """The builder should be set once and not changed."""
34 self._builder = builder34 self._builder = builder
3535
36 def verifyBuildRequest(self, build_queue_item, logger):
37 """The default behavior is a no-op."""
38 pass
39
3640
37class IdleBuildBehavior(BuildFarmJobBehaviorBase):41class IdleBuildBehavior(BuildFarmJobBehaviorBase):
3842
@@ -48,3 +52,13 @@
48 """See `IBuildFarmJobBehavior`."""52 """See `IBuildFarmJobBehavior`."""
49 raise BuildBehaviorMismatch(53 raise BuildBehaviorMismatch(
50 "Builder was idle when asked to log the start of a build.")54 "Builder was idle when asked to log the start of a build.")
55
56 def dispatchBuildToSlave(self, build_queue_item, logger):
57 """See `IBuildFarmJobBehavior`."""
58 raise BuildBehaviorMismatch(
59 "Builder was idle when asked to dispatch a build to the slave.")
60
61 @property
62 def status(self):
63 """See `IBuildFarmJobBehavior`."""
64 return "Idle"
5165
=== modified file 'lib/lp/soyuz/interfaces/builder.py'
--- lib/lp/soyuz/interfaces/builder.py 2009-12-02 08:50:30 +0000
+++ lib/lp/soyuz/interfaces/builder.py 2009-12-02 08:50:31 +0000
@@ -154,19 +154,6 @@
154 file.154 file.
155 """155 """
156156
157 def cachePrivateSourceOnSlave(logger, build_queue_item):
158 """Ask the slave to download source files for a private build.
159
160 The slave will cache the files for the source in build_queue_item
161 to its local disk in preparation for a private build. Private builds
162 will always take the source files from the archive rather than the
163 librarian since the archive has more granular access to each
164 archive's files.
165
166 :param logger: A logger used for providing debug information.
167 :param build_queue_item: The `IBuildQueue` being built.
168 """
169
170 def checkCanBuildForDistroArchSeries(distro_arch_series):157 def checkCanBuildForDistroArchSeries(distro_arch_series):
171 """Check that the slave can compile for the given distro_arch_release.158 """Check that the slave can compile for the given distro_arch_release.
172159
173160
=== modified file 'lib/lp/soyuz/model/binarypackagebuildbehavior.py'
--- lib/lp/soyuz/model/binarypackagebuildbehavior.py 2009-12-02 08:50:30 +0000
+++ lib/lp/soyuz/model/binarypackagebuildbehavior.py 2009-12-02 08:50:31 +0000
@@ -11,11 +11,20 @@
11 'BinaryPackageBuildBehavior',11 'BinaryPackageBuildBehavior',
12 ]12 ]
1313
14import socket
15import xmlrpclib
16
17from canonical.launchpad.webapp import urlappend
14from lp.buildmaster.interfaces.buildfarmjobbehavior import (18from lp.buildmaster.interfaces.buildfarmjobbehavior import (
15 IBuildFarmJobBehavior)19 IBuildFarmJobBehavior)
16from lp.buildmaster.model.buildfarmjobbehavior import (20from lp.buildmaster.model.buildfarmjobbehavior import (
17 BuildFarmJobBehaviorBase)21 BuildFarmJobBehaviorBase)
22from lp.registry.interfaces.pocket import PackagePublishingPocket
23from lp.soyuz.adapters.archivedependencies import (
24 get_primary_current_component, get_sources_list_for_building)
25from lp.soyuz.interfaces.archive import ArchivePurpose
18from lp.soyuz.interfaces.build import IBuildSet26from lp.soyuz.interfaces.build import IBuildSet
27from lp.soyuz.interfaces.builder import BuildSlaveFailure, CannotBuild
1928
20from zope.component import getUtility29from zope.component import getUtility
21from zope.interface import implements30from zope.interface import implements
@@ -33,3 +42,200 @@
3342
34 logger.info("startBuild(%s, %s, %s, %s)", self._builder.url,43 logger.info("startBuild(%s, %s, %s, %s)", self._builder.url,
35 spr.name, spr.version, build.pocket.title)44 spr.name, spr.version, build.pocket.title)
45
46 @property
47 def status(self):
48 """See `IBuildFarmJobBehavior`."""
49 build = getUtility(IBuildSet).getByQueueEntry(
50 self._builder.currentjob)
51 msg = 'Building %s' % build.title
52 archive = build.archive
53 if not archive.owner.private and (archive.is_ppa or archive.is_copy):
54 return '%s [%s/%s]' % (msg, archive.owner.name, archive.name)
55 else:
56 return msg
57
58 def dispatchBuildToSlave(self, build_queue_item, logger):
59 """See `IBuildFarmJobBehavior`."""
60
61 # Start the binary package build on the slave builder. First
62 # we send the chroot.
63 build = getUtility(IBuildSet).getByQueueEntry(build_queue_item)
64 chroot = build.distroarchseries.getChroot()
65 self._builder.cacheFileOnSlave(logger, chroot)
66
67 # Build filemap structure with the files required in this build
68 # and send them to the slave.
69 # If the build is private we tell the slave to get the files from the
70 # archive instead of the librarian because the slaves cannot
71 # access the restricted librarian.
72 private = build.archive.private
73 if private:
74 self._cachePrivateSourceOnSlave(build_queue_item, logger)
75 filemap = {}
76 for source_file in build.sourcepackagerelease.files:
77 lfa = source_file.libraryfile
78 filemap[lfa.filename] = lfa.content.sha1
79 if not private:
80 self._builder.cacheFileOnSlave(
81 logger, source_file.libraryfile)
82
83 # Generate a string which can be used to cross-check when obtaining
84 # results so we know we are referring to the right database object in
85 # subsequent runs.
86 buildid = "%s-%s" % (build.id, build_queue_item.id)
87 chroot_sha1 = chroot.content.sha1
88 logger.debug(
89 "Initiating build %s on %s" % (buildid, self._builder.url))
90
91 try:
92 args = self._extraBuildArgs(build)
93 status, info = self._builder.slave.build(
94 buildid, "debian", chroot_sha1, filemap, args)
95 message = """%s (%s):
96 ***** RESULT *****
97 %s
98 %s
99 %s: %s
100 ******************
101 """ % (
102 self._builder.name,
103 self._builder.url,
104 filemap,
105 args,
106 status,
107 info,
108 )
109 logger.info(message)
110 except xmlrpclib.Fault, info:
111 # Mark builder as 'failed'.
112 logger.debug(
113 "Disabling builder: %s" % self._builder.url, exc_info=1)
114 self._builder.failbuilder(
115 "Exception (%s) when setting up to new job" % info)
116 raise BuildSlaveFailure
117 except socket.error, info:
118 error_message = "Exception (%s) when setting up new job" % info
119 self._builder.handleTimeout(logger, error_message)
120 raise BuildSlaveFailure
121
122 def verifyBuildRequest(self, build_queue_item, logger):
123 """Assert some pre-build checks.
124
125 The build request is checked:
126 * Virtualized builds can't build on a non-virtual builder
127 * Ensure that we have a chroot
128 * Ensure that the build pocket allows builds for the current
129 distroseries state.
130 """
131 build = getUtility(IBuildSet).getByQueueEntry(build_queue_item)
132 assert not (not self._builder.virtualized and build.is_virtualized), (
133 "Attempt to build non-virtual item on a virtual builder.")
134
135 # Assert that we are not silently building SECURITY jobs.
136 # See findBuildCandidates. Once we start building SECURITY
137 # correctly from EMBARGOED archive this assertion can be removed.
138 # XXX Julian 2007-12-18 spec=security-in-soyuz: This is being
139 # addressed in the work on the blueprint:
140 # https://blueprints.launchpad.net/soyuz/+spec/security-in-soyuz
141 target_pocket = build.pocket
142 assert target_pocket != PackagePublishingPocket.SECURITY, (
143 "Soyuz is not yet capable of building SECURITY uploads.")
144
145 # Ensure build has the needed chroot
146 chroot = build.distroarchseries.getChroot()
147 if chroot is None:
148 raise CannotBuild(
149 "Missing CHROOT for %s/%s/%s" % (
150 build.distroseries.distribution.name,
151 build.distroseries.name,
152 build.distroarchseries.architecturetag)
153 )
154
155 # The main distribution has policies to prevent uploads to some
156 # pockets (e.g. security) during different parts of the distribution
157 # series lifecycle. These do not apply to PPA builds nor any archive
158 # that allows release pocket updates.
159 if (build.archive.purpose != ArchivePurpose.PPA and
160 not build.archive.allowUpdatesToReleasePocket()):
161 # XXX Robert Collins 2007-05-26: not an explicit CannotBuild
162 # exception yet because the callers have not been audited
163 assert build.distroseries.canUploadToPocket(build.pocket), (
164 "%s (%s) can not be built for pocket %s: invalid pocket due "
165 "to the series status of %s."
166 % (build.title, build.id, build.pocket.name,
167 build.distroseries.name))
168
169 def _cachePrivateSourceOnSlave(self, build_queue_item, logger):
170 """Ask the slave to download source files for a private build.
171
172 The slave will cache the files for the source in build_queue_item
173 to its local disk in preparation for a private build. Private builds
174 will always take the source files from the archive rather than the
175 librarian since the archive has more granular access to each
176 archive's files.
177
178 :param build_queue_item: The `IBuildQueue` being built.
179 :param logger: A logger used for providing debug information.
180 """
181 # The URL to the file in the archive consists of these parts:
182 # archive_url / makePoolPath() / filename
183 # Once this is constructed we add the http basic auth info.
184
185 # Avoid circular imports.
186 from lp.soyuz.model.publishing import makePoolPath
187
188 build = getUtility(IBuildSet).getByQueueEntry(build_queue_item)
189 archive = build.archive
190 archive_url = archive.archive_url
191 component_name = build.current_component.name
192 for source_file in build.sourcepackagerelease.files:
193 file_name = source_file.libraryfile.filename
194 sha1 = source_file.libraryfile.content.sha1
195 source_name = build.sourcepackagerelease.sourcepackagename.name
196 poolpath = makePoolPath(source_name, component_name)
197 url = urlappend(archive_url, poolpath)
198 url = urlappend(url, file_name)
199 logger.debug("Asking builder on %s to ensure it has file %s "
200 "(%s, %s)" % (
201 self._builder.url, file_name, url, sha1))
202 self._builder._sendFileToSlave(
203 url, sha1, "buildd", archive.buildd_secret)
204
205 def _extraBuildArgs(self, build):
206 """
207 Return the extra arguments required by the slave for the given build.
208 """
209 # Build extra arguments.
210 args = {}
211 # turn 'arch_indep' ON only if build is archindep or if
212 # the specific architecture is the nominatedarchindep for
213 # this distroseries (in case it requires any archindep source)
214 args['arch_indep'] = build.distroarchseries.isNominatedArchIndep
215
216 suite = build.distroarchseries.distroseries.name
217 if build.pocket != PackagePublishingPocket.RELEASE:
218 suite += "-%s" % (build.pocket.name.lower())
219 args['suite'] = suite
220
221 archive_purpose = build.archive.purpose
222 if (archive_purpose == ArchivePurpose.PPA and
223 not build.archive.require_virtualized):
224 # If we're building a non-virtual PPA, override the purpose
225 # to PRIMARY and use the primary component override.
226 # This ensures that the package mangling tools will run over
227 # the built packages.
228 args['archive_purpose'] = ArchivePurpose.PRIMARY.name
229 args["ogrecomponent"] = (
230 get_primary_current_component(build))
231 else:
232 args['archive_purpose'] = archive_purpose.name
233 args["ogrecomponent"] = (
234 build.current_component.name)
235
236 args['archives'] = get_sources_list_for_building(build)
237
238 # Let the build slave know whether this is a build in a private
239 # archive.
240 args['archive_private'] = build.archive.private
241 return args
36242
=== modified file 'lib/lp/soyuz/model/builder.py'
--- lib/lp/soyuz/model/builder.py 2009-12-02 08:50:30 +0000
+++ lib/lp/soyuz/model/builder.py 2009-12-02 08:50:31 +0000
@@ -38,8 +38,6 @@
38from lp.buildmaster.master import BuilddMaster38from lp.buildmaster.master import BuilddMaster
39from lp.buildmaster.model.buildfarmjobbehavior import IdleBuildBehavior39from lp.buildmaster.model.buildfarmjobbehavior import IdleBuildBehavior
40from canonical.database.sqlbase import SQLBase, sqlvalues40from canonical.database.sqlbase import SQLBase, sqlvalues
41from lp.soyuz.adapters.archivedependencies import (
42 get_primary_current_component, get_sources_list_for_building)
43from lp.soyuz.model.buildqueue import BuildQueue41from lp.soyuz.model.buildqueue import BuildQueue
44from lp.registry.interfaces.person import validate_public_person42from lp.registry.interfaces.person import validate_public_person
45from lp.registry.interfaces.pocket import PackagePublishingPocket43from lp.registry.interfaces.pocket import PackagePublishingPocket
@@ -117,6 +115,7 @@
117115
118 return (stdout, stderr, resume_process.returncode)116 return (stdout, stderr, resume_process.returncode)
119117
118
120class Builder(SQLBase):119class Builder(SQLBase):
121120
122 implements(IBuilder, IHasBuildRecords)121 implements(IBuilder, IHasBuildRecords)
@@ -195,30 +194,6 @@
195 url, libraryfilealias.content.sha1))194 url, libraryfilealias.content.sha1))
196 self._sendFileToSlave(url, libraryfilealias.content.sha1)195 self._sendFileToSlave(url, libraryfilealias.content.sha1)
197196
198 def cachePrivateSourceOnSlave(self, logger, build_queue_item):
199 """See `IBuilder`."""
200 # The URL to the file in the archive consists of these parts:
201 # archive_url / makePoolPath() / filename
202 # Once this is constructed we add the http basic auth info.
203
204 # Avoid circular imports.
205 from lp.soyuz.model.publishing import makePoolPath
206
207 build = getUtility(IBuildSet).getByQueueEntry(build_queue_item)
208 archive = build.archive
209 archive_url = archive.archive_url
210 component_name = build.current_component.name
211 for source_file in build.sourcepackagerelease.files:
212 file_name = source_file.libraryfile.filename
213 sha1 = source_file.libraryfile.content.sha1
214 source_name = build.sourcepackagerelease.sourcepackagename.name
215 poolpath = makePoolPath(source_name, component_name)
216 url = urlappend(archive_url, poolpath)
217 url = urlappend(url, file_name)
218 logger.debug("Asking builder on %s to ensure it has file %s "
219 "(%s, %s)" % (self.url, file_name, url, sha1))
220 self._sendFileToSlave(url, sha1, "buildd", archive.buildd_secret)
221
222 def _sendFileToSlave(self, url, sha1, username="", password=""):197 def _sendFileToSlave(self, url, sha1, username="", password=""):
223 """Helper to send the file at 'url' with 'sha1' to this builder."""198 """Helper to send the file at 'url' with 'sha1' to this builder."""
224 if not self.builderok:199 if not self.builderok:
@@ -308,99 +283,6 @@
308 """See IBuilder."""283 """See IBuilder."""
309 self.slave = proxy284 self.slave = proxy
310285
311 def _verifyBuildRequest(self, build_queue_item, logger):
312 """Assert some pre-build checks.
313
314 The build request is checked:
315 * Virtualized builds can't build on a non-virtual builder
316 * Ensure that we have a chroot
317 * Ensure that the build pocket allows builds for the current
318 distroseries state.
319 """
320 build = getUtility(IBuildSet).getByQueueEntry(build_queue_item)
321 assert not (not self.virtualized and build.is_virtualized), (
322 "Attempt to build non-virtual item on a virtual builder.")
323
324 # Assert that we are not silently building SECURITY jobs.
325 # See findBuildCandidates. Once we start building SECURITY
326 # correctly from EMBARGOED archive this assertion can be removed.
327 # XXX Julian 2007-12-18 spec=security-in-soyuz: This is being
328 # addressed in the work on the blueprint:
329 # https://blueprints.launchpad.net/soyuz/+spec/security-in-soyuz
330 target_pocket = build.pocket
331 assert target_pocket != PackagePublishingPocket.SECURITY, (
332 "Soyuz is not yet capable of building SECURITY uploads.")
333
334 # Ensure build has the needed chroot
335 build = getUtility(IBuildSet).getByQueueEntry(build_queue_item)
336 chroot = build.distroarchseries.getChroot()
337 if chroot is None:
338 raise CannotBuild(
339 "Missing CHROOT for %s/%s/%s" % (
340 build.distroseries.distribution.name,
341 build.distroseries.name,
342 build.distroarchseries.architecturetag)
343 )
344
345 # The main distribution has policies to prevent uploads to some
346 # pockets (e.g. security) during different parts of the distribution
347 # series lifecycle. These do not apply to PPA builds nor any archive
348 # that allows release pocket updates.
349 if (build.archive.purpose != ArchivePurpose.PPA and
350 not build.archive.allowUpdatesToReleasePocket()):
351 # XXX Robert Collins 2007-05-26: not an explicit CannotBuild
352 # exception yet because the callers have not been audited
353 assert build.distroseries.canUploadToPocket(build.pocket), (
354 "%s (%s) can not be built for pocket %s: invalid pocket due "
355 "to the series status of %s."
356 % (build.title, build.id, build.pocket.name,
357 build.distroseries.name))
358
359 def _dispatchBuildToSlave(self, build_queue_item, args, buildid, logger):
360 """Start the build on the slave builder."""
361 # Send chroot.
362 build = getUtility(IBuildSet).getByQueueEntry(build_queue_item)
363 chroot = build.distroarchseries.getChroot()
364 self.cacheFileOnSlave(logger, chroot)
365
366 # Build filemap structure with the files required in this build
367 # and send them to the slave.
368 # If the build is private we tell the slave to get the files from the
369 # archive instead of the librarian because the slaves cannot
370 # access the restricted librarian.
371 private = build.archive.private
372 if private:
373 self.cachePrivateSourceOnSlave(logger, build_queue_item)
374 filemap = {}
375 for source_file in build.sourcepackagerelease.files:
376 lfa = source_file.libraryfile
377 filemap[lfa.filename] = lfa.content.sha1
378 if not private:
379 self.cacheFileOnSlave(logger, source_file.libraryfile)
380
381 chroot_sha1 = chroot.content.sha1
382 try:
383 status, info = self.slave.build(
384 buildid, "debian", chroot_sha1, filemap, args)
385 message = """%s (%s):
386 ***** RESULT *****
387 %s
388 %s
389 %s: %s
390 ******************
391 """ % (self.name, self.url, filemap, args, status, info)
392 logger.info(message)
393 except xmlrpclib.Fault, info:
394 # Mark builder as 'failed'.
395 logger.debug("Disabling builder: %s" % self.url, exc_info=1)
396 self.failbuilder(
397 "Exception (%s) when setting up to new job" % info)
398 raise BuildSlaveFailure
399 except socket.error, info:
400 error_message = "Exception (%s) when setting up new job" % info
401 self.handleTimeout(logger, error_message)
402 raise BuildSlaveFailure
403
404 def startBuild(self, build_queue_item, logger):286 def startBuild(self, build_queue_item, logger):
405 """See IBuilder."""287 """See IBuilder."""
406 # Set the build behavior depending on the provided build queue item.288 # Set the build behavior depending on the provided build queue item.
@@ -408,55 +290,15 @@
408 self.logStartBuild(build_queue_item, logger)290 self.logStartBuild(build_queue_item, logger)
409291
410 # Make sure the request is valid; an exception is raised if it's not.292 # Make sure the request is valid; an exception is raised if it's not.
411 self._verifyBuildRequest(build_queue_item, logger)293 self.verifyBuildRequest(build_queue_item, logger)
412294
413 # If we are building a virtual build, resume the virtual machine.295 # If we are building a virtual build, resume the virtual machine.
414 if self.virtualized:296 if self.virtualized:
415 self.resumeSlaveHost()297 self.resumeSlaveHost()
416298
417 # Build extra arguments.
418 args = {}
419 # turn 'arch_indep' ON only if build is archindep or if
420 # the specific architecture is the nominatedarchindep for
421 # this distroseries (in case it requires any archindep source)
422 build = getUtility(IBuildSet).getByQueueEntry(build_queue_item)
423 args['arch_indep'] = build.distroarchseries.isNominatedArchIndep
424
425 suite = build.distroarchseries.distroseries.name
426 if build.pocket != PackagePublishingPocket.RELEASE:
427 suite += "-%s" % (build.pocket.name.lower())
428 args['suite'] = suite
429
430 archive_purpose = build.archive.purpose
431 if (archive_purpose == ArchivePurpose.PPA and
432 not build.archive.require_virtualized):
433 # If we're building a non-virtual PPA, override the purpose
434 # to PRIMARY and use the primary component override.
435 # This ensures that the package mangling tools will run over
436 # the built packages.
437 args['archive_purpose'] = ArchivePurpose.PRIMARY.name
438 args["ogrecomponent"] = (
439 get_primary_current_component(build))
440 else:
441 args['archive_purpose'] = archive_purpose.name
442 args["ogrecomponent"] = (
443 build.current_component.name)
444
445 args['archives'] = get_sources_list_for_building(build)
446
447 # Let the build slave know whether this is a build in a private
448 # archive.
449 args['archive_private'] = build.archive.private
450
451 # Generate a string which can be used to cross-check when obtaining
452 # results so we know we are referring to the right database object in
453 # subsequent runs.
454 buildid = "%s-%s" % (build.id, build_queue_item.id)
455 logger.debug("Initiating build %s on %s" % (buildid, self.url))
456
457 # Do it.299 # Do it.
458 build_queue_item.markAsBuilding(self)300 build_queue_item.markAsBuilding(self)
459 self._dispatchBuildToSlave(build_queue_item, args, buildid, logger)301 self.dispatchBuildToSlave(build_queue_item, logger)
460302
461 # XXX cprov 2009-06-24: This code does not belong to the content303 # XXX cprov 2009-06-24: This code does not belong to the content
462 # class domain. Here we cannot make sensible decisions about what304 # class domain. Here we cannot make sensible decisions about what
@@ -469,19 +311,10 @@
469 if self.failnotes is not None:311 if self.failnotes is not None:
470 return self.failnotes312 return self.failnotes
471 return 'Disabled'313 return 'Disabled'
472 # Cache the 'currentjob', so we don't have to hit the database
473 # more than once.
474 currentjob = self.currentjob
475 if currentjob is None:
476 return 'Idle'
477314
478 build = getUtility(IBuildSet).getByQueueEntry(currentjob)315 # If the builder is OK then we delegate the status
479 msg = 'Building %s' % build.title316 # to our current behavior.
480 archive = build.archive317 return self.current_build_behavior.status
481 if not archive.owner.private and (archive.is_ppa or archive.is_copy):
482 return '%s [%s/%s]' % (msg, archive.owner.name, archive.name)
483 else:
484 return msg
485318
486 def failbuilder(self, reason):319 def failbuilder(self, reason):
487 """See IBuilder"""320 """See IBuilder"""
@@ -722,7 +555,7 @@
722 logger = self._getSlaveScannerLogger()555 logger = self._getSlaveScannerLogger()
723 try:556 try:
724 self.startBuild(candidate, logger)557 self.startBuild(candidate, logger)
725 except (BuildSlaveFailure, CannotBuild), err:558 except (BuildSlaveFailure, CannotBuild, BuildBehaviorMismatch), err:
726 logger.warn('Could not build: %s' % err)559 logger.warn('Could not build: %s' % err)
727560
728 def handleTimeout(self, logger, error_message):561 def handleTimeout(self, logger, error_message):

Subscribers

People subscribed via source and target branches

to status/vote changes: