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
1=== modified file 'debian/changelog'
2--- debian/changelog 2013-09-18 12:20:31 +0000
3+++ debian/changelog 2013-09-24 08:54:25 +0000
4@@ -3,6 +3,8 @@
5 [ Colin Watson ]
6 * Remove obsolete BuilderStatus.ABORTED.
7 * Remove obsolete BuildDSlave.fetchFile method, unused since October 2005.
8+ * If the expected .changes file doesn't exist, consider this as a package
9+ build failure rather than crashing (LP: #993642).
10
11 [ Adam Conrad ]
12 * Tidy up log formatting of the "Already reaped..." message.
13
14=== modified file 'lpbuildd/binarypackage.py'
15--- lpbuildd/binarypackage.py 2013-07-25 17:26:10 +0000
16+++ lpbuildd/binarypackage.py 2013-09-24 08:54:25 +0000
17@@ -127,7 +127,12 @@
18 self.doReapProcesses(self._state)
19 else:
20 print("Returning build status: OK")
21- self.gatherResults()
22+ try:
23+ self.gatherResults()
24+ except Exception, e:
25+ print("Failed to gather results: %s" % e)
26+ self._slave.buildFail()
27+ self.alreadyfailed = True
28 self.doReapProcesses(self._state)
29
30 def iterateReap_SBUILD(self, success):
31
32=== modified file 'lpbuildd/tests/test_binarypackage.py'
33--- lpbuildd/tests/test_binarypackage.py 2013-07-26 18:22:25 +0000
34+++ lpbuildd/tests/test_binarypackage.py 2013-09-24 08:54:25 +0000
35@@ -204,3 +204,43 @@
36 self.assertEqual(expected_command, self.buildmanager.commands[-1])
37 self.assertEqual(
38 self.buildmanager.iterate, self.buildmanager.iterators[-1])
39+
40+ def test_missing_changes(self):
41+ # The build manager recovers if the expected .changes file does not
42+ # exist, and considers it a package build failure.
43+ self.startBuild()
44+
45+ log_path = os.path.join(self.buildmanager._cachepath, 'buildlog')
46+ log = open(log_path, 'w')
47+ log.write("I am a build log.")
48+ log.close()
49+
50+ changes_path = os.path.join(
51+ self.buildmanager.home, 'build-%s' % self.buildid,
52+ 'foo_2_i386.changes')
53+ changes = open(changes_path, 'w')
54+ changes.write("I am a changes file.")
55+ changes.close()
56+
57+ # After building the package, reap processes.
58+ self.buildmanager.iterate(0)
59+ expected_command = [
60+ 'processscanpath', 'processscanpath', self.buildid,
61+ ]
62+ self.assertEqual(BinaryPackageBuildState.SBUILD, self.getState())
63+ self.assertEqual(expected_command, self.buildmanager.commands[-1])
64+ self.assertNotEqual(
65+ self.buildmanager.iterate, self.buildmanager.iterators[-1])
66+ self.assertTrue(self.slave.wasCalled('buildFail'))
67+ self.assertEqual([], self.slave.addWaitingFile.calls)
68+
69+ # Control returns to the DebianBuildManager in the UMOUNT state.
70+ self.buildmanager.iterateReap(self.getState(), 0)
71+ expected_command = [
72+ 'umountpath', 'umount-chroot', self.buildid
73+ ]
74+ self.assertEqual(BinaryPackageBuildState.UMOUNT, self.getState())
75+ self.assertEqual(expected_command, self.buildmanager.commands[-1])
76+ self.assertEqual(
77+ self.buildmanager.iterate, self.buildmanager.iterators[-1])
78+ self.assertTrue(self.slave.wasCalled('buildFail'))

Subscribers

People subscribed via source and target branches

to all changes: