commit:     c7b5c849905a00774bd4957e14b49cfe0e6ceafd
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Nov  9 17:39:47 2015 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Nov 12 19:32:37 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=c7b5c849

eapply: Pass exit status through on non-fatal failures

 bin/phase-helpers.sh | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index 511a41a..7e5dbbc 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -981,6 +981,8 @@ fi
 
 if ___eapi_has_eapply; then
        eapply() {
+               local failed
+
                _eapply_patch() {
                        local f=${1}
                        local prefix=${2}
@@ -994,9 +996,9 @@ if ___eapi_has_eapply; then
                        # --no-backup-if-mismatch not to pollute the sources
                        patch -p1 -f -s -g0 --no-backup-if-mismatch \
                                "${patch_options[@]}" < "${f}"
-                       if ! eend ${?}; then
+                       failed=${?}
+                       if ! eend "${failed}"; then
                                __helpers_die "patch -p1 ${patch_options[*]} 
failed with ${f}"
-                               failed=1
                        fi
                }
 
@@ -1054,13 +1056,13 @@ if ___eapi_has_eapply; then
                                        _eapply_patch "${f2}" '  '
 
                                        # in case of nonfatal
-                                       [[ -n ${failed} ]] && return 1
+                                       [[ ${failed} -ne 0 ]] && return 
"${failed}"
                                done
                        else
                                _eapply_patch "${f}"
 
                                # in case of nonfatal
-                               [[ -n ${failed} ]] && return 1
+                               [[ ${failed} -ne 0 ]] && return "${failed}"
                        fi
                done
 

Reply via email to