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] db-use.eclass: add support for EAPI 8, die on unknown EAPI
Date: Fri, 18 Feb 2022 08:51:24
Message-Id: 20220218085105.834208-1-flow@gentoo.org
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 eclass/db-use.eclass | 14 ++++++--------
13 1 file changed, 6 insertions(+), 8 deletions(-)
14
15 diff --git a/eclass/db-use.eclass b/eclass/db-use.eclass
16 index d23b08d19996..6a3aa8bbd36a 100644
17 --- a/eclass/db-use.eclass
18 +++ b/eclass/db-use.eclass
19 @@ -1,4 +1,4 @@
20 -# Copyright 1999-2021 Gentoo Authors
21 +# Copyright 1999-2022 Gentoo Authors
22 # Distributed under the terms of the GNU General Public License v2
23 # This is a common location for functions that aid the use of sys-libs/db
24 #
25 @@ -8,16 +8,17 @@
26 # maintainer-needed@g.o
27 # @AUTHOR:
28 # Paul de Vrieze <pauldv@g.o>
29 -# @SUPPORTED_EAPIS: 5 6 7
30 +# @SUPPORTED_EAPIS: 5 6 7 8
31 # @BLURB: This is a common location for functions that aid the use of sys-libs/db
32 # @DESCRIPTION:
33 # This eclass is designed to provide helpful functions for depending on
34 # sys-libs/db.
35
36 # multilib is used for get_libname in all EAPI
37 -case "${EAPI:-0}" in
38 - 0|1|2|3|4|5|6) inherit eapi7-ver multilib ;;
39 - *) inherit multilib ;;
40 +case ${EAPI} in
41 + [56]) inherit eapi7-ver ;& # fallthrough
42 + [78]) inherit multilib ;;
43 + *) die "${ECLASS}: EAPI ${EAPI} not supported" ;;
44 esac
45
46 #Convert a version to a db slot
47 @@ -40,7 +41,6 @@ db_ver_to_slot() {
48
49 #Find the version that correspond to the given atom
50 db_findver() {
51 - has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
52 if [ $# -ne 1 ]; then
53 eerror "Function db_findver needs one argument" >&2
54 eerror "args given:" >&2
55 @@ -68,7 +68,6 @@ db_findver() {
56 # to test for, it will aim to find the library corresponding to it.
57
58 db_includedir() {
59 - has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
60 if [ $# -eq 0 ]; then
61 VER="$(db_findver sys-libs/db)" || return 1
62 VER="$(db_ver_to_slot "$VER")"
63 @@ -102,7 +101,6 @@ db_includedir() {
64 # packages to test for, it will aim to find the library corresponding to it.
65
66 db_libname() {
67 - has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
68 if [ $# -eq 0 ]; then
69 VER="$(db_findver sys-libs/db)" || return 1
70 if [ -e "${EPREFIX}/usr/$(get_libdir)/libdb-${VER}$(get_libname)" ]; then
71 --
72 2.34.1

Replies