From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 267221382C5 for ; Wed, 31 Mar 2021 06:39:37 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 496E3E0845; Wed, 31 Mar 2021 06:39:34 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id C9F9FE081B for ; Wed, 31 Mar 2021 06:39:33 +0000 (UTC) From: Andreas Sturmlechner To: gentoo-dev Subject: [gentoo-dev] [PATCH] flag-o-matic.eclass: get rid of eutils in Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart3262775.LZWGnKmheA"; micalg="pgp-sha512"; protocol="application/pgp-signature" X-Archives-Salt: a9a74eee-b752-44f5-8307-aa734781e022 X-Archives-Hash: 00808954bed5e4269f38b1cfd592a179 --nextPart3262775.LZWGnKmheA Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii"; protected-headers="v1" From: Andreas Sturmlechner To: gentoo-dev Subject: [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 =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." + _test-flags-PROG +} + +# @FUNCTION: _test-flags-PROG +# @USAGE: [more flags...] +# @INTERNAL +# @DESCRIPTION: +# Returns shell true if are supported by given , else returns shell false. +_test-flags-PROG() { local comp=$1 local flags=() local x @@ -596,31 +660,31 @@ test-flags-PROG() { # @USAGE: # @DESCRIPTION: # Returns shell true if are supported by the C compiler, else returns shell false. -test-flags-CC() { test-flags-PROG "CC" "$@"; } +test-flags-CC() { _test-flags-PROG "CC" "$@"; } # @FUNCTION: test-flags-CXX # @USAGE: # @DESCRIPTION: # Returns shell true if are supported by the C++ compiler, else returns shell false. -test-flags-CXX() { test-flags-PROG "CXX" "$@"; } +test-flags-CXX() { _test-flags-PROG "CXX" "$@"; } # @FUNCTION: test-flags-F77 # @USAGE: # @DESCRIPTION: # Returns shell true if are supported by the Fortran 77 compiler, else returns shell false. -test-flags-F77() { test-flags-PROG "F77" "$@"; } +test-flags-F77() { _test-flags-PROG "F77" "$@"; } # @FUNCTION: test-flags-FC # @USAGE: # @DESCRIPTION: # Returns shell true if are supported by the Fortran 90 compiler, else returns shell false. -test-flags-FC() { test-flags-PROG "FC" "$@"; } +test-flags-FC() { _test-flags-PROG "FC" "$@"; } # @FUNCTION: test-flags-CCLD # @USAGE: # @DESCRIPTION: # Returns shell true if are supported by the C compiler and default linker, else returns shell false. -test-flags-CCLD() { test-flags-PROG "CCLD" "$@"; } +test-flags-CCLD() { _test-flags-PROG "CCLD" "$@"; } # @FUNCTION: test-flags # @USAGE: --nextPart3262775.LZWGnKmheA Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- iQGTBAABCgB9FiEE/x0UfMgLbk/MiQ+AUIqgAODug+AFAmBkGR9fFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEZG MUQxNDdDQzgwQjZFNEZDQzg5MEY4MDUwOEFBMDAwRTBFRTgzRTAACgkQUIqgAODu g+B6BggAqcfh1vl+FXcZBb2MwIETfkeZVqtm8SkkS/4qUVUaRaEZP0kQ4GuJCiMt PKFrNiOvujuQQh1z83Zwm2IedYOAnLU91JHfVBhPA0eg6bVLCV6bx0e/ogxftgo7 80jf7cBjCAHx3YUK6+pekaOlLpATBUKt51PW1B4YLKatVCLqa4uq2DBjsa3UXFjg zw/3RCFii2quHOH8lylBQpMddQD7dLj2QCSJz5neOR/VCENLNP2s7aHYGdF+X1UH a9hgwKVjw2K+NJg3bPTD2jjSvw1Vmb+V/Ci/cHHaU0xTx3UeJOWXbJs14NeHBWXd 9wfvFW4O3I37CqvgbvFCsg94m/5oEw== =4Bqx -----END PGP SIGNATURE----- --nextPart3262775.LZWGnKmheA--