From 40a1389c10cd500a9dfd4fada7c8afcda9fe8aab Mon Sep 17 00:00:00 2001
From: Jean-Claude Bau <jean-claude.bau@cern.ch>
Date: Wed, 19 Jun 2019 11:28:52 +0200
Subject: [PATCH] wrs_build_all: Exit on error

Having just a small message indicating that a build error has been
detected at the end of the script is not sufficient. The tarball is
created but is invalid and might be used.
Now, when an error is detected the build procedure is immediately
aborted. The tarball is not then created.
---
 build/wrs_build-all | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/build/wrs_build-all b/build/wrs_build-all
index d55a5bdc3..433de942d 100755
--- a/build/wrs_build-all
+++ b/build/wrs_build-all
@@ -125,17 +125,13 @@ wrs_build_step () {
     # I sometimes set WRS_SH_OPTIONS to "-x" to help me in debugging
     bash $WRS_SH_OPTIONS $script
     if [ $? -ne 0 ];
-	then failed_step=true;
-	else touch $markerfile
+	then
+		wrs_die "Building step $script failed. Build aborted !"
+	else 
+		touch $markerfile
     fi
 }
 
-
-
-
-
-failed_step=false; # this is set to "true" but the wrs_build_step function
-
 # Now build the stuff one step at a time, only if not already done.
 # Steps 0 and 11 are redone in any case:
 #   step 0 is downloading, and re-cecking md5sum has no side effects
@@ -157,7 +153,4 @@ wrs_build_step    09-wrs-userspace       wrs_build_userspace
 wrs_build_step    10-wrs-gateware        wrs_build_gateware
 wrs_build_step    11-wrap-rootfs         wrs_build_wraprootfs
 
-if $failed_step; then
-    wrs_die "One or more build steps failed"
-fi
 wrs_echo "Complete build succeeded, apparently"
-- 
GitLab