commit:     1d210dcc05676df866a1d8455f97009b3d698a66
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 18 09:47:44 2014 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Dec  4 14:01:35 2014 +0000
URL:        
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=1d210dcc

Add tentative EAPI6 nonfatal support to die()

Add support for die() to respect 'nonfatal' modifier if
'--respect-nonfatal' (or '-n') option is used. This allows eclasses
to create custom ebuild helpers that mimic built-in helper behavior.

---
 bin/eapi.sh               | 4 ++++
 bin/isolated-functions.sh | 7 +++++++
 2 files changed, 11 insertions(+)

diff --git a/bin/eapi.sh b/bin/eapi.sh
index 6716b1c..c650a4c 100644
--- a/bin/eapi.sh
+++ b/bin/eapi.sh
@@ -166,6 +166,10 @@ ___eapi_unpack_supports_absolute_paths() {
        [[ ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend)$ ]]
 }
 
+___eapi_die_can_respect_nonfatal() {
+       [[ ! ${1-${EAPI}} =~ 
^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]]
+}
+
 # OTHERS
 
 ___eapi_enables_failglob_in_global_scope() {

diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh
index 251d7ee..8e789ec 100644
--- a/bin/isolated-functions.sh
+++ b/bin/isolated-functions.sh
@@ -123,6 +123,13 @@ __helpers_die() {
 die() {
        local IFS=$' \t\n'
 
+       if ___eapi_die_can_respect_nonfatal; then
+               if [[ ${1} == -n ]]; then
+                       [[ ${PORTAGE_NONFATAL} == 1 ]] && return 1
+                       shift
+               fi
+       fi
+
        set +e
        if [ -n "${QA_INTERCEPTORS}" ] ; then
                # die was called from inside inherit. We need to clean up

Reply via email to