Gentoo Archives: gentoo-commits

From: Fabian Groffen <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/proj/prefix:master commit in: eclass/
Date: Tue, 29 Jun 2021 06:23:04
Message-Id: 1624947772.ae01728421dd36f2c5d669cc1d0edfbdef5cc479.grobian@gentoo
1 commit: ae01728421dd36f2c5d669cc1d0edfbdef5cc479
2 Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jun 29 06:22:14 2021 +0000
4 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
5 CommitDate: Tue Jun 29 06:22:52 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=ae017284
7
8 eclass/*: sync with gx86
9
10 Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
11
12 eclass/java-utils-2.eclass | 37 +++++----------
13 eclass/python-utils-r1.eclass | 102 ++++++++++++++++++++++++------------------
14 eclass/toolchain-funcs.eclass | 29 ++++--------
15 eclass/toolchain.eclass | 5 ++-
16 4 files changed, 81 insertions(+), 92 deletions(-)
17
18 diff --git a/eclass/java-utils-2.eclass b/eclass/java-utils-2.eclass
19 index cef79405bf..1b7fcc295a 100644
20 --- a/eclass/java-utils-2.eclass
21 +++ b/eclass/java-utils-2.eclass
22 @@ -6,6 +6,7 @@
23 # java@g.o
24 # @AUTHOR:
25 # Thomas Matthijs <axxo@g.o>, Karl Trygve Kalleberg <karltk@g.o>
26 +# @SUPPORTED_EAPIS: 5 6 7
27 # @BLURB: Base eclass for Java packages
28 # @DESCRIPTION:
29 # This eclass provides functionality which is used by java-pkg-2.eclass,
30 @@ -16,18 +17,23 @@
31 # that have optional Java support. In addition you can inherit java-ant-2 for
32 # Ant-based packages.
33
34 +case ${EAPI:-0} in
35 + [567]) ;;
36 + *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
37 +esac
38 +
39 +if [[ -z ${_JAVA_UTILS_2_ECLASS} ]] ; then
40 +_JAVA_UTILS_2_ECLASS=1
41 +
42 # EAPI 7 has version functions built-in. Use eapi7-ver for all earlier eclasses.
43 # Keep versionator inheritance in case consumers are using it implicitly.
44 -[[ ${EAPI} == [0123456] ]] && inherit eapi7-ver eutils multilib versionator
45 +[[ ${EAPI} == [56] ]] && inherit eapi7-ver eutils multilib versionator
46
47 IUSE="elibc_FreeBSD"
48
49 # Make sure we use java-config-2
50 export WANT_JAVA_CONFIG="2"
51
52 -# Prefix variables are only available for EAPI>=3
53 -has "${EAPI:-0}" 0 1 2 && ED="${D}" EPREFIX= EROOT="${ROOT}"
54 -
55 has test ${JAVA_PKG_IUSE} && RESTRICT+=" !test? ( test )"
56
57 # @VARIABLE: JAVA_PKG_E_DEPEND
58 @@ -975,10 +981,6 @@ java-pkg_jar-from() {
59
60 [[ -z ${target_pkg} ]] && die "Must specify a package"
61
62 - if [[ "${EAPI}" == "1" ]]; then
63 - target_pkg="${target_pkg//:/-}"
64 - fi
65 -
66 # default destjar to the target jar
67 [[ -z "${destjar}" ]] && destjar="${target_jar}"
68
69 @@ -1114,10 +1116,6 @@ java-pkg_getjars() {
70
71 local pkgs="${1}"
72
73 - if [[ "${EAPI}" == "1" ]]; then
74 - pkgs="${pkgs//:/-}"
75 - fi
76 -
77 jars="$(java-config ${deep} --classpath=${pkgs})"
78 [[ $? != 0 ]] && die "java-config --classpath=${pkgs} failed"
79 debug-print "${pkgs}:${jars}"
80 @@ -1183,10 +1181,6 @@ java-pkg_getjar() {
81
82 local pkg="${1}" target_jar="${2}" jar
83
84 - if [[ "${EAPI}" == "1" ]]; then
85 - pkg="${pkg//:/-}"
86 - fi
87 -
88 [[ -z ${pkg} ]] && die "Must specify package to get a jar from"
89 [[ -z ${target_jar} ]] && die "Must specify jar to get"
90
91 @@ -1272,10 +1266,6 @@ java-pkg_register-dependency() {
92
93 [[ -z "${pkgs}" ]] && die "${FUNCNAME} called with no package(s) specified"
94
95 - if [[ "${EAPI}" == "1" ]]; then
96 - pkgs="${pkgs//:/-}"
97 - fi
98 -
99 if [[ -z "${jar}" ]]; then
100 for pkg in ${pkgs//,/ }; do
101 java-pkg_ensure-dep runtime "${pkg}"
102 @@ -1329,10 +1319,6 @@ java-pkg_register-optional-dependency() {
103
104 [[ -z "${pkgs}" ]] && die "${FUNCNAME} called with no package(s) specified"
105
106 - if [[ "${EAPI}" == "1" ]]; then
107 - pkgs="${pkgs//:/-}"
108 - fi
109 -
110 if [[ -z "${jar}" ]]; then
111 for pkg in ${pkgs//,/ }; do
112 java-pkg_record-jar_ --optional "${pkg}"
113 @@ -2195,9 +2181,6 @@ java-pkg_init() {
114
115 # Don't set up build environment if installing from binary. #206024 #258423
116 [[ "${MERGE_TYPE}" == "binary" ]] && return
117 - # Also try Portage's nonstandard EMERGE_FROM for old EAPIs, if it doesn't
118 - # work nothing is lost.
119 - has ${EAPI:-0} 0 1 2 3 && [[ "${EMERGE_FROM}" == "binary" ]] && return
120
121 unset JAVAC
122 unset JAVA_HOME
123
124 diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
125 index 5023750fd6..0c173e2308 100644
126 --- a/eclass/python-utils-r1.eclass
127 +++ b/eclass/python-utils-r1.eclass
128 @@ -7,7 +7,7 @@
129 # @AUTHOR:
130 # Author: Michał Górny <mgorny@g.o>
131 # Based on work of: Krzysztof Pawlik <nelchael@g.o>
132 -# @SUPPORTED_EAPIS: 6 7
133 +# @SUPPORTED_EAPIS: 6 7 8
134 # @BLURB: Utility functions for packages with Python parts.
135 # @DESCRIPTION:
136 # A utility eclass providing functions to query Python implementations,
137 @@ -24,7 +24,7 @@
138 # See bug #704286, bug #781878
139 case "${EAPI:-0}" in
140 [0-5]) die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}" ;;
141 - [6-7]) ;;
142 + [6-8]) ;;
143 *) die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}" ;;
144 esac
145
146 @@ -34,6 +34,7 @@ fi
147
148 if [[ ! ${_PYTHON_UTILS_R1} ]]; then
149
150 +[[ ${EAPI} == [67] ]] && inherit eapi8-dosym
151 inherit toolchain-funcs
152
153 # @ECLASS-VARIABLE: _PYTHON_ALL_IMPLS
154 @@ -42,7 +43,7 @@ inherit toolchain-funcs
155 # All supported Python implementations, most preferred last.
156 _PYTHON_ALL_IMPLS=(
157 pypy3
158 - python3_{7..10}
159 + python3_{8..10}
160 )
161 readonly _PYTHON_ALL_IMPLS
162
163 @@ -54,7 +55,7 @@ _PYTHON_HISTORICAL_IMPLS=(
164 jython2_7
165 pypy pypy1_{8,9} pypy2_0
166 python2_{5..7}
167 - python3_{1..6}
168 + python3_{1..7}
169 )
170 readonly _PYTHON_HISTORICAL_IMPLS
171
172 @@ -188,11 +189,8 @@ _python_set_impls() {
173 # of the patterns following it. Return 0 if it does, 1 otherwise.
174 # Matches if no patterns are provided.
175 #
176 -# <impl> can be in PYTHON_COMPAT or EPYTHON form. The patterns can be
177 -# either:
178 -# a) fnmatch-style patterns, e.g. 'python2*', 'pypy'...
179 -# b) '-2' to indicate all Python 2 variants (= !python_is_python3)
180 -# c) '-3' to indicate all Python 3 variants (= python_is_python3)
181 +# <impl> can be in PYTHON_COMPAT or EPYTHON form. The patterns
182 +# are fnmatch-style.
183 _python_impl_matches() {
184 [[ ${#} -ge 1 ]] || die "${FUNCNAME}: takes at least 1 parameter"
185 [[ ${#} -eq 1 ]] && return 0
186 @@ -201,15 +199,30 @@ _python_impl_matches() {
187 shift
188
189 for pattern; do
190 - if [[ ${pattern} == -2 ]]; then
191 - python_is_python3 "${impl}" || return 0
192 - elif [[ ${pattern} == -3 ]]; then
193 - python_is_python3 "${impl}" && return 0
194 - return
195 - # unify value style to allow lax matching
196 - elif [[ ${impl/./_} == ${pattern/./_} ]]; then
197 - return 0
198 - fi
199 + case ${pattern} in
200 + -2|python2*|pypy)
201 + if [[ ${EAPI} != [67] ]]; then
202 + eerror
203 + eerror "Python 2 is no longer supported in Gentoo, please remove Python 2"
204 + eerror "${FUNCNAME[1]} calls."
205 + die "Passing ${pattern} to ${FUNCNAME[1]} is banned in EAPI ${EAPI}"
206 + fi
207 + ;;
208 + -3)
209 + # NB: "python3*" is fine, as "not pypy3"
210 + if [[ ${EAPI} != [67] ]]; then
211 + eerror
212 + eerror "Python 2 is no longer supported in Gentoo, please remove Python 2"
213 + eerror "${FUNCNAME[1]} calls."
214 + die "Passing ${pattern} to ${FUNCNAME[1]} is banned in EAPI ${EAPI}"
215 + fi
216 + return 0
217 + ;;
218 + *)
219 + # unify value style to allow lax matching
220 + [[ ${impl/./_} == ${pattern/./_} ]] && return 0
221 + ;;
222 + esac
223 done
224
225 return 1
226 @@ -265,6 +278,8 @@ python_export() {
227 eqawarn "python_export() is part of private eclass API."
228 eqawarn "Please call python_get*() instead."
229
230 + [[ ${EAPI} == [67] ]] || die "${FUNCNAME} banned in EAPI ${EAPI}"
231 +
232 _python_export "${@}"
233 }
234
235 @@ -690,7 +705,7 @@ python_optimize() {
236 python_scriptinto() {
237 debug-print-function ${FUNCNAME} "${@}"
238
239 - python_scriptroot=${1}
240 + _PYTHON_SCRIPTROOT=${1}
241 }
242
243 # @FUNCTION: python_doexe
244 @@ -725,7 +740,7 @@ python_newexe() {
245 [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
246 [[ ${#} -eq 2 ]] || die "Usage: ${FUNCNAME} <path> <new-name>"
247
248 - local wrapd=${python_scriptroot:-/usr/bin}
249 + local wrapd=${_PYTHON_SCRIPTROOT:-/usr/bin}
250
251 local f=${1}
252 local newfn=${2}
253 @@ -742,8 +757,9 @@ python_newexe() {
254 )
255
256 # install the wrapper
257 - _python_ln_rel "${ED%/}"/usr/lib/python-exec/python-exec2 \
258 - "${ED%/}/${wrapd}/${newfn}" || die
259 + local dosym=dosym
260 + [[ ${EAPI} == [67] ]] && dosym=dosym8
261 + "${dosym}" -r /usr/lib/python-exec/python-exec2 "${wrapd}/${newfn}"
262
263 # don't use this at home, just call python_doscript() instead
264 if [[ ${_PYTHON_REWRITE_SHEBANG} ]]; then
265 @@ -829,7 +845,7 @@ python_newscript() {
266 python_moduleinto() {
267 debug-print-function ${FUNCNAME} "${@}"
268
269 - python_moduleroot=${1}
270 + _PYTHON_MODULEROOT=${1}
271 }
272
273 # @FUNCTION: python_domodule
274 @@ -853,15 +869,13 @@ python_domodule() {
275 [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
276
277 local d
278 - if [[ ${python_moduleroot} == /* ]]; then
279 + if [[ ${_PYTHON_MODULEROOT} == /* ]]; then
280 # absolute path
281 - d=${python_moduleroot}
282 + d=${_PYTHON_MODULEROOT}
283 else
284 # relative to site-packages
285 - local PYTHON_SITEDIR=${PYTHON_SITEDIR}
286 - [[ ${PYTHON_SITEDIR} ]] || _python_export PYTHON_SITEDIR PYTHON_EPREFIX
287 -
288 - d=${PYTHON_SITEDIR#${PYTHON_EPREFIX:-${EPREFIX}}}/${python_moduleroot}
289 + local sitedir=$(python_get_sitedir)
290 + d=${sitedir#${EPREFIX}}/${_PYTHON_MODULEROOT//.//}
291 fi
292
293 (
294 @@ -891,10 +905,8 @@ python_doheader() {
295
296 [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
297
298 - local d PYTHON_INCLUDEDIR=${PYTHON_INCLUDEDIR}
299 - [[ ${PYTHON_INCLUDEDIR} ]] || _python_export PYTHON_INCLUDEDIR PYTHON_EPREFIX
300 -
301 - d=${PYTHON_INCLUDEDIR#${PYTHON_EPREFIX:-${EPREFIX}}}
302 + local includedir=$(python_get_includedir)
303 + local d=${includedir#${EPREFIX}}
304
305 (
306 insopts -m 0644
307 @@ -914,6 +926,8 @@ python_wrapper_setup() {
308 eqawarn "python_wrapper_setup() is part of private eclass API."
309 eqawarn "Please call python_setup() instead."
310
311 + [[ ${EAPI} == [67] ]] || die "${FUNCNAME} banned in EAPI ${EAPI}"
312 +
313 _python_wrapper_setup "${@}"
314 }
315
316 @@ -953,7 +967,7 @@ _python_wrapper_setup() {
317 _python_export "${impl}" EPYTHON PYTHON
318
319 local pyver pyother
320 - if python_is_python3; then
321 + if [[ ${EPYTHON} != python2* ]]; then
322 pyver=3
323 pyother=2
324 else
325 @@ -1032,6 +1046,9 @@ _python_wrapper_setup() {
326 #
327 # Returns 0 (true) if it is, 1 (false) otherwise.
328 python_is_python3() {
329 + eqawarn "${FUNCNAME} is deprecated, as Python 2 is not supported anymore"
330 + [[ ${EAPI} == [67] ]] || die "${FUNCNAME} banned in EAPI ${EAPI}"
331 +
332 local impl=${1:-${EPYTHON}}
333 [[ ${impl} ]] || die "python_is_python3: no impl nor EPYTHON"
334
335 @@ -1130,32 +1147,31 @@ python_fix_shebang() {
336 if [[ ${i} == *python2 ]]; then
337 from=python2
338 if [[ ! ${force} ]]; then
339 - python_is_python3 "${EPYTHON}" && error=1
340 + error=1
341 fi
342 elif [[ ${i} == *python3 ]]; then
343 from=python3
344 - if [[ ! ${force} ]]; then
345 - python_is_python3 "${EPYTHON}" || error=1
346 - fi
347 else
348 from=python
349 fi
350 break
351 ;;
352 - *python[23].[0123456789]|*pypy|*pypy3|*jython[23].[0123456789])
353 + *python[23].[0-9]|*python3.[1-9][0-9]|*pypy|*pypy3|*jython[23].[0-9])
354 # Explicit mismatch.
355 if [[ ! ${force} ]]; then
356 error=1
357 else
358 case "${i}" in
359 - *python[23].[0123456789])
360 - from="python[23].[0123456789]";;
361 + *python[23].[0-9])
362 + from="python[23].[0-9]";;
363 + *python3.[1-9][0-9])
364 + from="python3.[1-9][0-9]";;
365 *pypy)
366 from="pypy";;
367 *pypy3)
368 from="pypy3";;
369 - *jython[23].[0123456789])
370 - from="jython[23].[0123456789]";;
371 + *jython[23].[0-9])
372 + from="jython[23].[0-9]";;
373 *)
374 die "${FUNCNAME}: internal error in 2nd pattern match";;
375 esac
376
377 diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
378 index 70709b96d6..170ea19057 100644
379 --- a/eclass/toolchain-funcs.eclass
380 +++ b/eclass/toolchain-funcs.eclass
381 @@ -4,6 +4,7 @@
382 # @ECLASS: toolchain-funcs.eclass
383 # @MAINTAINER:
384 # Toolchain Ninjas <toolchain@g.o>
385 +# @SUPPORTED_EAPIS: 5 6 7 8
386 # @BLURB: functions to query common info about the toolchain
387 # @DESCRIPTION:
388 # The toolchain-funcs aims to provide a complete suite of functions
389 @@ -12,6 +13,12 @@
390 # in such a way that you can rely on the function always returning
391 # something sane.
392
393 +case ${EAPI:-0} in
394 + # EAPI=0 is still used by crossdev, bug #797367
395 + 0|5|6|7|8) ;;
396 + *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
397 +esac
398 +
399 if [[ -z ${_TOOLCHAIN_FUNCS_ECLASS} ]]; then
400 _TOOLCHAIN_FUNCS_ECLASS=1
401
402 @@ -1040,7 +1047,7 @@ gen_usr_ldscript() {
403
404 # Eventually we'd like to get rid of this func completely #417451
405 case ${CTARGET:-${CHOST}} in
406 - *-darwin*) type -P scanmacho > /dev/null || return ;; # excluded for now due to known breakage
407 + *-darwin*) ;;
408 *-android*) return 0 ;;
409 *linux*|*-freebsd*|*-openbsd*|*-netbsd*)
410 use prefix && return 0 ;;
411 @@ -1115,26 +1122,6 @@ gen_usr_ldscript() {
412 -id "${EPREFIX}"/${libdir}/${tlib} \
413 "${ED}"/${libdir}/${tlib} || die "install_name_tool failed"
414 [[ -n ${nowrite} ]] && chmod u-w "${ED}${libdir}/${tlib}"
415 - # In the build image, stuff may have already recorded the now moved
416 - # install_name, so hunt those down and fix the install_name
417 - # references.
418 - local l obj needed lib
419 - scanmacho -qyRF '%p;%n' "${D}" | { while IFS= read l ; do
420 - obj=${l%%;*}
421 - needed=${l#*;}
422 - # this is ugly, paths with spaces won't work
423 - for lib in ${needed//,/ } ; do
424 - if [[ ${lib} == */usr/lib*/${tlib} ]] ; then
425 - # don't masquerade other problems, only remove usr/
426 - # from input
427 - local s=${lib%usr/*}${lib##*/usr/}
428 - [[ ${lib} != ${s} ]] || continue
429 - einfo "gen_usr_ldscript: correcting install_name from ${lib} to ${s} in ${obj}"
430 - install_name_tool -change \
431 - "${lib}" "${s}" "${D}${obj}"
432 - fi
433 - done
434 - done }
435 # Now as we don't use GNU binutils and our linker doesn't
436 # understand linker scripts, just create a symlink.
437 pushd "${ED}/usr/${libdir}" > /dev/null
438
439 diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
440 index e85900934f..ff032dac0b 100644
441 --- a/eclass/toolchain.eclass
442 +++ b/eclass/toolchain.eclass
443 @@ -1,4 +1,4 @@
444 -# Copyright 1999-2020 Gentoo Authors
445 +# Copyright 1999-2021 Gentoo Authors
446 # Distributed under the terms of the GNU General Public License v2
447
448 # Maintainer: Toolchain Ninjas <toolchain@g.o>
449 @@ -7,6 +7,8 @@
450 DESCRIPTION="The GNU Compiler Collection"
451 HOMEPAGE="https://gcc.gnu.org/"
452
453 +# TODO: Please audit this inherit list on future EAPI bumps and ideally
454 +# conditonalise them where possible.
455 inherit eutils flag-o-matic gnuconfig libtool multilib pax-utils toolchain-funcs prefix
456
457 tc_is_live() {
458 @@ -1349,6 +1351,7 @@ downgrade_arch_flags() {
459
460 # "added" "arch" "replacement"
461 local archlist=(
462 + 10 znver3 znver2
463 9 znver2 znver1
464 4.9 bdver4 bdver3
465 4.9 bonnell atom