Re: [gentoo-dev] [PATCH] flag-o-matic.eclass: get rid of eutils in
> On 31 Mar 2021, at 10:09, Ulrich Mueller wrote: > >> On Wed, 31 Mar 2021, Andreas Sturmlechner wrote: > >> setup-allowed-flags() { >> +[[ ${EAPI} == [0-7] ]] || >> +die "Internal function ${FUNCNAME} is not available in >> >=EAPI-8." >> +_setup-allowed-flags >> +} > > Strictly speaking, EAPIs are strings, so numeric comparison is not > meaningful. Suggestion: "... is not available in EAPI ${EAPI}." That’s a reason to not do arithmetic comparison in e.g. Bash, but >= refers to age/chronological order here, which isn’t a problem. > >> test-flag-PROG() { >> +[[ ${EAPI} == [0-7] ]] || >> +die "Internal function ${FUNCNAME} is not available in >> >=EAPI-8." >> +_test-flag-PROG >> +} > >> test-flags-PROG() { >> +[[ ${EAPI} == [0-7] ]] || >> +die "Internal function ${FUNCNAME} is not available in >> >=EAPI-8." >> +_test-flags-PROG >> +} > > Same for these. > > Ulrich signature.asc Description: Message signed with OpenPGP
Re: [gentoo-dev] [PATCH] flag-o-matic.eclass: get rid of eutils in
On Mittwoch, 31. März 2021 12:03:33 CEST Wolfgang E. Sanyer wrote: > I'm curious - why the split e.g. test-flag-PROG() and _test-flag-PROG()? Is > this stylistic, or does it serve a functional purpose? (Hah, "functional", > get it? Because they're functions?!? We prepend `_` to signify internal API. The existing function name needs to stay until <=EAPI-7 support is gone in order not to break potential consumers even outside of genoo.git. Regards signature.asc Description: This is a digitally signed message part.
Re: [gentoo-dev] [PATCH] flag-o-matic.eclass: get rid of eutils in
I'm curious - why the split e.g. test-flag-PROG() and _test-flag-PROG()? Is this stylistic, or does it serve a functional purpose? (Hah, "functional", get it? Because they're functions?!? Please excuse any formatting oddness I'm not sure how to make plaintext emails from the gmail android client > El mié., 31 de marzo de 2021 5:13 a. m., Sergei Trofimovich < sly...@gentoo.org> escribió: > On Wed, 31 Mar 2021 09:45:52 +0200 > Andreas Sturmlechner wrote: > > > On Mittwoch, 31. März 2021 09:33:21 CEST Sergei Trofimovich wrote: > > > On Wed, 31 Mar 2021 08:39:27 +0200 > > > > > > > > See also: > > > > https://qa-reports.gentoo.org/output/eapi-per-eclass/eutils.eclass/ > > > > https://github.com/gentoo/gentoo/pull/20207 > > > > > > Please post series as separate patches. > > > > > > > They are separate in the linked PR, if you need to check that they are a > > proper series. > > I planned to provide review in this mailing list. > > -- > > Sergei >
Re: [gentoo-dev] [PATCH] flag-o-matic.eclass: get rid of eutils in
On Wed, 31 Mar 2021 09:45:52 +0200 Andreas Sturmlechner wrote: > On Mittwoch, 31. März 2021 09:33:21 CEST Sergei Trofimovich wrote: > > On Wed, 31 Mar 2021 08:39:27 +0200 > > > > > > See also: > > > https://qa-reports.gentoo.org/output/eapi-per-eclass/eutils.eclass/ > > > https://github.com/gentoo/gentoo/pull/20207 > > > > Please post series as separate patches. > > > > They are separate in the linked PR, if you need to check that they are a > proper series. I planned to provide review in this mailing list. -- Sergei pgpIhf6sCiiZn.pgp Description: Цифровая подпись OpenPGP
Re: [gentoo-dev] [PATCH] flag-o-matic.eclass: get rid of eutils in
> On Wed, 31 Mar 2021, Andreas Sturmlechner wrote: > setup-allowed-flags() { > + [[ ${EAPI} == [0-7] ]] || > + die "Internal function ${FUNCNAME} is not available in > >=EAPI-8." > + _setup-allowed-flags > +} Strictly speaking, EAPIs are strings, so numeric comparison is not meaningful. Suggestion: "... is not available in EAPI ${EAPI}." > test-flag-PROG() { > + [[ ${EAPI} == [0-7] ]] || > + die "Internal function ${FUNCNAME} is not available in > >=EAPI-8." > + _test-flag-PROG > +} > test-flags-PROG() { > + [[ ${EAPI} == [0-7] ]] || > + die "Internal function ${FUNCNAME} is not available in > >=EAPI-8." > + _test-flags-PROG > +} Same for these. Ulrich signature.asc Description: PGP signature
Re: [gentoo-dev] [PATCH] flag-o-matic.eclass: get rid of eutils in
On Mittwoch, 31. März 2021 09:33:21 CEST Sergei Trofimovich wrote: > On Wed, 31 Mar 2021 08:39:27 +0200 > > > > See also: > > https://qa-reports.gentoo.org/output/eapi-per-eclass/eutils.eclass/ > > https://github.com/gentoo/gentoo/pull/20207 > > Please post series as separate patches. > They are separate in the linked PR, if you need to check that they are a proper series. Regards signature.asc Description: This is a digitally signed message part.
Re: [gentoo-dev] [PATCH] flag-o-matic.eclass: get rid of eutils in
> On 31 Mar 2021, at 07:39, Andreas Sturmlechner wrote: > > qa-reports showing >7300 ebuilds with EAPI-7 using eutils.eclass, that can't > be right. > > - Restrict inherit eutils to - Drop bogus multilib.eclass (inherited by toolchain-funcs.eclass anyway) > - Several functions look like they should be internal > - Fix eclassdoc issues, add missing docu > > See also: > https://qa-reports.gentoo.org/output/eapi-per-eclass/eutils.eclass/ > https://github.com/gentoo/gentoo/pull/20207 Looks good and similar to what I had previously (as a draft). Good work and a nice opportunity to kill off some internal functions too. signature.asc Description: Message signed with OpenPGP
Re: [gentoo-dev] [PATCH] flag-o-matic.eclass: get rid of eutils in
On Wed, 31 Mar 2021 08:39:27 +0200 Andreas Sturmlechner wrote: > qa-reports showing >7300 ebuilds with EAPI-7 using eutils.eclass, that can't > be right. > > - Restrict inherit eutils to - Drop bogus multilib.eclass (inherited by toolchain-funcs.eclass anyway) > - Several functions look like they should be internal > - Fix eclassdoc issues, add missing docu > > See also: > https://qa-reports.gentoo.org/output/eapi-per-eclass/eutils.eclass/ > https://github.com/gentoo/gentoo/pull/20207 Please post series as separate patches. > diff --git a/eclass/flag-o-matic.eclass b/eclass/flag-o-matic.eclass > index 20ee39d98ba..35dc09f94de 100644 > --- a/eclass/flag-o-matic.eclass > +++ b/eclass/flag-o-matic.eclass > @@ -1,4 +1,4 @@ > -# Copyright 1999-2020 Gentoo Authors > +# Copyright 1999-2021 Gentoo Authors > # Distributed under the terms of the GNU General Public License v2 > > # @ECLASS: flag-o-matic.eclass > @@ -12,16 +12,37 @@ > if [[ -z ${_FLAG_O_MATIC_ECLASS} ]]; then > _FLAG_O_MATIC_ECLASS=1 > > -inherit eutils toolchain-funcs multilib > +inherit toolchain-funcs > > +case ${EAPI} in > + [0-7]) inherit eutils ;; > + *) ;; > +esac > + > +# @FUNCTION: all-flag-vars > +# @DESCRIPTION: > # Return all the flag variables that our high level funcs operate on. > all-flag-vars() { > echo {ADA,C,CPP,CXX,CCAS,F,FC,LD}FLAGS > } > > +# @FUNCTION: setup-allowed-flags > +# @INTERNAL > +# @DESCRIPTION: > # {C,CPP,CXX,CCAS,F,FC,LD}FLAGS that we allow in strip-flags > # Note: shell globs and character lists are allowed > setup-allowed-flags() { > + [[ ${EAPI} == [0-7] ]] || > + die "Internal function ${FUNCNAME} is not available in > >=EAPI-8." > + _setup-allowed-flags > +} > + > +# @FUNCTION: _setup-allowed-flags > +# @INTERNAL > +# @DESCRIPTION: > +# {C,CPP,CXX,CCAS,F,FC,LD}FLAGS that we allow in strip-flags > +# Note: shell globs and character lists are allowed > +_setup-allowed-flags() { > ALLOWED_FLAGS=( > -pipe -O '-O[12sg]' -mcpu -march -mtune > '-fstack-protector*' '-fsanitize*' '-fstack-check*' > -fno-stack-check > @@ -87,7 +108,10 @@ setup-allowed-flags() { > ) > } > > -# inverted filters for hardened compiler. This is trying to unpick > +# @FUNCTION: _filter-hardened > +# @INTERNAL > +# @DESCRIPTION: > +# Inverted filters for hardened compiler. This is trying to unpick > # the hardened compiler defaults. > _filter-hardened() { > local f > @@ -121,6 +145,9 @@ _filter-hardened() { > done > } > > +# @FUNCTION: _filter-var > +# @INTERNAL > +# @DESCRIPTION: > # Remove occurrences of strings from variable given in $1 > # Strings removed are matched as globs, so for example > # '-O*' would remove -O1, -O2 etc. > @@ -313,6 +340,11 @@ replace-cpu-flags() { > return 0 > } > > +# @FUNCTION: _is_flagq > +# @USAGE: > +# @INTERNAL > +# @DESCRIPTION: > +# Returns shell true if is in a given , else returns shell > false. > _is_flagq() { > local x var="$1[*]" > for x in ${!var} ; do > @@ -405,7 +437,7 @@ strip-flags() { > local x y var > > local ALLOWED_FLAGS > - setup-allowed-flags > + _setup-allowed-flags > > set -f # disable pathname expansion > > @@ -438,7 +470,23 @@ strip-flags() { > return 0 > } > > +# @FUNCTION: test-flag-PROG > +# @USAGE: > +# @INTERNAL > +# @DESCRIPTION: > +# Returns shell true if is supported by given , else > returns shell false. > test-flag-PROG() { > + [[ ${EAPI} == [0-7] ]] || > + die "Internal function ${FUNCNAME} is not available in > >=EAPI-8." > + _test-flag-PROG > +} > + > +# @FUNCTION: _test-flag-PROG > +# @USAGE: > +# @INTERNAL > +# @DESCRIPTION: > +# Returns shell true if is supported by given , else > returns shell false. > +_test-flag-PROG() { > local comp=$1 > local lang=$2 > shift 2 > @@ -533,33 +581,49 @@ test-flag-PROG() { > # @USAGE: > # @DESCRIPTION: > # Returns shell true if is supported by the C compiler, else returns > shell false. > -test-flag-CC() { test-flag-PROG "CC" c "$@"; } > +test-flag-CC() { _test-flag-PROG "CC" c "$@"; } > > # @FUNCTION: test-flag-CXX > # @USAGE: > # @DESCRIPTION: > # Returns shell true if is supported by the C++ compiler, else > returns shell false. > -test-flag-CXX() { test-flag-PROG "CXX" c++ "$@"; } > +test-flag-CXX() { _test-flag-PROG "CXX" c++ "$@"; } > > # @FUNCTION: test-flag-F77 > # @USAGE: > # @DESCRIPTION: > # Returns shell true if is supported by the Fortran 77 compiler, else > returns shell false. > -test-flag-F77() { test-flag-PROG "F77" f77 "$@"; } > +test-flag-F77() { _test-flag-PROG "F77" f77 "$@"; } > > # @FUNCTION: test-flag-FC > # @USAGE: > # @DESCRIPTION: > # Returns shell true if is supported by the Fortran 90 compiler, else > returns shell false. > -test-flag-FC() { test-flag-PROG "FC" f95 "$@"; } > +test-flag-FC() { _test-flag-PROG "FC" f95 "$@"; } > > #
[gentoo-dev] [PATCH] flag-o-matic.eclass: get rid of eutils in
qa-reports showing >7300 ebuilds with EAPI-7 using eutils.eclass, that can't be right. - Restrict inherit eutils to https://qa-reports.gentoo.org/output/eapi-per-eclass/eutils.eclass/ https://github.com/gentoo/gentoo/pull/20207 diff --git a/eclass/flag-o-matic.eclass b/eclass/flag-o-matic.eclass index 20ee39d98ba..35dc09f94de 100644 --- a/eclass/flag-o-matic.eclass +++ b/eclass/flag-o-matic.eclass @@ -1,4 +1,4 @@ -# Copyright 1999-2020 Gentoo Authors +# Copyright 1999-2021 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: flag-o-matic.eclass @@ -12,16 +12,37 @@ if [[ -z ${_FLAG_O_MATIC_ECLASS} ]]; then _FLAG_O_MATIC_ECLASS=1 -inherit eutils toolchain-funcs multilib +inherit toolchain-funcs +case ${EAPI} in + [0-7]) inherit eutils ;; + *) ;; +esac + +# @FUNCTION: all-flag-vars +# @DESCRIPTION: # Return all the flag variables that our high level funcs operate on. all-flag-vars() { echo {ADA,C,CPP,CXX,CCAS,F,FC,LD}FLAGS } +# @FUNCTION: setup-allowed-flags +# @INTERNAL +# @DESCRIPTION: # {C,CPP,CXX,CCAS,F,FC,LD}FLAGS that we allow in strip-flags # Note: shell globs and character lists are allowed setup-allowed-flags() { + [[ ${EAPI} == [0-7] ]] || + die "Internal function ${FUNCNAME} is not available in >=EAPI-8." + _setup-allowed-flags +} + +# @FUNCTION: _setup-allowed-flags +# @INTERNAL +# @DESCRIPTION: +# {C,CPP,CXX,CCAS,F,FC,LD}FLAGS that we allow in strip-flags +# Note: shell globs and character lists are allowed +_setup-allowed-flags() { ALLOWED_FLAGS=( -pipe -O '-O[12sg]' -mcpu -march -mtune '-fstack-protector*' '-fsanitize*' '-fstack-check*' -fno-stack-check @@ -87,7 +108,10 @@ setup-allowed-flags() { ) } -# inverted filters for hardened compiler. This is trying to unpick +# @FUNCTION: _filter-hardened +# @INTERNAL +# @DESCRIPTION: +# Inverted filters for hardened compiler. This is trying to unpick # the hardened compiler defaults. _filter-hardened() { local f @@ -121,6 +145,9 @@ _filter-hardened() { done } +# @FUNCTION: _filter-var +# @INTERNAL +# @DESCRIPTION: # Remove occurrences of strings from variable given in $1 # Strings removed are matched as globs, so for example # '-O*' would remove -O1, -O2 etc. @@ -313,6 +340,11 @@ replace-cpu-flags() { return 0 } +# @FUNCTION: _is_flagq +# @USAGE: +# @INTERNAL +# @DESCRIPTION: +# Returns shell true if is in a given , else returns shell false. _is_flagq() { local x var="$1[*]" for x in ${!var} ; do @@ -405,7 +437,7 @@ strip-flags() { local x y var local ALLOWED_FLAGS - setup-allowed-flags + _setup-allowed-flags set -f # disable pathname expansion @@ -438,7 +470,23 @@ strip-flags() { return 0 } +# @FUNCTION: test-flag-PROG +# @USAGE: +# @INTERNAL +# @DESCRIPTION: +# Returns shell true if is supported by given , else returns shell false. test-flag-PROG() { + [[ ${EAPI} == [0-7] ]] || + die "Internal function ${FUNCNAME} is not available in >=EAPI-8." + _test-flag-PROG +} + +# @FUNCTION: _test-flag-PROG +# @USAGE: +# @INTERNAL +# @DESCRIPTION: +# Returns shell true if is supported by given , else returns shell false. +_test-flag-PROG() { local comp=$1 local lang=$2 shift 2 @@ -533,33 +581,49 @@ test-flag-PROG() { # @USAGE: # @DESCRIPTION: # Returns shell true if is supported by the C compiler, else returns shell false. -test-flag-CC() { test-flag-PROG "CC" c "$@"; } +test-flag-CC() { _test-flag-PROG "CC" c "$@"; } # @FUNCTION: test-flag-CXX # @USAGE: # @DESCRIPTION: # Returns shell true if is supported by the C++ compiler, else returns shell false. -test-flag-CXX() { test-flag-PROG "CXX" c++ "$@"; } +test-flag-CXX() { _test-flag-PROG "CXX" c++ "$@"; } # @FUNCTION: test-flag-F77 # @USAGE: # @DESCRIPTION: # Returns shell true if is supported by the Fortran 77 compiler, else returns shell false. -test-flag-F77() { test-flag-PROG "F77" f77 "$@"; } +test-flag-F77() { _test-flag-PROG "F77" f77 "$@"; } # @FUNCTION: test-flag-FC # @USAGE: # @DESCRIPTION: # Returns shell true if is supported by the Fortran 90 compiler, else returns shell false. -test-flag-FC() { test-flag-PROG "FC" f95 "$@"; } +test-flag-FC() { _test-flag-PROG "FC" f95 "$@"; } # @FUNCTION: test-flag-CCLD # @USAGE: # @DESCRIPTION: # Returns shell true if is supported by the C compiler and linker, else returns shell false. -test-flag-CCLD() { test-flag-PROG "CC" c+ld "$@"; } +test-flag-CCLD() { _test-flag-PROG "CC" c+ld "$@"; } +# @FUNCTION: test-flags-PROG +# @USAGE: [more flags...] +# @INTERNAL +# @DESCRIPTION: +# Returns shell true if are supported by given , else returns shell false. test-flags-PROG() { + [[ ${EAPI} == [0-7] ]] || + die "Internal function ${FUNCNAME} is not available in >=EAPI-8." +