diff mbox

[PATCHv2] apply-and-build.sh: cosmetic fix

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

Commit Message

Christophe Milard May 29, 2015, 10:58 a.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 | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Anders Roxell June 1, 2015, 9:26 a.m. UTC | #1
On 2015-05-29 12:58, Christophe Milard wrote:
> 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 | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/apply-and-build.sh b/apply-and-build.sh
> index d4cc0d9..d81eff5 100755
> --- a/apply-and-build.sh
> +++ b/apply-and-build.sh
> @@ -160,7 +160,7 @@ apply_patch() {
>              git checkout . || exit 1
>              git clean -xdf || exit 1
>              popd > /dev/null
> -            continue
> +            return 1
>          else
>              echo "  Warning: git am --3way, applied"
>          fi
> @@ -173,6 +173,7 @@ apply_patch() {
>      fi
>  
>      popd > /dev/null
> +    return 0
>  }
>  
>  format_patch() {
> @@ -238,8 +239,12 @@ FILE_EXT_REGEX=".*\.\("$(echo ${FILE_EXT}|sed -e 's/[ ,]/\\|/g')"\)$"
>  for patch in $(find $PATCH_DIR -type f -iregex "${FILE_EXT_REGEX}" |sort -h); do
>      BUILD_FAILURE=0
>      CURRENT_LOG="${ODP_LOGDIR}/$(echo $(basename ${patch}))"
> +
>      echo -e "\n\nUsing patch: $(basename ${patch})"
>      apply_patch ${ODP_BUILDDIR} ${CURRENT_LOG}
> +    if [ $? -ne 0 ]; then
> +        continue    #go directely to next pacth if patch application failed
> +    fi
>  
>      format_patch ${ODP_BUILDDIR} ${CURRENT_LOG}
>  
> -- 
> 1.9.1
> 

Applied.
Changed the comment a bit...

Cheers,
Anders
diff mbox

Patch

diff --git a/apply-and-build.sh b/apply-and-build.sh
index d4cc0d9..d81eff5 100755
--- a/apply-and-build.sh
+++ b/apply-and-build.sh
@@ -160,7 +160,7 @@  apply_patch() {
             git checkout . || exit 1
             git clean -xdf || exit 1
             popd > /dev/null
-            continue
+            return 1
         else
             echo "  Warning: git am --3way, applied"
         fi
@@ -173,6 +173,7 @@  apply_patch() {
     fi
 
     popd > /dev/null
+    return 0
 }
 
 format_patch() {
@@ -238,8 +239,12 @@  FILE_EXT_REGEX=".*\.\("$(echo ${FILE_EXT}|sed -e 's/[ ,]/\\|/g')"\)$"
 for patch in $(find $PATCH_DIR -type f -iregex "${FILE_EXT_REGEX}" |sort -h); do
     BUILD_FAILURE=0
     CURRENT_LOG="${ODP_LOGDIR}/$(echo $(basename ${patch}))"
+
     echo -e "\n\nUsing patch: $(basename ${patch})"
     apply_patch ${ODP_BUILDDIR} ${CURRENT_LOG}
+    if [ $? -ne 0 ]; then
+        continue    #go directely to next pacth if patch application failed
+    fi
 
     format_patch ${ODP_BUILDDIR} ${CURRENT_LOG}