Function vala_src_prepare did not call eapply_user, so it could not be
used as a stand-alone phase function but must be called explicitly.
Rename it to vala_setup, which can be called either from pkg_setup or
from src_prepare. Add a trivial vala_src_prepare wrapper in existing
EAPIs, so that functionality there does not change.

Apparently, eutils and multilib eclasses are not used, therefore no
longer inherit them in EAPI 8.

Reviewed-by: Mart Raudsepp <l...@gentoo.org>
Signed-off-by: Ulrich Müller <u...@gentoo.org>
---
 eclass/vala.eclass | 36 +++++++++++++++++++++++++-----------
 1 file changed, 25 insertions(+), 11 deletions(-)

diff --git a/eclass/vala.eclass b/eclass/vala.eclass
index 677520748c62..0b5b786b8408 100644
--- a/eclass/vala.eclass
+++ b/eclass/vala.eclass
@@ -6,7 +6,7 @@
 # gn...@gentoo.org
 # @AUTHOR:
 # Alexandre Rostovtsev <tetrom...@gentoo.org>
-# @SUPPORTED_EAPIS: 6 7
+# @SUPPORTED_EAPIS: 6 7 8
 # @BLURB: Sets up the environment for using a specific version of vala.
 # @DESCRIPTION:
 # This eclass sets up commonly used environment variables for using a specific
@@ -14,15 +14,17 @@
 # packages whose build systems assume the existence of certain unversioned vala
 # executables, pkgconfig files, etc., which Gentoo does not provide.
 #
-# This eclass provides one phase function: src_prepare.
-
-case ${EAPI:-0} in
-       [67]) inherit eutils multilib ;;
+# This eclass provides one phase function in EAPIs 6 and 7: src_prepare.
+
+case ${EAPI} in
+       6|7)
+               inherit eutils multilib
+               EXPORT_FUNCTIONS src_prepare
+               ;;
+       8) ;;
        *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
-EXPORT_FUNCTIONS src_prepare
-
 if [[ -z ${_VALA_ECLASS} ]] ; then
 _VALA_ECLASS=1
 
@@ -103,14 +105,17 @@ vala_depend() {
 # VALA_MAX_API_VERSION, VALA_MIN_API_VERSION, and VALA_USE_DEPEND.
 vala_best_api_version() {
        local u v
+       local hv_opt="-b"
+       [[ ${EAPI} == 6 ]] && hv_opt=""
+
        u=$(_vala_use_depend)
 
        for v in $(vala_api_versions); do
-               has_version $([[ $EAPI == [1-6] ]] || echo -b) 
"dev-lang/vala:${v}${u}" && echo "${v}" && return
+               has_version ${hv_opt} "dev-lang/vala:${v}${u}" && echo "${v}" 
&& return
        done
 }
 
-# @FUNCTION: vala_src_prepare
+# @FUNCTION: vala_setup
 # @USAGE: [--ignore-use] [--vala-api-version api_version]
 # @DESCRIPTION:
 # Sets up the environment variables and pkgconfig files for the
@@ -120,8 +125,10 @@ vala_best_api_version() {
 # Is a no-op if called without --ignore-use when USE=-vala.
 # Dies if the USE check is passed (or ignored) and a suitable vala
 # version is not available.
-vala_src_prepare() {
+vala_setup() {
        local p d valafoo version ignore_use
+       local hv_opt="-b"
+       [[ ${EAPI} == 6 ]] && hv_opt=""
 
        while [[ $1 ]]; do
                case $1 in
@@ -140,7 +147,7 @@ vala_src_prepare() {
        fi
 
        if [[ ${version} ]]; then
-               has_version $([[ $EAPI == [1-6] ]] || echo -b) 
"dev-lang/vala:${version}" || die "No installed vala:${version}"
+               has_version ${hv_opt} "dev-lang/vala:${version}" || die "No 
installed vala:${version}"
        else
                version=$(vala_best_api_version)
                [[ ${version} ]] || die "No installed vala in $(vala_depend)"
@@ -175,4 +182,11 @@ vala_src_prepare() {
        export PKG_CONFIG_PATH="${T}/pkgconfig:${PKG_CONFIG_PATH}"
 }
 
+# @FUNCTION: vala_src_prepare
+# @DESCRIPTION:
+# Exported phase function in EAPIs 6 and 7. Calls vala_setup.
+if [[ ${EAPI} == [67] ]]; then
+       vala_src_prepare() { vala_setup "$@"; }
+fi
+
 fi
-- 
2.35.1


Reply via email to