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 d564760b353e
parent 361 8fa921cbf2ff
push id230
push usergszorc@mozilla.com
push dateMon, 06 Jan 2014 18:34:34 +0000
reviewersbsmedberg
bugs952206
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.
pymake/data.py
tests/include-required-fails.mk
--- 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)
         else:
             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
+
+all:
+	@echo TEST-FAIL
+
+dummy.mk:
+	@echo "Evaluated dummy.mk"
+	exit 1