← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~wgrant/launchpad-buildd/depfail-fallback into lp:launchpad-buildd

 

William Grant has proposed merging lp:~wgrant/launchpad-buildd/depfail-fallback into lp:launchpad-buildd.

Commit message:
Fix sbuild error translation to correctly map an unknown DEPFAIL to PACKAGEFAIL, rather than erroneously falling back to OK.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1235038 in launchpad-buildd: "launchpad-buildd treats unknown DEPFAILs as OK"
  https://bugs.launchpad.net/launchpad-buildd/+bug/1235038

For more details, see:
https://code.launchpad.net/~wgrant/launchpad-buildd/depfail-fallback/+merge/189200

The log pattern matching rework in r78 broke the case where BinaryPackageBuildManager gets a DEPFAIL from sbuild but is unable to extract the missing dependency from the log. No pattern matches, and it erroneously falls through and reports that the build is OK. This fixes the case where no pattern matches to correctly fall back to PACKAGEFAIL, and adds a test.
-- 
https://code.launchpad.net/~wgrant/launchpad-buildd/depfail-fallback/+merge/189200
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad-buildd/depfail-fallback into lp:launchpad-buildd.
=== modified file 'debian/changelog'
--- debian/changelog	2013-10-03 11:44:33 +0000
+++ debian/changelog	2013-10-04 01:07:43 +0000
@@ -1,3 +1,10 @@
+launchpad-buildd (118) UNRELEASED; urgency=low
+
+  * Fix fallback to PACKAGEFAIL of unknown sbuild DEPFAIL conditions
+    (LP: #1235038).
+
+ -- William Grant <william.grant@xxxxxxxxxxxxx>  Fri, 04 Oct 2013 11:03:51 +1000
+
 launchpad-buildd (117) hardy; urgency=low
 
   * Fix dep-wait detection when recipes fail to install build-dependencies

=== modified file 'lpbuildd/binarypackage.py'
--- lpbuildd/binarypackage.py	2013-09-27 11:56:18 +0000
+++ lpbuildd/binarypackage.py	2013-10-04 01:07:43 +0000
@@ -115,6 +115,8 @@
                             success = SBuildExitCodes.DEPFAIL
                     else:
                         success = SBuildExitCodes.PACKAGEFAIL
+                else:
+                    success = SBuildExitCodes.PACKAGEFAIL
 
             if success == SBuildExitCodes.GIVENBACK:
                 if not self.alreadyfailed:

=== modified file 'lpbuildd/tests/test_binarypackage.py'
--- lpbuildd/tests/test_binarypackage.py	2013-09-27 10:34:13 +0000
+++ lpbuildd/tests/test_binarypackage.py	2013-10-04 01:07:43 +0000
@@ -280,3 +280,25 @@
         self.assertEqual(
             self.buildmanager.iterate, self.buildmanager.iterators[-1])
         self.assertFalse(self.slave.wasCalled('buildFail'))
+
+    def test_depfail_with_unknown_error_converted_to_packagefail(self):
+        # The build manager converts a DEPFAIL to a PACKAGEFAIL if the
+        # missing dependency can't be determined from the log.
+        self.startBuild()
+
+        log_path = os.path.join(self.buildmanager._cachepath, 'buildlog')
+        log = open(log_path, 'w')
+        log.write("E: Everything is broken.\n")
+        log.close()
+
+        # After building the package, reap processes.
+        self.buildmanager.iterate(1)
+        expected_command = [
+            'processscanpath', 'scan-for-processes', self.buildid,
+            ]
+        self.assertEqual(BinaryPackageBuildState.SBUILD, self.getState())
+        self.assertEqual(expected_command, self.buildmanager.commands[-1])
+        self.assertNotEqual(
+            self.buildmanager.iterate, self.buildmanager.iterators[-1])
+        self.assertTrue(self.slave.wasCalled('buildFail'))
+        self.assertFalse(self.slave.wasCalled('depFail'))


Follow ups