EAPI 5: usex helper function
authorUlrich Müller <ulm@gentoo.org>
Fri, 31 Aug 2012 14:24:09 +0000 (16:24 +0200)
committerUlrich Müller <ulm@gentoo.org>
Fri, 31 Aug 2012 14:46:45 +0000 (16:46 +0200)
See bug #382963.

bin/ebuild.sh
bin/phase-helpers.sh
bin/save-ebuild-env.sh

index d3ca9d999fcfec2d1e10abe428d044a26e510b75..51e90d7cc1896dc2f2039ebfc50dc130a7863137 100755 (executable)
@@ -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\"
index 6899488d3d72a005e1b08060889a92de1f15cf84..5f170fc00da3e17a63adc47bac94e844dd30da6b 100644 (file)
@@ -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
index 4bf6e4e18c28448c532ac9047d9cbc9bb3c6fda4..a6d1c61e85ea0b277ef2dc37e6f427564bd2b98e 100644 (file)
@@ -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 \