Merge lp:~cjwatson/launchpad-buildd/missing-changes into lp:launchpad-buildd

Proposed by Colin Watson
Status: Merged
Approved by: William Grant
Approved revision: 76
Merged at revision: 77
Proposed branch: lp:~cjwatson/launchpad-buildd/missing-changes
Merge into: lp:launchpad-buildd
Diff against target: 78 lines (+48/-1)
3 files modified
debian/changelog (+2/-0)
lpbuildd/binarypackage.py (+6/-1)
lpbuildd/tests/test_binarypackage.py (+40/-0)
To merge this branch: bzr merge lp:~cjwatson/launchpad-buildd/missing-changes
Reviewer Review Type Date Requested Status
William Grant code Approve
Review via email: mp+184591@code.launchpad.net

Commit message

If the expected .changes file doesn't exist, consider this as a package build failure rather than crashing.

Description of the change

The build slave crashes if the expected .changes file doesn't exist at the end of a build. We should just consider this a package failure instead.

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) :
review: Approve (code)
77. By Colin Watson

merge trunk

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/changelog'
--- debian/changelog 2013-09-18 12:20:31 +0000
+++ debian/changelog 2013-09-24 08:54:25 +0000
@@ -3,6 +3,8 @@
3 [ Colin Watson ]3 [ Colin Watson ]
4 * Remove obsolete BuilderStatus.ABORTED.4 * Remove obsolete BuilderStatus.ABORTED.
5 * Remove obsolete BuildDSlave.fetchFile method, unused since October 2005.5 * Remove obsolete BuildDSlave.fetchFile method, unused since October 2005.
6 * If the expected .changes file doesn't exist, consider this as a package
7 build failure rather than crashing (LP: #993642).
68
7 [ Adam Conrad ]9 [ Adam Conrad ]
8 * Tidy up log formatting of the "Already reaped..." message. 10 * Tidy up log formatting of the "Already reaped..." message.
911
=== modified file 'lpbuildd/binarypackage.py'
--- lpbuildd/binarypackage.py 2013-07-25 17:26:10 +0000
+++ lpbuildd/binarypackage.py 2013-09-24 08:54:25 +0000
@@ -127,7 +127,12 @@
127 self.doReapProcesses(self._state)127 self.doReapProcesses(self._state)
128 else:128 else:
129 print("Returning build status: OK")129 print("Returning build status: OK")
130 self.gatherResults()130 try:
131 self.gatherResults()
132 except Exception, e:
133 print("Failed to gather results: %s" % e)
134 self._slave.buildFail()
135 self.alreadyfailed = True
131 self.doReapProcesses(self._state)136 self.doReapProcesses(self._state)
132137
133 def iterateReap_SBUILD(self, success):138 def iterateReap_SBUILD(self, success):
134139
=== modified file 'lpbuildd/tests/test_binarypackage.py'
--- lpbuildd/tests/test_binarypackage.py 2013-07-26 18:22:25 +0000
+++ lpbuildd/tests/test_binarypackage.py 2013-09-24 08:54:25 +0000
@@ -204,3 +204,43 @@
204 self.assertEqual(expected_command, self.buildmanager.commands[-1])204 self.assertEqual(expected_command, self.buildmanager.commands[-1])
205 self.assertEqual(205 self.assertEqual(
206 self.buildmanager.iterate, self.buildmanager.iterators[-1])206 self.buildmanager.iterate, self.buildmanager.iterators[-1])
207
208 def test_missing_changes(self):
209 # The build manager recovers if the expected .changes file does not
210 # exist, and considers it a package build failure.
211 self.startBuild()
212
213 log_path = os.path.join(self.buildmanager._cachepath, 'buildlog')
214 log = open(log_path, 'w')
215 log.write("I am a build log.")
216 log.close()
217
218 changes_path = os.path.join(
219 self.buildmanager.home, 'build-%s' % self.buildid,
220 'foo_2_i386.changes')
221 changes = open(changes_path, 'w')
222 changes.write("I am a changes file.")
223 changes.close()
224
225 # After building the package, reap processes.
226 self.buildmanager.iterate(0)
227 expected_command = [
228 'processscanpath', 'processscanpath', self.buildid,
229 ]
230 self.assertEqual(BinaryPackageBuildState.SBUILD, self.getState())
231 self.assertEqual(expected_command, self.buildmanager.commands[-1])
232 self.assertNotEqual(
233 self.buildmanager.iterate, self.buildmanager.iterators[-1])
234 self.assertTrue(self.slave.wasCalled('buildFail'))
235 self.assertEqual([], self.slave.addWaitingFile.calls)
236
237 # Control returns to the DebianBuildManager in the UMOUNT state.
238 self.buildmanager.iterateReap(self.getState(), 0)
239 expected_command = [
240 'umountpath', 'umount-chroot', self.buildid
241 ]
242 self.assertEqual(BinaryPackageBuildState.UMOUNT, self.getState())
243 self.assertEqual(expected_command, self.buildmanager.commands[-1])
244 self.assertEqual(
245 self.buildmanager.iterate, self.buildmanager.iterators[-1])
246 self.assertTrue(self.slave.wasCalled('buildFail'))

Subscribers

People subscribed via source and target branches

to all changes: