build: Ensure that SAMBA_GENERATOR() tasks fail on error
authorAndrew Bartlett <abartlet@samba.org>
Tue, 21 Jun 2022 07:23:26 +0000 (19:23 +1200)
committerAndreas Schneider <asn@cryptomilk.org>
Wed, 22 Jun 2022 16:43:30 +0000 (16:43 +0000)
Previously the error from inside the shell was eaten.

This showed up particularly as a failure to notice errors when running xsltproc
to build the manpages.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed Jun 22 16:43:30 UTC 2022 on sn-devel-184

buildtools/wafsamba/wafsamba.py

index 063f9d2ed758d72178a4bce794aaa2919caa3c02..79f352878a8778ac6ca5dadb3fd43b1fc5126cf4 100644 (file)
@@ -913,12 +913,19 @@ def SAMBA_GENERATOR(bld, name, rule, source='', target='',
     dep_vars.append('ruledeps')
     dep_vars.append('SAMBA_GENERATOR_VARS')
 
+    shell=isinstance(rule, str)
+
+    # This ensures that if the command (executed in the shell) fails
+    # (returns non-zero), the build fails
+    if shell:
+        rule = "set -e; " + rule
+
     bld.SET_BUILD_GROUP(group)
     t = bld(
         rule=rule,
         source=bld.EXPAND_VARIABLES(source, vars=vars),
+        shell=shell,
         target=target,
-        shell=isinstance(rule, str),
         update_outputs=True,
         before='c',
         ext_out='.c',