Bug 952206 - Abort execution when a required make file fails to remake; r=bsmedberg default tip
authorGregory Szorc <gps@mozilla.com>
Thu, 19 Dec 2013 11:18:23 -0800
changeset 362 d564760b353ecaeaa28aeea873b96505d9668560
parent 361 8fa921cbf2ffdfd556eb3de6318d8955f38dfd59
push id230
push usergszorc@mozilla.com
push dateMon, 06 Jan 2014 18:34:34 +0000
Bug 952206 - Abort execution when a required make file fails to remake; r=bsmedberg Previously, errors during make file making (either the main make file or an included make file) were ignored. This behavior diverged from GNU Make, which aborted execution if the make file was required and ignored the failure if it was optional. This patch changes pymake to abort if the make file is required, brining its behavior inline with GNU make.
--- a/pymake/data.py
+++ b/pymake/data.py
@@ -1586,18 +1586,23 @@ class _RemakeContext(object):
         self.toremake = list(self.included)
         self.cb = cb
         self.remakecb(error=False, didanything=False)
     def remakecb(self, error, didanything):
         assert error in (True, False)
-        if error and self.required:
-            print "Error remaking makefiles (ignored)"
+        if error:
+            if self.required:
+                self.cb(remade=False, error=util.MakeError(
+                    'Error remaking required makefiles'))
+                return
+            else:
+                print 'Error remaking makefiles (ignored)'
         if len(self.toremake):
             target, self.required = self.toremake.pop(0)
             target.make(self.makefile, [], avoidremakeloop=True, cb=self.remakecb, printerror=False)
             for t, required in self.included:
                 if t.wasremade:
                     _log.info("Included file %s was remade, restarting make", t.target)
new file mode 100644
--- /dev/null
+++ b/tests/include-required-fails.mk
@@ -0,0 +1,12 @@
+#T returncode: 2
+# Required include targets that fail should abort execution.
+include dummy.mk
+	@echo TEST-FAIL
+	@echo "Evaluated dummy.mk"
+	exit 1