Gentoo Archives: gentoo-commits

From: "Ulrich Müller" <ulm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Sun, 20 Feb 2022 09:32:12
Message-Id: 1645349498.bc13ab9233448a72eeb6551c948135a90fcf4502.ulm@gentoo
1 commit: bc13ab9233448a72eeb6551c948135a90fcf4502
2 Author: Ulrich Müller <ulm <AT> gentoo <DOT> org>
3 AuthorDate: Wed Feb 16 18:11:33 2022 +0000
4 Commit: Ulrich Müller <ulm <AT> gentoo <DOT> org>
5 CommitDate: Sun Feb 20 09:31:38 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bc13ab92
7
8 vala.eclass: Support EAPI 8
9
10 Function vala_src_prepare did not call eapply_user, so it could not be
11 used as a stand-alone phase function but must be called explicitly.
12 Rename it to vala_setup, which can be called either from pkg_setup or
13 from src_prepare. Add a trivial vala_src_prepare wrapper in existing
14 EAPIs, so that functionality there does not change.
15
16 Apparently, eutils and multilib eclasses are not used, therefore no
17 longer inherit them in EAPI 8.
18
19 Reviewed-by: Mart Raudsepp <leio <AT> gentoo.org>
20 Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>
21
22 eclass/vala.eclass | 35 ++++++++++++++++++++++-------------
23 1 file changed, 22 insertions(+), 13 deletions(-)
24
25 diff --git a/eclass/vala.eclass b/eclass/vala.eclass
26 index 677520748c62..23a3ae1deb6c 100644
27 --- a/eclass/vala.eclass
28 +++ b/eclass/vala.eclass
29 @@ -1,4 +1,4 @@
30 -# Copyright 1999-2021 Gentoo Authors
31 +# Copyright 1999-2022 Gentoo Authors
32 # Distributed under the terms of the GNU General Public License v2
33
34 # @ECLASS: vala.eclass
35 @@ -6,23 +6,20 @@
36 # gnome@g.o
37 # @AUTHOR:
38 # Alexandre Rostovtsev <tetromino@g.o>
39 -# @SUPPORTED_EAPIS: 6 7
40 +# @SUPPORTED_EAPIS: 6 7 8
41 # @BLURB: Sets up the environment for using a specific version of vala.
42 # @DESCRIPTION:
43 # This eclass sets up commonly used environment variables for using a specific
44 -# version of dev-lang/vala to configure and build a package. It is needed for
45 +# version of dev-lang/vala to configure and build a package. It is needed for
46 # packages whose build systems assume the existence of certain unversioned vala
47 # executables, pkgconfig files, etc., which Gentoo does not provide.
48 -#
49 -# This eclass provides one phase function: src_prepare.
50
51 -case ${EAPI:-0} in
52 - [67]) inherit eutils multilib ;;
53 +case ${EAPI} in
54 + 6|7) inherit eutils multilib ;;
55 + 8) ;;
56 *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
57 esac
58
59 -EXPORT_FUNCTIONS src_prepare
60 -
61 if [[ -z ${_VALA_ECLASS} ]] ; then
62 _VALA_ECLASS=1
63
64 @@ -103,14 +100,17 @@ vala_depend() {
65 # VALA_MAX_API_VERSION, VALA_MIN_API_VERSION, and VALA_USE_DEPEND.
66 vala_best_api_version() {
67 local u v
68 + local hv_opt="-b"
69 + [[ ${EAPI} == 6 ]] && hv_opt=""
70 +
71 u=$(_vala_use_depend)
72
73 for v in $(vala_api_versions); do
74 - has_version $([[ $EAPI == [1-6] ]] || echo -b) "dev-lang/vala:${v}${u}" && echo "${v}" && return
75 + has_version ${hv_opt} "dev-lang/vala:${v}${u}" && echo "${v}" && return
76 done
77 }
78
79 -# @FUNCTION: vala_src_prepare
80 +# @FUNCTION: vala_setup
81 # @USAGE: [--ignore-use] [--vala-api-version api_version]
82 # @DESCRIPTION:
83 # Sets up the environment variables and pkgconfig files for the
84 @@ -120,8 +120,10 @@ vala_best_api_version() {
85 # Is a no-op if called without --ignore-use when USE=-vala.
86 # Dies if the USE check is passed (or ignored) and a suitable vala
87 # version is not available.
88 -vala_src_prepare() {
89 +vala_setup() {
90 local p d valafoo version ignore_use
91 + local hv_opt="-b"
92 + [[ ${EAPI} == 6 ]] && hv_opt=""
93
94 while [[ $1 ]]; do
95 case $1 in
96 @@ -140,7 +142,7 @@ vala_src_prepare() {
97 fi
98
99 if [[ ${version} ]]; then
100 - has_version $([[ $EAPI == [1-6] ]] || echo -b) "dev-lang/vala:${version}" || die "No installed vala:${version}"
101 + has_version ${hv_opt} "dev-lang/vala:${version}" || die "No installed vala:${version}"
102 else
103 version=$(vala_best_api_version)
104 [[ ${version} ]] || die "No installed vala in $(vala_depend)"
105 @@ -175,4 +177,11 @@ vala_src_prepare() {
106 export PKG_CONFIG_PATH="${T}/pkgconfig:${PKG_CONFIG_PATH}"
107 }
108
109 +# @FUNCTION: vala_src_prepare
110 +# @DESCRIPTION:
111 +# For backwards compatibility in EAPIs 6 and 7. Calls vala_setup.
112 +if [[ ${EAPI} == [67] ]]; then
113 + vala_src_prepare() { vala_setup "$@"; }
114 +fi
115 +
116 fi