Gentoo Archives: gentoo-dev

From: Florian Schmaus <flow@g.o>
To: gentoo-dev@l.g.o
Cc: Florian Schmaus <flow@g.o>
Subject: [gentoo-dev] [PATCH v2] db-use.eclass: add support for EAPI 8, die on unknown EAPI
Date: Fri, 18 Feb 2022 13:51:26
Message-Id: 20220218135105.930531-1-flow@gentoo.org
In Reply to: Re: [gentoo-dev] [PATCH] db-use.eclass: add support for EAPI 8, die on unknown EAPI by Ulrich Mueller
1 Add support for EAPI 8 and drop support for EAPIs < 5. Also explicitly
2 die on unknown EAPI values. Note that this is a deviation from the
3 currenty approach that the eclass uses since 86416d2c4bf1 ("eclass:
4 db-use - Update to eapi7-ver"). But I argue that it is confusing that
5 your static ananlysis tools (pkgcheck, repoman) complain about an
6 unsupported EAPI in an eclass, while the ebuild works just fine. While I
7 also think it is likely that this eclass will support future EAPI
8 versions without any modifications, my conclusion is that this is actually
9 an argument to die on unknown EAPIs, since it is trivial to bump, while
10 on the other hand, you never know if it really works.
11
12 Signed-off-by: Florian Schmaus <flow@g.o>
13 ---
14 eclass/db-use.eclass | 14 ++++++--------
15 1 file changed, 6 insertions(+), 8 deletions(-)
16
17 diff --git a/eclass/db-use.eclass b/eclass/db-use.eclass
18 index d23b08d19996..55e72286fda4 100644
19 --- a/eclass/db-use.eclass
20 +++ b/eclass/db-use.eclass
21 @@ -1,4 +1,4 @@
22 -# Copyright 1999-2021 Gentoo Authors
23 +# Copyright 1999-2022 Gentoo Authors
24 # Distributed under the terms of the GNU General Public License v2
25 # This is a common location for functions that aid the use of sys-libs/db
26 #
27 @@ -8,16 +8,17 @@
28 # maintainer-needed@g.o
29 # @AUTHOR:
30 # Paul de Vrieze <pauldv@g.o>
31 -# @SUPPORTED_EAPIS: 5 6 7
32 +# @SUPPORTED_EAPIS: 5 6 7 8
33 # @BLURB: This is a common location for functions that aid the use of sys-libs/db
34 # @DESCRIPTION:
35 # This eclass is designed to provide helpful functions for depending on
36 # sys-libs/db.
37
38 # multilib is used for get_libname in all EAPI
39 -case "${EAPI:-0}" in
40 - 0|1|2|3|4|5|6) inherit eapi7-ver multilib ;;
41 - *) inherit multilib ;;
42 +case ${EAPI} in
43 + 5|6) inherit eapi7-ver ;& # fallthrough
44 + 7|8) inherit multilib ;;
45 + *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
46 esac
47
48 #Convert a version to a db slot
49 @@ -40,7 +41,6 @@ db_ver_to_slot() {
50
51 #Find the version that correspond to the given atom
52 db_findver() {
53 - has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
54 if [ $# -ne 1 ]; then
55 eerror "Function db_findver needs one argument" >&2
56 eerror "args given:" >&2
57 @@ -68,7 +68,6 @@ db_findver() {
58 # to test for, it will aim to find the library corresponding to it.
59
60 db_includedir() {
61 - has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
62 if [ $# -eq 0 ]; then
63 VER="$(db_findver sys-libs/db)" || return 1
64 VER="$(db_ver_to_slot "$VER")"
65 @@ -102,7 +101,6 @@ db_includedir() {
66 # packages to test for, it will aim to find the library corresponding to it.
67
68 db_libname() {
69 - has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
70 if [ $# -eq 0 ]; then
71 VER="$(db_findver sys-libs/db)" || return 1
72 if [ -e "${EPREFIX}/usr/$(get_libdir)/libdb-${VER}$(get_libname)" ]; then
73 --
74 2.34.1