From b9e2daded3663c59bf11b04e952bdfb4eb5deabf Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ulrich=20M=C3=BCller?= Date: Fri, 31 Aug 2012 16:24:09 +0200 Subject: [PATCH] EAPI 5: usex helper function See bug #382963. --- bin/ebuild.sh | 2 +- bin/phase-helpers.sh | 14 ++++++++++++++ bin/save-ebuild-env.sh | 5 +++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/bin/ebuild.sh b/bin/ebuild.sh index d3ca9d999..51e90d7cc 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -33,7 +33,7 @@ else done # These dummy functions return false in older EAPIs, in order to ensure that # `use multislot` is false for the "depend" phase. - for x in use useq usev ; do + for x in use useq usev usex ; do eval "${x}() { if has \"\${EAPI:-0}\" 4-python; then die \"\${FUNCNAME}() calls are not allowed in global scope\" diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh index 6899488d3..5f170fc00 100644 --- a/bin/phase-helpers.sh +++ b/bin/phase-helpers.sh @@ -174,6 +174,20 @@ usev() { return 1 } +case ${EAPI} in + 0|1|2|3|4) ;; + *) + usex() { + if use "$1"; then + echo "${2-yes}$4" + else + echo "${3-no}$5" + fi + return 0 + } + ;; +esac + use() { local u=$1 local found=0 diff --git a/bin/save-ebuild-env.sh b/bin/save-ebuild-env.sh index 4bf6e4e18..a6d1c61e8 100644 --- a/bin/save-ebuild-env.sh +++ b/bin/save-ebuild-env.sh @@ -73,6 +73,11 @@ save_ebuild_env() { _hasg _hasgq _unpack_tar \ ${QA_INTERCEPTORS} + case ${EAPI} in + 0|1|2|3|4) ;; + *) unset -f usex ;; + esac + # portage config variables and variables set directly by portage unset ACCEPT_LICENSE BAD BRACKET BUILD_PREFIX COLS \ DISTCC_DIR DISTDIR DOC_SYMLINKS_DIR \ -- 2.26.2