From ab46499322311c1faa710c63d0a5339e49a9061a Mon Sep 17 00:00:00 2001 From: Arfrever Frehtes Taifersar Arahesis Date: Wed, 26 Sep 2012 22:31:20 +0200 Subject: Add eapi.sh with ___eapi_*() functions and use these functions in other files. --- bin/isolated-functions.sh | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'bin/isolated-functions.sh') diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh index fa84c7ee3..f8e7862ee 100644 --- a/bin/isolated-functions.sh +++ b/bin/isolated-functions.sh @@ -2,6 +2,8 @@ # Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 +source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}/eapi.sh" + # We need this next line for "die" and "assert". It expands # It _must_ preceed all the calls to die and assert. shopt -s expand_aliases @@ -86,7 +88,7 @@ __dump_trace() { } nonfatal() { - if has "${EAPI:-0}" 0 1 2 3 ; then + if ! ___eapi_has_nonfatal; then die "$FUNCNAME() not supported in this EAPI" fi if [[ $# -lt 1 ]]; then @@ -97,14 +99,11 @@ nonfatal() { } __helpers_die() { - case "${EAPI:-0}" in - 0|1|2|3) - echo -e "$@" >&2 - ;; - *) - die "$@" - ;; - esac + if ___eapi_helpers_can_die; then + die "$@" + else + echo -e "$@" >&2 + fi } die() { -- cgit v1.2.3-1-g7c22