summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorUlrich Müller <ulm@gentoo.org>2012-08-31 16:24:09 +0200
committerUlrich Müller <ulm@gentoo.org>2012-08-31 16:46:45 +0200
commitb9e2daded3663c59bf11b04e952bdfb4eb5deabf (patch)
tree4c080ef797254fa21d63cdbad5d56c6bf8f3e31d /bin
parentbcf4ab871ededc3d535165757ba5597669e33dcb (diff)
downloadportage-b9e2daded3663c59bf11b04e952bdfb4eb5deabf.tar.gz
portage-b9e2daded3663c59bf11b04e952bdfb4eb5deabf.tar.bz2
portage-b9e2daded3663c59bf11b04e952bdfb4eb5deabf.zip
EAPI 5: usex helper function
See bug #382963.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ebuild.sh2
-rw-r--r--bin/phase-helpers.sh14
-rw-r--r--bin/save-ebuild-env.sh5
3 files changed, 20 insertions, 1 deletions
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 \