diff mbox

apply-and-build.sh: cosmetic fix

Message ID 1432824886-3743-1-git-send-email-christophe.milard@linaro.org
State New
Headers show

Commit Message

Christophe Milard May 28, 2015, 2:54 p.m. UTC
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 <christophe.milard@linaro.org>
---
 apply-and-build.sh | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
diff mbox

Patch

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}