• [gentoo-dev] [PATCH] db-use.eclass: add support for EAPI 8, die on unkn

    From Florian Schmaus@21:1/5 to All on Fri Feb 18 10:00:02 2022
    Add support for EAPI 8 and drop support for EAPIs < 5. Also explicitly
    die on unknown EAPI values. Note that this is a deviation from the
    currenty approach that the eclass uses since 86416d2c4bf1 ("eclass:
    db-use - Update to eapi7-ver"). But I argue that it is confusing that
    your static ananlysis tools (pkgcheck, repoman) complain about an
    unsupported EAPI in an eclass, while the ebuild works just fine. While I
    also think it is likely that this eclass will support future EAPI
    versions without any modifications, my conclusion is that this is actually
    an argument to die on unknown EAPIs, since it is trivial to bump, while
    on the other hand, you never know if it really works.
    ---
    eclass/db-use.eclass | 14 ++++++--------
    1 file changed, 6 insertions(+), 8 deletions(-)

    diff --git a/eclass/db-use.eclass b/eclass/db-use.eclass
    index d23b08d19996..6a3aa8bbd36a 100644
    --- a/eclass/db-use.eclass
    +++ b/eclass/db-use.eclass
    @@ -1,4 +1,4 @@
    -# Copyright 1999-2021 Gentoo Authors
    +# Copyright 1999-2022 Gentoo Authors
    # Distributed under the terms of the GNU General Public License v2
    # This is a common location for functions that aid the use of sys-libs/db
    #
    @@ -8,16 +8,17 @@
    # maintainer-needed@gentoo.org
    # @AUTHOR:
    # Paul de Vrieze <pauldv@gentoo.org>
    -# @SUPPORTED_EAPIS: 5 6 7
    +# @SUPPORTED_EAPIS: 5 6 7 8
    # @BLURB: This is a common location for functions that aid the use of sys-libs/db
    # @DESCRIPTION:
    # This eclass is designed to provide helpful functions for depending on
    # sys-libs/db.

    # multilib is used for get_libname in all EAPI
    -case "${EAPI:-0}" in
    - 0|1|2|3|4|5|6) inherit eapi7-ver multilib ;;
    - *) inherit multilib ;;
    +case ${EAPI} in
    + [5
  • From Ulrich Mueller@21:1/5 to All on Fri Feb 18 11:50:01 2022
    On Fri, 18 Feb 2022, Florian Schmaus wrote:

    -case "${EAPI:-0}" in
    - 0|1|2|3|4|5|6) inherit eapi7-ver multilib ;;
    - *) inherit multilib ;;
    +case ${EAPI} in
    + [56]) inherit eapi7-ver ;& # fallthrough
    + [78]) inherit multilib ;;

    Please keep the 5|6) etc. syntax, because it is what is used in almost
    all other eclasses. It is also more future proof, EAPI names aren't
    limited to a single character.

    + *) die "${ECLASS}: EAPI ${EAPI} not supported" ;;

    Should be ${EAPI:-0} here.

    esac

    More generally, I notice that there is no eclass documentation for any
    of the functions.

    Also, error handling is a little strange. It outputs a lot of text, but
    doesn't die on usage errors. For example:

    db_ver_to_slot() {
    if [ $# -ne 1 ]; then
    eerror "Function db_ver_to_slot needs one argument" >&2
    eerror "args given:" >&2
    for f in $@
    do
    eerror " - \"$@\"" >&2
    done
    return 1
    fi
    ...
    }

    Also, f isn't declared as a local variable. In fact, you won't find a
    single "local" in the whole eclass.

    Ulrich

    -----BEGIN PGP SIGNATURE-----

    iQFDBAEBCAAtFiEEtDnZ1O9xIP68rzDbUYgzUIhBXi4FAmIPeXIPHHVsbUBnZW50 b28ub3JnAAoJEFGIM1CIQV4uiJoH/1mItfEolWL/YDIqOAU5MKP2J9/mx387HKli /0yOzUUINNzrwZKfzBaQxWfkw98RWOHMaeTylILnYFE8JSllfrLF5BfWrar0Nsun pEeSYBw4+9tDntBE9m2sbrld8jV01E16KoCE98RBTCvg3rRKY7r6I8HR0DmwOg58 ypj4YdF3H7HuO3mvk42Vq/LzsYkVkdzyjdoEH1cHn7jl07z9JBs2/8aBNkskIr6Y StLAZYJ9OieZ8iose2CKdqO6AREuZHWmZ+B0T48+9n8AAF+Dztb4fsW6tl16d1jW N6HaAuGSncBlLU2uXhdtoCWwU3NJMTHzL80TR9BS1x8vqPaDOug=
    =Fj4r
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Florian Schmaus@21:1/5 to All on Fri Feb 18 15:00:01 2022
    Add support for EAPI 8 and drop support for EAPIs < 5. Also explicitly
    die on unknown EAPI values. Note that this is a deviation from the
    currenty approach that the eclass uses since 86416d2c4bf1 ("eclass:
    db-use - Update to eapi7-ver"). But I argue that it is confusing that
    your static ananlysis tools (pkgcheck, repoman) complain about an
    unsupported EAPI in an eclass, while the ebuild works just fine. While I
    also think it is likely that this eclass will support future EAPI
    versions without any modifications, my conclusion is that this is actually
    an argument to die on unknown EAPIs, since it is trivial to bump, while
    on the other hand, you never know if it really works.

    Signed-off-by: Florian Schmaus <flow@gentoo.org>
    ---
    eclass/db-use.eclass | 14 ++++++--------
    1 file changed, 6 insertions(+), 8 deletions(-)

    diff --git a/eclass/db-use.eclass b/eclass/db-use.eclass
    index d23b08d19996..55e72286fda4 100644
    --- a/eclass/db-use.eclass
    +++ b/eclass/db-use.eclass
    @@ -1,4 +1,4 @@
    -# Copyright 1999-2021 Gentoo Authors
    +# Copyright 1999-2022 Gentoo Authors
    # Distributed under the terms of the GNU General Public License v2
    # This is a common location for functions that aid the use of sys-libs/db
    #
    @@ -8,16 +8,17 @@
    # maintainer-needed@gentoo.org
    # @AUTHOR:
    # Paul de Vrieze <pauldv@gentoo.org>
    -# @SUPPORTED_EAPIS: 5 6 7
    +# @SUPPORTED_EAPIS: 5 6 7 8
    # @BLURB: This is a common location for functions that aid the use of sys-libs/db
    # @DESCRIPTION:
    # This eclass is designed to provide helpful functions for depending on
    # sys-libs/db.

    # multilib is used for get_libname in all EAPI
    -case "${EAPI:-0}" in
    - 0|1|2|3|4|5|6) inherit eapi7-ver multilib ;;
    - *) inherit multilib ;;
    +case ${EAPI} in
    + 5|