Gentoo Archives: gentoo-portage-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-portage-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-portage-dev] [PATCH 6/7] eapply: Pass exit status through on non-fatal failures
Date: Mon, 09 Nov 2015 17:50:59
Message-Id: 1447091377-2902-7-git-send-email-mgorny@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCHES] EAPI 6 updates by "Michał Górny"
1 ---
2 bin/phase-helpers.sh | 10 ++++++----
3 1 file changed, 6 insertions(+), 4 deletions(-)
4
5 diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
6 index bd4e999..6cd0859 100644
7 --- a/bin/phase-helpers.sh
8 +++ b/bin/phase-helpers.sh
9 @@ -981,6 +981,8 @@ fi
10
11 if ___eapi_has_eapply; then
12 eapply() {
13 + local failed
14 +
15 _eapply_patch() {
16 local f=${1}
17 local prefix=${2}
18 @@ -994,9 +996,9 @@ if ___eapi_has_eapply; then
19 # --no-backup-if-mismatch not to pollute the sources
20 patch -p1 -f -s -g0 --no-backup-if-mismatch \
21 "${patch_options[@]}" < "${f}"
22 - if ! eend ${?}; then
23 + failed=${?}
24 + if ! eend "${failed}"; then
25 __helpers_die "patch -p1 ${patch_options[*]} failed with ${f}"
26 - failed=1
27 fi
28 }
29
30 @@ -1054,13 +1056,13 @@ if ___eapi_has_eapply; then
31 _eapply_patch "${f2}" ' '
32
33 # in case of nonfatal
34 - [[ -n ${failed} ]] && return 1
35 + [[ ${failed} -ne 0 ]] && return "${failed}"
36 done
37 else
38 _eapply_patch "${f}"
39
40 # in case of nonfatal
41 - [[ -n ${failed} ]] && return 1
42 + [[ ${failed} -ne 0 ]] && return "${failed}"
43 fi
44 done
45
46 --
47 2.6.3