Gentoo Archives: gentoo-dev

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