function apply_patch() now returns a status rather than directely breaking the
loop of its caller. (for loop in main, continue statment in apply_patch())

Signed-off-by: Christophe Milard <[email protected]>
---
 apply-and-build.sh | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/apply-and-build.sh b/apply-and-build.sh
index 683a0b6..bf0300f 100755
--- a/apply-and-build.sh
+++ b/apply-and-build.sh
@@ -170,7 +170,7 @@ apply_patch() {
                 git checkout . || exit 1
                 git clean -xdf || exit 1
                 popd > /dev/null
-                continue
+                return 1
             else
                 #3way apply worked
                 echo "  Warning: git am --3way, applied"
@@ -182,7 +182,7 @@ apply_patch() {
             git checkout . || exit 1
             git clean -xdf || exit 1
             popd > /dev/null
-            continue
+            return 1
         fi
     else
         #patch successfully applied:
@@ -194,6 +194,7 @@ apply_patch() {
     fi
 
     popd > /dev/null
+    return 0
 }
 
 format_patch() {
@@ -261,6 +262,10 @@ for patch in $(find $PATCH_DIR -type f -iregex 
"${FILE_EXT_REGEX}" |sort -h); do
     CURRENT_LOG="${ODP_LOGDIR}/$(echo $(basename ${patch}))"
     echo -e "\n\nUsing patch: $(basename ${patch})"
     apply_patch ${ODP_BUILDDIR} ${CURRENT_LOG}
+    #if applying the patch failed, take next one:
+    if [ $? -ne 0 ]; then
+        continue
+    fi
 
     format_patch ${ODP_BUILDDIR} ${CURRENT_LOG}
 
-- 
1.9.1

_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to