1 |
Add support for die() to respect 'nonfatal' modifier if |
2 |
'--respect-nonfatal' (or '-n') option is used. This allows eclasses |
3 |
to create custom ebuild helpers that mimic built-in helper behavior. |
4 |
--- |
5 |
bin/eapi.sh | 4 ++++ |
6 |
bin/isolated-functions.sh | 7 +++++++ |
7 |
2 files changed, 11 insertions(+) |
8 |
|
9 |
diff --git a/bin/eapi.sh b/bin/eapi.sh |
10 |
index 6716b1c..c650a4c 100644 |
11 |
--- a/bin/eapi.sh |
12 |
+++ b/bin/eapi.sh |
13 |
@@ -166,6 +166,10 @@ ___eapi_unpack_supports_absolute_paths() { |
14 |
[[ ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend)$ ]] |
15 |
} |
16 |
|
17 |
+___eapi_die_can_respect_nonfatal() { |
18 |
+ [[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]] |
19 |
+} |
20 |
+ |
21 |
# OTHERS |
22 |
|
23 |
___eapi_enables_failglob_in_global_scope() { |
24 |
diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh |
25 |
index d41f0b3..f9bc90d 100644 |
26 |
--- a/bin/isolated-functions.sh |
27 |
+++ b/bin/isolated-functions.sh |
28 |
@@ -116,6 +116,13 @@ __helpers_die() { |
29 |
die() { |
30 |
local IFS=$' \t\n' |
31 |
|
32 |
+ if ___eapi_die_can_respect_nonfatal; then |
33 |
+ if [[ ${1} == -n || ${1} == --respect-nonfatal ]]; then |
34 |
+ [[ ${PORTAGE_NONFATAL} == 1 ]] && return 1 |
35 |
+ shift |
36 |
+ fi |
37 |
+ fi |
38 |
+ |
39 |
set +e |
40 |
if [ -n "${QA_INTERCEPTORS}" ] ; then |
41 |
# die was called from inside inherit. We need to clean up |
42 |
-- |
43 |
2.0.4 |