commit:     ae01728421dd36f2c5d669cc1d0edfbdef5cc479
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 29 06:22:14 2021 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Tue Jun 29 06:22:52 2021 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=ae017284

eclass/*: sync with gx86

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 eclass/java-utils-2.eclass    |  37 +++++----------
 eclass/python-utils-r1.eclass | 102 ++++++++++++++++++++++++------------------
 eclass/toolchain-funcs.eclass |  29 ++++--------
 eclass/toolchain.eclass       |   5 ++-
 4 files changed, 81 insertions(+), 92 deletions(-)

diff --git a/eclass/java-utils-2.eclass b/eclass/java-utils-2.eclass
index cef79405bf..1b7fcc295a 100644
--- a/eclass/java-utils-2.eclass
+++ b/eclass/java-utils-2.eclass
@@ -6,6 +6,7 @@
 # [email protected]
 # @AUTHOR:
 # Thomas Matthijs <[email protected]>, Karl Trygve Kalleberg <[email protected]>
+# @SUPPORTED_EAPIS: 5 6 7
 # @BLURB: Base eclass for Java packages
 # @DESCRIPTION:
 # This eclass provides functionality which is used by java-pkg-2.eclass,
@@ -16,18 +17,23 @@
 # that have optional Java support. In addition you can inherit java-ant-2 for
 # Ant-based packages.
 
+case ${EAPI:-0} in
+       [567]) ;;
+       *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
+esac
+
+if [[ -z ${_JAVA_UTILS_2_ECLASS} ]] ; then
+_JAVA_UTILS_2_ECLASS=1
+
 # EAPI 7 has version functions built-in. Use eapi7-ver for all earlier 
eclasses.
 # Keep versionator inheritance in case consumers are using it implicitly.
-[[ ${EAPI} == [0123456] ]] && inherit eapi7-ver eutils multilib versionator
+[[ ${EAPI} == [56] ]] && inherit eapi7-ver eutils multilib versionator
 
 IUSE="elibc_FreeBSD"
 
 # Make sure we use java-config-2
 export WANT_JAVA_CONFIG="2"
 
-# Prefix variables are only available for EAPI>=3
-has "${EAPI:-0}" 0 1 2 && ED="${D}" EPREFIX= EROOT="${ROOT}"
-
 has test ${JAVA_PKG_IUSE} && RESTRICT+=" !test? ( test )"
 
 # @VARIABLE: JAVA_PKG_E_DEPEND
@@ -975,10 +981,6 @@ java-pkg_jar-from() {
 
        [[ -z ${target_pkg} ]] && die "Must specify a package"
 
-       if [[ "${EAPI}" == "1" ]]; then
-               target_pkg="${target_pkg//:/-}"
-       fi
-
        # default destjar to the target jar
        [[ -z "${destjar}" ]] && destjar="${target_jar}"
 
@@ -1114,10 +1116,6 @@ java-pkg_getjars() {
 
        local pkgs="${1}"
 
-       if [[ "${EAPI}" == "1" ]]; then
-               pkgs="${pkgs//:/-}"
-       fi
-
        jars="$(java-config ${deep} --classpath=${pkgs})"
        [[ $? != 0 ]] && die "java-config --classpath=${pkgs} failed"
        debug-print "${pkgs}:${jars}"
@@ -1183,10 +1181,6 @@ java-pkg_getjar() {
 
        local pkg="${1}" target_jar="${2}" jar
 
-       if [[ "${EAPI}" == "1" ]]; then
-               pkg="${pkg//:/-}"
-       fi
-
        [[ -z ${pkg} ]] && die "Must specify package to get a jar from"
        [[ -z ${target_jar} ]] && die "Must specify jar to get"
 
@@ -1272,10 +1266,6 @@ java-pkg_register-dependency() {
 
        [[ -z "${pkgs}" ]] && die "${FUNCNAME} called with no package(s) 
specified"
 
-       if [[ "${EAPI}" == "1" ]]; then
-               pkgs="${pkgs//:/-}"
-       fi
-
        if [[ -z "${jar}" ]]; then
                for pkg in ${pkgs//,/ }; do
                        java-pkg_ensure-dep runtime "${pkg}"
@@ -1329,10 +1319,6 @@ java-pkg_register-optional-dependency() {
 
        [[ -z "${pkgs}" ]] && die "${FUNCNAME} called with no package(s) 
specified"
 
-       if [[ "${EAPI}" == "1" ]]; then
-               pkgs="${pkgs//:/-}"
-       fi
-
        if [[ -z "${jar}" ]]; then
                for pkg in ${pkgs//,/ }; do
                        java-pkg_record-jar_ --optional "${pkg}"
@@ -2195,9 +2181,6 @@ java-pkg_init() {
 
        # Don't set up build environment if installing from binary. #206024 
#258423
        [[ "${MERGE_TYPE}" == "binary" ]] && return
-       # Also try Portage's nonstandard EMERGE_FROM for old EAPIs, if it 
doesn't
-       # work nothing is lost.
-       has ${EAPI:-0} 0 1 2 3 && [[ "${EMERGE_FROM}" == "binary" ]] && return
 
        unset JAVAC
        unset JAVA_HOME

diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 5023750fd6..0c173e2308 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -7,7 +7,7 @@
 # @AUTHOR:
 # Author: Michał Górny <[email protected]>
 # Based on work of: Krzysztof Pawlik <[email protected]>
-# @SUPPORTED_EAPIS: 6 7
+# @SUPPORTED_EAPIS: 6 7 8
 # @BLURB: Utility functions for packages with Python parts.
 # @DESCRIPTION:
 # A utility eclass providing functions to query Python implementations,
@@ -24,7 +24,7 @@
 # See bug #704286, bug #781878
 case "${EAPI:-0}" in
        [0-5]) die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}" ;;
-       [6-7]) ;;
+       [6-8]) ;;
        *)     die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}" ;;
 esac
 
@@ -34,6 +34,7 @@ fi
 
 if [[ ! ${_PYTHON_UTILS_R1} ]]; then
 
+[[ ${EAPI} == [67] ]] && inherit eapi8-dosym
 inherit toolchain-funcs
 
 # @ECLASS-VARIABLE: _PYTHON_ALL_IMPLS
@@ -42,7 +43,7 @@ inherit toolchain-funcs
 # All supported Python implementations, most preferred last.
 _PYTHON_ALL_IMPLS=(
        pypy3
-       python3_{7..10}
+       python3_{8..10}
 )
 readonly _PYTHON_ALL_IMPLS
 
@@ -54,7 +55,7 @@ _PYTHON_HISTORICAL_IMPLS=(
        jython2_7
        pypy pypy1_{8,9} pypy2_0
        python2_{5..7}
-       python3_{1..6}
+       python3_{1..7}
 )
 readonly _PYTHON_HISTORICAL_IMPLS
 
@@ -188,11 +189,8 @@ _python_set_impls() {
 # of the patterns following it. Return 0 if it does, 1 otherwise.
 # Matches if no patterns are provided.
 #
-# <impl> can be in PYTHON_COMPAT or EPYTHON form. The patterns can be
-# either:
-# a) fnmatch-style patterns, e.g. 'python2*', 'pypy'...
-# b) '-2' to indicate all Python 2 variants (= !python_is_python3)
-# c) '-3' to indicate all Python 3 variants (= python_is_python3)
+# <impl> can be in PYTHON_COMPAT or EPYTHON form. The patterns
+# are fnmatch-style.
 _python_impl_matches() {
        [[ ${#} -ge 1 ]] || die "${FUNCNAME}: takes at least 1 parameter"
        [[ ${#} -eq 1 ]] && return 0
@@ -201,15 +199,30 @@ _python_impl_matches() {
        shift
 
        for pattern; do
-               if [[ ${pattern} == -2 ]]; then
-                       python_is_python3 "${impl}" || return 0
-               elif [[ ${pattern} == -3 ]]; then
-                       python_is_python3 "${impl}" && return 0
-                       return
-               # unify value style to allow lax matching
-               elif [[ ${impl/./_} == ${pattern/./_} ]]; then
-                       return 0
-               fi
+               case ${pattern} in
+                       -2|python2*|pypy)
+                               if [[ ${EAPI} != [67] ]]; then
+                                       eerror
+                                       eerror "Python 2 is no longer supported 
in Gentoo, please remove Python 2"
+                                       eerror "${FUNCNAME[1]} calls."
+                                       die "Passing ${pattern} to 
${FUNCNAME[1]} is banned in EAPI ${EAPI}"
+                               fi
+                               ;;
+                       -3)
+                               # NB: "python3*" is fine, as "not pypy3"
+                               if [[ ${EAPI} != [67] ]]; then
+                                       eerror
+                                       eerror "Python 2 is no longer supported 
in Gentoo, please remove Python 2"
+                                       eerror "${FUNCNAME[1]} calls."
+                                       die "Passing ${pattern} to 
${FUNCNAME[1]} is banned in EAPI ${EAPI}"
+                               fi
+                               return 0
+                               ;;
+                       *)
+                               # unify value style to allow lax matching
+                               [[ ${impl/./_} == ${pattern/./_} ]] && return 0
+                               ;;
+               esac
        done
 
        return 1
@@ -265,6 +278,8 @@ python_export() {
        eqawarn "python_export() is part of private eclass API."
        eqawarn "Please call python_get*() instead."
 
+       [[ ${EAPI} == [67] ]] || die "${FUNCNAME} banned in EAPI ${EAPI}"
+
        _python_export "${@}"
 }
 
@@ -690,7 +705,7 @@ python_optimize() {
 python_scriptinto() {
        debug-print-function ${FUNCNAME} "${@}"
 
-       python_scriptroot=${1}
+       _PYTHON_SCRIPTROOT=${1}
 }
 
 # @FUNCTION: python_doexe
@@ -725,7 +740,7 @@ python_newexe() {
        [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is 
null).'
        [[ ${#} -eq 2 ]] || die "Usage: ${FUNCNAME} <path> <new-name>"
 
-       local wrapd=${python_scriptroot:-/usr/bin}
+       local wrapd=${_PYTHON_SCRIPTROOT:-/usr/bin}
 
        local f=${1}
        local newfn=${2}
@@ -742,8 +757,9 @@ python_newexe() {
        )
 
        # install the wrapper
-       _python_ln_rel "${ED%/}"/usr/lib/python-exec/python-exec2 \
-               "${ED%/}/${wrapd}/${newfn}" || die
+       local dosym=dosym
+       [[ ${EAPI} == [67] ]] && dosym=dosym8
+       "${dosym}" -r /usr/lib/python-exec/python-exec2 "${wrapd}/${newfn}"
 
        # don't use this at home, just call python_doscript() instead
        if [[ ${_PYTHON_REWRITE_SHEBANG} ]]; then
@@ -829,7 +845,7 @@ python_newscript() {
 python_moduleinto() {
        debug-print-function ${FUNCNAME} "${@}"
 
-       python_moduleroot=${1}
+       _PYTHON_MODULEROOT=${1}
 }
 
 # @FUNCTION: python_domodule
@@ -853,15 +869,13 @@ python_domodule() {
        [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is 
null).'
 
        local d
-       if [[ ${python_moduleroot} == /* ]]; then
+       if [[ ${_PYTHON_MODULEROOT} == /* ]]; then
                # absolute path
-               d=${python_moduleroot}
+               d=${_PYTHON_MODULEROOT}
        else
                # relative to site-packages
-               local PYTHON_SITEDIR=${PYTHON_SITEDIR}
-               [[ ${PYTHON_SITEDIR} ]] || _python_export PYTHON_SITEDIR 
PYTHON_EPREFIX
-
-               
d=${PYTHON_SITEDIR#${PYTHON_EPREFIX:-${EPREFIX}}}/${python_moduleroot}
+               local sitedir=$(python_get_sitedir)
+               d=${sitedir#${EPREFIX}}/${_PYTHON_MODULEROOT//.//}
        fi
 
        (
@@ -891,10 +905,8 @@ python_doheader() {
 
        [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is 
null).'
 
-       local d PYTHON_INCLUDEDIR=${PYTHON_INCLUDEDIR}
-       [[ ${PYTHON_INCLUDEDIR} ]] || _python_export PYTHON_INCLUDEDIR 
PYTHON_EPREFIX
-
-       d=${PYTHON_INCLUDEDIR#${PYTHON_EPREFIX:-${EPREFIX}}}
+       local includedir=$(python_get_includedir)
+       local d=${includedir#${EPREFIX}}
 
        (
                insopts -m 0644
@@ -914,6 +926,8 @@ python_wrapper_setup() {
        eqawarn "python_wrapper_setup() is part of private eclass API."
        eqawarn "Please call python_setup() instead."
 
+       [[ ${EAPI} == [67] ]] || die "${FUNCNAME} banned in EAPI ${EAPI}"
+
        _python_wrapper_setup "${@}"
 }
 
@@ -953,7 +967,7 @@ _python_wrapper_setup() {
                _python_export "${impl}" EPYTHON PYTHON
 
                local pyver pyother
-               if python_is_python3; then
+               if [[ ${EPYTHON} != python2* ]]; then
                        pyver=3
                        pyother=2
                else
@@ -1032,6 +1046,9 @@ _python_wrapper_setup() {
 #
 # Returns 0 (true) if it is, 1 (false) otherwise.
 python_is_python3() {
+       eqawarn "${FUNCNAME} is deprecated, as Python 2 is not supported 
anymore"
+       [[ ${EAPI} == [67] ]] || die "${FUNCNAME} banned in EAPI ${EAPI}"
+
        local impl=${1:-${EPYTHON}}
        [[ ${impl} ]] || die "python_is_python3: no impl nor EPYTHON"
 
@@ -1130,32 +1147,31 @@ python_fix_shebang() {
                                                        if [[ ${i} == *python2 
]]; then
                                                                from=python2
                                                                if [[ ! 
${force} ]]; then
-                                                                       
python_is_python3 "${EPYTHON}" && error=1
+                                                                       error=1
                                                                fi
                                                        elif [[ ${i} == 
*python3 ]]; then
                                                                from=python3
-                                                               if [[ ! 
${force} ]]; then
-                                                                       
python_is_python3 "${EPYTHON}" || error=1
-                                                               fi
                                                        else
                                                                from=python
                                                        fi
                                                        break
                                                        ;;
-                                               
*python[23].[0123456789]|*pypy|*pypy3|*jython[23].[0123456789])
+                                               
*python[23].[0-9]|*python3.[1-9][0-9]|*pypy|*pypy3|*jython[23].[0-9])
                                                        # Explicit mismatch.
                                                        if [[ ! ${force} ]]; 
then
                                                                error=1
                                                        else
                                                                case "${i}" in
-                                                                       
*python[23].[0123456789])
-                                                                               
from="python[23].[0123456789]";;
+                                                                       
*python[23].[0-9])
+                                                                               
from="python[23].[0-9]";;
+                                                                       
*python3.[1-9][0-9])
+                                                                               
from="python3.[1-9][0-9]";;
                                                                        *pypy)
                                                                                
from="pypy";;
                                                                        *pypy3)
                                                                                
from="pypy3";;
-                                                                       
*jython[23].[0123456789])
-                                                                               
from="jython[23].[0123456789]";;
+                                                                       
*jython[23].[0-9])
+                                                                               
from="jython[23].[0-9]";;
                                                                        *)
                                                                                
die "${FUNCNAME}: internal error in 2nd pattern match";;
                                                                esac

diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
index 70709b96d6..170ea19057 100644
--- a/eclass/toolchain-funcs.eclass
+++ b/eclass/toolchain-funcs.eclass
@@ -4,6 +4,7 @@
 # @ECLASS: toolchain-funcs.eclass
 # @MAINTAINER:
 # Toolchain Ninjas <[email protected]>
+# @SUPPORTED_EAPIS: 5 6 7 8
 # @BLURB: functions to query common info about the toolchain
 # @DESCRIPTION:
 # The toolchain-funcs aims to provide a complete suite of functions
@@ -12,6 +13,12 @@
 # in such a way that you can rely on the function always returning
 # something sane.
 
+case ${EAPI:-0} in
+       # EAPI=0 is still used by crossdev, bug #797367
+       0|5|6|7|8) ;;
+       *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
+esac
+
 if [[ -z ${_TOOLCHAIN_FUNCS_ECLASS} ]]; then
 _TOOLCHAIN_FUNCS_ECLASS=1
 
@@ -1040,7 +1047,7 @@ gen_usr_ldscript() {
 
        # Eventually we'd like to get rid of this func completely #417451
        case ${CTARGET:-${CHOST}} in
-       *-darwin*) type -P scanmacho > /dev/null || return ;;  # excluded for 
now due to known breakage
+       *-darwin*) ;;
        *-android*) return 0 ;;
        *linux*|*-freebsd*|*-openbsd*|*-netbsd*)
                use prefix && return 0 ;;
@@ -1115,26 +1122,6 @@ gen_usr_ldscript() {
                                -id "${EPREFIX}"/${libdir}/${tlib} \
                                "${ED}"/${libdir}/${tlib} || die 
"install_name_tool failed"
                        [[ -n ${nowrite} ]] && chmod u-w 
"${ED}${libdir}/${tlib}"
-                       # In the build image, stuff may have already recorded 
the now moved
-                       # install_name, so hunt those down and fix the 
install_name
-                       # references.
-                       local l obj needed lib
-                       scanmacho -qyRF '%p;%n' "${D}" | { while IFS= read l ; 
do
-                               obj=${l%%;*}
-                               needed=${l#*;}
-                               # this is ugly, paths with spaces won't work
-                               for lib in ${needed//,/ } ; do
-                                       if [[ ${lib} == */usr/lib*/${tlib} ]] ; 
then
-                                               # don't masquerade other 
problems, only remove usr/
-                                               # from input
-                                               local 
s=${lib%usr/*}${lib##*/usr/}
-                                               [[ ${lib} != ${s} ]] || continue
-                                               einfo "gen_usr_ldscript: 
correcting install_name from ${lib} to ${s} in ${obj}"
-                                               install_name_tool -change \
-                                                       "${lib}" "${s}" 
"${D}${obj}"
-                                       fi
-                               done
-                       done }
                        # Now as we don't use GNU binutils and our linker 
doesn't
                        # understand linker scripts, just create a symlink.
                        pushd "${ED}/usr/${libdir}" > /dev/null

diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index e85900934f..ff032dac0b 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.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
 
 # Maintainer: Toolchain Ninjas <[email protected]>
@@ -7,6 +7,8 @@
 DESCRIPTION="The GNU Compiler Collection"
 HOMEPAGE="https://gcc.gnu.org/";
 
+# TODO: Please audit this inherit list on future EAPI bumps and ideally
+# conditonalise them where possible.
 inherit eutils flag-o-matic gnuconfig libtool multilib pax-utils 
toolchain-funcs prefix
 
 tc_is_live() {
@@ -1349,6 +1351,7 @@ downgrade_arch_flags() {
 
        # "added" "arch" "replacement"
        local archlist=(
+               10 znver3 znver2
                9 znver2 znver1
                4.9 bdver4 bdver3
                4.9 bonnell atom

Reply via email to