public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: eclass/, eclass/tests/
@ 2015-11-11 10:27 Michał Górny
  0 siblings, 0 replies; 40+ messages in thread
From: Michał Górny @ 2015-11-11 10:27 UTC (permalink / raw
  To: gentoo-commits

commit:     e0d0c114862a731d3a10cab621e1070728b8ec5f
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Nov  6 22:41:52 2015 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Nov 11 10:21:17 2015 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e0d0c114

python-utils-r1.eclass: Obtain library path from the interpreter

Obtain library path as concatenation of LIBDIR and LDLIBRARY config
variables (from sysconfig module) rather than hardcoding it in the
eclass. This improves maintainability and fixes compatibility with
ABIFLAGS-enabled Python 3.3+.

 eclass/python-utils-r1.eclass   | 21 +++++++--------------
 eclass/tests/python-utils-r1.sh |  4 ++--
 2 files changed, 9 insertions(+), 16 deletions(-)

diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index a0274f6..ec85d8a 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -151,7 +151,8 @@ _python_impl_supported() {
 # The path to Python library.
 #
 # Set and exported on request using python_export().
-# Valid only for CPython.
+# Valid only for CPython. Requires a proper build-time dependency
+# on the Python implementation.
 #
 # Example value:
 # @CODE
@@ -289,20 +290,12 @@ python_export() {
 				fi
 				;;
 			PYTHON_LIBPATH)
-				local libname
-				case "${impl}" in
-					python*)
-						libname=lib${impl}
-						;;
-					*)
-						die "${impl} lacks a dynamic library"
-						;;
-				esac
-
-				local path=${EPREFIX}/usr/$(get_libdir)
-
-				export PYTHON_LIBPATH=${path}/${libname}$(get_libname)
+				export PYTHON_LIBPATH=$("${PYTHON}" -c 'import os.path, sysconfig; print(os.path.join(sysconfig.get_config_var("LIBDIR"), sysconfig.get_config_var("LDLIBRARY")) if sysconfig.get_config_var("LDLIBRARY") else "")')
 				debug-print "${FUNCNAME}: PYTHON_LIBPATH = ${PYTHON_LIBPATH}"
+
+				if [[ ! ${PYTHON_LIBPATH} ]]; then
+					die "${impl} lacks a (usable) dynamic library"
+				fi
 				;;
 			PYTHON_CFLAGS)
 				local val

diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh
index dc6676b..e54550d 100755
--- a/eclass/tests/python-utils-r1.sh
+++ b/eclass/tests/python-utils-r1.sh
@@ -66,8 +66,8 @@ test_var PYTHON python2_7 /usr/bin/python2.7
 test_var PYTHON_SITEDIR python2_7 /usr/lib/python2.7/site-packages
 if [[ -x /usr/bin/python2.7 ]]; then
 	test_var PYTHON_INCLUDEDIR python2_7 /usr/include/python2.7
+	test_var PYTHON_LIBPATH python2_7 "/usr/lib*/libpython2.7$(get_libname)"
 fi
-test_var PYTHON_LIBPATH python2_7 /usr/lib/libpython2.7$(get_libname)
 test_var PYTHON_PKG_DEP python2_7 '*dev-lang/python*:2.7'
 test_var PYTHON_SCRIPTDIR python2_7 /usr/lib/python-exec/python2.7
 
@@ -77,8 +77,8 @@ test_var PYTHON_SITEDIR python3_4 /usr/lib/python3.4/site-packages
 if [[ -x /usr/bin/python3.4 ]]; then
 	abiflags=$(/usr/bin/python3.4 -c 'import sysconfig; print(sysconfig.get_config_var("ABIFLAGS"))')
 	test_var PYTHON_INCLUDEDIR python3_4 "/usr/include/python3.4${abiflags}"
+	test_var PYTHON_LIBPATH python3_4 "/usr/lib*/libpython3.4${abiflags}$(get_libname)"
 fi
-test_var PYTHON_LIBPATH python3_4 /usr/lib/libpython3.4$(get_libname)
 test_var PYTHON_PKG_DEP python3_4 '*dev-lang/python*:3.4'
 test_var PYTHON_SCRIPTDIR python3_4 /usr/lib/python-exec/python3.4
 


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: eclass/, eclass/tests/
@ 2015-11-11 10:27 Michał Górny
  0 siblings, 0 replies; 40+ messages in thread
From: Michał Górny @ 2015-11-11 10:27 UTC (permalink / raw
  To: gentoo-commits

commit:     6cdbddf775a921788d0aa3cd3f757c0a1ac8cd37
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Nov  6 22:21:37 2015 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Nov 11 10:21:09 2015 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6cdbddf7

python-utils-r1.eclass: Obtain include directory from the interpreter

Obtain the Python include directory using the distutils.sysconfig module
of the Python interpreter rather than hardcoding values for it. This
makes the code more maintainable, and clears the way for re-enabling
ABIFLAGS on new Python versions.

 eclass/python-utils-r1.eclass   | 21 +++++++--------------
 eclass/tests/python-utils-r1.sh | 17 +++++++++++++----
 2 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 69166cf..a0274f6 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -138,6 +138,7 @@ _python_impl_supported() {
 # The path to Python include directory.
 #
 # Set and exported on request using python_export().
+# Requires a proper build-time dependency on the Python implementation.
 #
 # Example value:
 # @CODE
@@ -279,21 +280,13 @@ python_export() {
 				debug-print "${FUNCNAME}: PYTHON_SITEDIR = ${PYTHON_SITEDIR}"
 				;;
 			PYTHON_INCLUDEDIR)
-				local dir
-				case "${impl}" in
-					python*)
-						dir=/usr/include/${impl}
-						;;
-					pypy|pypy3)
-						dir=/usr/$(get_libdir)/${impl}/include
-						;;
-					*)
-						die "${impl} lacks header files"
-						;;
-				esac
-
-				export PYTHON_INCLUDEDIR=${EPREFIX}${dir}
+				export PYTHON_INCLUDEDIR=$("${PYTHON}" -c 'import distutils.sysconfig; print(distutils.sysconfig.get_python_inc())')
 				debug-print "${FUNCNAME}: PYTHON_INCLUDEDIR = ${PYTHON_INCLUDEDIR}"
+
+				# Jython gives a non-existing directory
+				if [[ ! -d ${PYTHON_INCLUDEDIR} ]]; then
+					die "${impl} does not install any header files!"
+				fi
 				;;
 			PYTHON_LIBPATH)
 				local libname

diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh
index bd05e9e..dc6676b 100755
--- a/eclass/tests/python-utils-r1.sh
+++ b/eclass/tests/python-utils-r1.sh
@@ -64,7 +64,9 @@ inherit python-utils-r1
 test_var EPYTHON python2_7 python2.7
 test_var PYTHON python2_7 /usr/bin/python2.7
 test_var PYTHON_SITEDIR python2_7 /usr/lib/python2.7/site-packages
-test_var PYTHON_INCLUDEDIR python2_7 /usr/include/python2.7
+if [[ -x /usr/bin/python2.7 ]]; then
+	test_var PYTHON_INCLUDEDIR python2_7 /usr/include/python2.7
+fi
 test_var PYTHON_LIBPATH python2_7 /usr/lib/libpython2.7$(get_libname)
 test_var PYTHON_PKG_DEP python2_7 '*dev-lang/python*:2.7'
 test_var PYTHON_SCRIPTDIR python2_7 /usr/lib/python-exec/python2.7
@@ -72,7 +74,10 @@ test_var PYTHON_SCRIPTDIR python2_7 /usr/lib/python-exec/python2.7
 test_var EPYTHON python3_4 python3.4
 test_var PYTHON python3_4 /usr/bin/python3.4
 test_var PYTHON_SITEDIR python3_4 /usr/lib/python3.4/site-packages
-test_var PYTHON_INCLUDEDIR python3_4 /usr/include/python3.4
+if [[ -x /usr/bin/python3.4 ]]; then
+	abiflags=$(/usr/bin/python3.4 -c 'import sysconfig; print(sysconfig.get_config_var("ABIFLAGS"))')
+	test_var PYTHON_INCLUDEDIR python3_4 "/usr/include/python3.4${abiflags}"
+fi
 test_var PYTHON_LIBPATH python3_4 /usr/lib/libpython3.4$(get_libname)
 test_var PYTHON_PKG_DEP python3_4 '*dev-lang/python*:3.4'
 test_var PYTHON_SCRIPTDIR python3_4 /usr/lib/python-exec/python3.4
@@ -86,14 +91,18 @@ test_var PYTHON_SCRIPTDIR jython2_7 /usr/lib/python-exec/jython2.7
 test_var EPYTHON pypy pypy
 test_var PYTHON pypy /usr/bin/pypy
 test_var PYTHON_SITEDIR pypy /usr/lib/pypy/site-packages
-test_var PYTHON_INCLUDEDIR pypy /usr/lib/pypy/include
+if [[ -x /usr/bin/pypy ]]; then
+	test_var PYTHON_INCLUDEDIR pypy "/usr/lib*/pypy/include"
+fi
 test_var PYTHON_PKG_DEP pypy '*virtual/pypy*:0='
 test_var PYTHON_SCRIPTDIR pypy /usr/lib/python-exec/pypy
 
 test_var EPYTHON pypy3 pypy3
 test_var PYTHON pypy3 /usr/bin/pypy3
 test_var PYTHON_SITEDIR pypy3 /usr/lib/pypy3/site-packages
-test_var PYTHON_INCLUDEDIR pypy3 /usr/lib/pypy3/include
+if [[ -x /usr/bin/pypy3 ]]; then
+	test_var PYTHON_INCLUDEDIR pypy3 /usr/lib/pypy3/include
+fi
 test_var PYTHON_PKG_DEP pypy3 '*virtual/pypy3*:0='
 test_var PYTHON_SCRIPTDIR pypy3 /usr/lib/python-exec/pypy3
 


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: eclass/, eclass/tests/
@ 2015-11-11 10:27 Michał Górny
  0 siblings, 0 replies; 40+ messages in thread
From: Michał Górny @ 2015-11-11 10:27 UTC (permalink / raw
  To: gentoo-commits

commit:     fd4001e9682ed11db9f6b2cf87f3e89ed291fe02
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Nov  7 19:30:24 2015 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Nov 11 10:21:25 2015 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fd4001e9

python-utils-r1.eclass: Obtain PYTHON_SITEDIR from the interpreter

Obtain the Python site-packages directory path using
the distutils.sysconfig module, rather than hardcoding it.

 eclass/python-utils-r1.eclass   | 16 +++++-----------
 eclass/tests/python-utils-r1.sh | 12 +++++++-----
 2 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index ec85d8a..e8de6b9 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -126,6 +126,7 @@ _python_impl_supported() {
 # The path to Python site-packages directory.
 #
 # Set and exported on request using python_export().
+# Requires a proper build-time dependency on the Python implementation.
 #
 # Example value:
 # @CODE
@@ -267,17 +268,10 @@ python_export() {
 				debug-print "${FUNCNAME}: PYTHON = ${PYTHON}"
 				;;
 			PYTHON_SITEDIR)
-				local dir
-				case "${impl}" in
-					python*|pypy|pypy3)
-						dir=/usr/$(get_libdir)/${impl}
-						;;
-					jython*)
-						dir=/usr/share/${impl/n/n-}/Lib
-						;;
-				esac
-
-				export PYTHON_SITEDIR=${EPREFIX}${dir}/site-packages
+				# sysconfig can't be used because:
+				# 1) pypy doesn't give site-packages but stdlib
+				# 2) jython gives paths with wrong case
+				export PYTHON_SITEDIR=$("${PYTHON}" -c 'import distutils.sysconfig; print(distutils.sysconfig.get_python_lib())')
 				debug-print "${FUNCNAME}: PYTHON_SITEDIR = ${PYTHON_SITEDIR}"
 				;;
 			PYTHON_INCLUDEDIR)

diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh
index e54550d..457756d 100755
--- a/eclass/tests/python-utils-r1.sh
+++ b/eclass/tests/python-utils-r1.sh
@@ -63,8 +63,8 @@ inherit python-utils-r1
 
 test_var EPYTHON python2_7 python2.7
 test_var PYTHON python2_7 /usr/bin/python2.7
-test_var PYTHON_SITEDIR python2_7 /usr/lib/python2.7/site-packages
 if [[ -x /usr/bin/python2.7 ]]; then
+	test_var PYTHON_SITEDIR python2_7 "/usr/lib*/python2.7/site-packages"
 	test_var PYTHON_INCLUDEDIR python2_7 /usr/include/python2.7
 	test_var PYTHON_LIBPATH python2_7 "/usr/lib*/libpython2.7$(get_libname)"
 fi
@@ -73,9 +73,9 @@ test_var PYTHON_SCRIPTDIR python2_7 /usr/lib/python-exec/python2.7
 
 test_var EPYTHON python3_4 python3.4
 test_var PYTHON python3_4 /usr/bin/python3.4
-test_var PYTHON_SITEDIR python3_4 /usr/lib/python3.4/site-packages
 if [[ -x /usr/bin/python3.4 ]]; then
 	abiflags=$(/usr/bin/python3.4 -c 'import sysconfig; print(sysconfig.get_config_var("ABIFLAGS"))')
+	test_var PYTHON_SITEDIR python3_4 "/usr/lib*/python3.4/site-packages"
 	test_var PYTHON_INCLUDEDIR python3_4 "/usr/include/python3.4${abiflags}"
 	test_var PYTHON_LIBPATH python3_4 "/usr/lib*/libpython3.4${abiflags}$(get_libname)"
 fi
@@ -84,14 +84,16 @@ test_var PYTHON_SCRIPTDIR python3_4 /usr/lib/python-exec/python3.4
 
 test_var EPYTHON jython2_7 jython2.7
 test_var PYTHON jython2_7 /usr/bin/jython2.7
-test_var PYTHON_SITEDIR jython2_7 /usr/share/jython-2.7/Lib/site-packages
+if [[ -x /usr/bin/jython2.7 ]]; then
+	test_var PYTHON_SITEDIR jython2_7 /usr/share/jython-2.7/Lib/site-packages
+fi
 test_var PYTHON_PKG_DEP jython2_7 '*dev-java/jython*:2.7'
 test_var PYTHON_SCRIPTDIR jython2_7 /usr/lib/python-exec/jython2.7
 
 test_var EPYTHON pypy pypy
 test_var PYTHON pypy /usr/bin/pypy
-test_var PYTHON_SITEDIR pypy /usr/lib/pypy/site-packages
 if [[ -x /usr/bin/pypy ]]; then
+	test_var PYTHON_SITEDIR pypy "/usr/lib*/pypy/site-packages"
 	test_var PYTHON_INCLUDEDIR pypy "/usr/lib*/pypy/include"
 fi
 test_var PYTHON_PKG_DEP pypy '*virtual/pypy*:0='
@@ -99,8 +101,8 @@ test_var PYTHON_SCRIPTDIR pypy /usr/lib/python-exec/pypy
 
 test_var EPYTHON pypy3 pypy3
 test_var PYTHON pypy3 /usr/bin/pypy3
-test_var PYTHON_SITEDIR pypy3 /usr/lib/pypy3/site-packages
 if [[ -x /usr/bin/pypy3 ]]; then
+	test_var PYTHON_SITEDIR pypy3 "/usr/lib*/pypy3/site-packages"
 	test_var PYTHON_INCLUDEDIR pypy3 /usr/lib/pypy3/include
 fi
 test_var PYTHON_PKG_DEP pypy3 '*virtual/pypy3*:0='


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: eclass/, eclass/tests/
@ 2016-01-08  5:14 Michał Górny
  0 siblings, 0 replies; 40+ messages in thread
From: Michał Górny @ 2016-01-08  5:14 UTC (permalink / raw
  To: gentoo-commits

commit:     f76b96e65d19fe90d0b8fec5b8f41f27cb2401c3
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Jan  1 15:40:34 2016 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Jan  8 05:14:36 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f76b96e6

scons-utils.eclass: Use nproc when --jobs is used without an argument

Try to guess the number of processors when --jobs is passed without
an argument. We can't use a high number equivalent to GNU make behavior
(no limit) since SCons does not have an equivalent of --load-avg option.
Still, this is better than assuming some random, fixed number.

 eclass/scons-utils.eclass   | 30 ++++++++++++++++++++++++++++--
 eclass/tests/scons-utils.sh |  2 +-
 2 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/eclass/scons-utils.eclass b/eclass/scons-utils.eclass
index 3185282..89618f9 100644
--- a/eclass/scons-utils.eclass
+++ b/eclass/scons-utils.eclass
@@ -149,6 +149,32 @@ escons() {
 	return ${ret}
 }
 
+# @FUNCTION: _scons_get_default_jobs
+# @INTERNAL
+# @DESCRIPTION:
+# Output the default number of jobs, used if -j is used without
+# argument. Tries to figure out the number of logical CPUs, falling
+# back to hardcoded constant.
+_scons_get_default_jobs() {
+	local nproc
+
+	if type -P nproc &>/dev/null; then
+		# GNU
+		nproc=$(nproc)
+	elif type -P python &>/dev/null; then
+		# fallback to python2.6+
+		# note: this may fail (raise NotImplementedError)
+		nproc=$(python -c 'import multiprocessing; print(multiprocessing.cpu_count());' 2>/dev/null)
+	fi
+
+	if [[ ${nproc} ]]; then
+		echo $(( nproc + 1 ))
+	else
+		# random default
+		echo 5
+	fi
+}
+
 # @FUNCTION: _scons_clean_makeopts
 # @INTERNAL
 # @USAGE: [makeflags] [...]
@@ -192,7 +218,7 @@ _scons_clean_makeopts() {
 					shift
 				else
 					# no value means no limit, let's pass a random int
-					new_makeopts+=( ${1}=5 )
+					new_makeopts+=( ${1}=$(_scons_get_default_jobs) )
 				fi
 				;;
 			# strip other long options
@@ -215,7 +241,7 @@ _scons_clean_makeopts() {
 								new_optstr+="j ${2}"
 								shift
 							else
-								new_optstr+="j 5"
+								new_optstr+="j $(_scons_get_default_jobs)"
 							fi
 							;;
 						# otherwise, everything after -j is treated as an arg

diff --git a/eclass/tests/scons-utils.sh b/eclass/tests/scons-utils.sh
index 6355c54..fcb5125 100755
--- a/eclass/tests/scons-utils.sh
+++ b/eclass/tests/scons-utils.sh
@@ -28,7 +28,7 @@ test-scons_clean_makeopts() {
 }
 
 # jobcount expected for non-specified state
-jc=5
+jc=$(_scons_get_default_jobs)
 # failed test counter
 failed=0
 


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: eclass/, eclass/tests/
@ 2016-05-22 22:06 Amadeusz Piotr Żołnowski
  0 siblings, 0 replies; 40+ messages in thread
From: Amadeusz Piotr Żołnowski @ 2016-05-22 22:06 UTC (permalink / raw
  To: gentoo-commits

commit:     1c09a26ff45d4da33f9efce2950925ee917c9e0b
Author:     Amadeusz Żołnowski <aidecoe <AT> gentoo <DOT> org>
AuthorDate: Wed May 18 22:29:46 2016 +0000
Commit:     Amadeusz Piotr Żołnowski <aidecoe <AT> gentoo <DOT> org>
CommitDate: Sun May 22 22:06:16 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1c09a26f

rebar.eclass: Build Erlang/OTP projects using dev-util/rebar

It is an eclass providing functions to build Erlang/OTP projects using
dev-util/rebar. All packages in upcoming category dev-erlang are going
to use this eclass.

 eclass/rebar.eclass                    | 223 +++++++++++++++++++++++++++++++++
 eclass/tests/rebar_fix_include_path.sh | 159 +++++++++++++++++++++++
 eclass/tests/rebar_remove_deps.sh      |  99 +++++++++++++++
 eclass/tests/rebar_set_vsn.sh          | 115 +++++++++++++++++
 4 files changed, 596 insertions(+)

diff --git a/eclass/rebar.eclass b/eclass/rebar.eclass
new file mode 100644
index 0000000..ca86e88
--- /dev/null
+++ b/eclass/rebar.eclass
@@ -0,0 +1,223 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# @ECLASS: rebar.eclass
+# @MAINTAINER:
+# Amadeusz Żołnowski <aidecoe@gentoo.org>
+# @AUTHOR:
+# Amadeusz Żołnowski <aidecoe@gentoo.org>
+# @BLURB: Build Erlang/OTP projects using dev-util/rebar.
+# @DESCRIPTION:
+# An eclass providing functions to build Erlang/OTP projects using
+# dev-util/rebar.
+#
+# rebar is a tool which tries to resolve dependencies itself which is by
+# cloning remote git repositories. Dependant projects are usually expected to
+# be in sub-directory 'deps' rather than looking at system Erlang lib
+# directory. Projects relying on rebar usually don't have 'install' make
+# targets. The eclass workarounds some of these problems. It handles
+# installation in a generic way for Erlang/OTP structured projects.
+
+case "${EAPI:-0}" in
+	0|1|2|3|4|5)
+		die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}"
+		;;
+	6)
+		;;
+	*)
+		die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}"
+		;;
+esac
+
+EXPORT_FUNCTIONS src_prepare src_compile src_install
+
+RDEPEND="dev-lang/erlang"
+DEPEND="${RDEPEND}
+	dev-util/rebar
+	>=sys-apps/gawk-4.1"
+
+# @ECLASS-VARIABLE: REBAR_APP_SRC
+# @DESCRIPTION:
+# Relative path to .app.src description file.
+REBAR_APP_SRC="${REBAR_APP_SRC-src/${PN}.app.src}"
+
+# @FUNCTION: get_erl_libs
+# @RETURN: the path to Erlang lib directory
+# @DESCRIPTION:
+# Get the full path without EPREFIX to Erlang lib directory.
+get_erl_libs() {
+	echo "/usr/$(get_libdir)/erlang/lib"
+}
+
+# @FUNCTION: _rebar_find_dep
+# @INTERNAL
+# @USAGE: <project_name>
+# @RETURN: full path with EPREFIX to a Erlang package/project on success,
+# code 1 when dependency is not found and code 2 if multiple versions of
+# dependency are found.
+# @DESCRIPTION:
+# Find a Erlang package/project by name in Erlang lib directory. Project
+# directory is usually suffixed with version. It is matched to '<project_name>'
+# or '<project_name>-*'.
+_rebar_find_dep() {
+	local pn="$1"
+	local p
+	local result
+
+	pushd "${EPREFIX}$(get_erl_libs)" >/dev/null || return 1
+	for p in ${pn} ${pn}-*; do
+		if [[ -d ${p} ]]; then
+			# Ensure there's at most one matching.
+			[[ ${result} ]] && return 2
+			result="${p}"
+		fi
+	done
+	popd >/dev/null || die
+
+	[[ ${result} ]] || return 1
+	echo "${result}"
+}
+
+# @FUNCTION: erebar
+# @USAGE: <targets>
+# @DESCRIPTION:
+# Run rebar with verbose flag. Die on failure.
+erebar() {
+	debug-print-function ${FUNCNAME} "${@}"
+
+	(( $# > 0 )) || die "erebar: at least one target is required"
+
+	local -x ERL_LIBS="${EPREFIX}$(get_erl_libs)"
+	rebar -v skip_deps=true "$@" || die -n "rebar $@ failed"
+}
+
+# @FUNCTION: rebar_fix_include_path
+# @USAGE: <project_name>
+# @DESCRIPTION:
+# Fix path in rebar.config to 'include' directory of dependant project/package,
+# so it points to installation in system Erlang lib rather than relative 'deps'
+# directory.
+#
+# The function dies on failure.
+rebar_fix_include_path() {
+	debug-print-function ${FUNCNAME} "${@}"
+
+	local pn="$1"
+	local erl_libs="${EPREFIX}$(get_erl_libs)"
+	local p
+
+	p="$(_rebar_find_dep "${pn}")" \
+		|| die "failed to unambiguously resolve dependency of '${pn}'"
+
+	gawk -i inplace \
+		-v erl_libs="${erl_libs}" -v pn="${pn}" -v p="${p}" '
+/^{[[:space:]]*erl_opts[[:space:]]*,/, /}[[:space:]]*\.$/ {
+	pattern = "\"(./)?deps/" pn "/include\"";
+	if (match($0, "{i,[[:space:]]*" pattern "[[:space:]]*}")) {
+		sub(pattern, "\"" erl_libs "/" p "/include\"");
+	}
+	print $0;
+	next;
+}
+1
+' rebar.config || die "failed to fix include paths in rebar.config for '${pn}'"
+}
+
+# @FUNCTION: rebar_remove_deps
+# @DESCRIPTION:
+# Remove dependencies list from rebar.config and deceive build rules that any
+# dependencies are already fetched and built. Otherwise rebar tries to fetch
+# dependencies and compile them.
+#
+# The function dies on failure.
+rebar_remove_deps() {
+	debug-print-function ${FUNCNAME} "${@}"
+
+	mkdir -p "${S}/deps" && :>"${S}/deps/.got" && :>"${S}/deps/.built" || die
+	gawk -i inplace '
+/^{[[:space:]]*deps[[:space:]]*,/, /}[[:space:]]*\.$/ {
+	if ($0 ~ /}[[:space:]]*\.$/) {
+		print "{deps, []}.";
+	}
+	next;
+}
+1
+' rebar.config || die "failed to remove deps from rebar.config"
+}
+
+# @FUNCTION: rebar_set_vsn
+# @USAGE: [<version>]
+# @DESCRIPTION:
+# Set version in project description file if it's not set.
+#
+# <version> is optional. Default is PV stripped from version suffix.
+#
+# The function dies on failure.
+rebar_set_vsn() {
+	debug-print-function ${FUNCNAME} "${@}"
+
+	local version="${1:-${PV%_*}}"
+
+	sed -e "s/vsn, git/vsn, \"${version}\"/" \
+		-i "${S}/${REBAR_APP_SRC}" \
+		|| die "failed to set version in src/${PN}.app.src"
+}
+
+# @FUNCTION: rebar_src_prepare
+# @DESCRIPTION:
+# Prevent rebar from fetching and compiling dependencies. Set version in
+# project description file if it's not set.
+#
+# Existence of rebar.config is optional, but file description file must exist
+# at 'src/${PN}.app.src'.
+rebar_src_prepare() {
+	debug-print-function ${FUNCNAME} "${@}"
+
+	default
+	rebar_set_vsn
+	[[ -f rebar.config ]] && rebar_remove_deps
+}
+
+# @FUNCTION: rebar_src_configure
+# @DESCRIPTION:
+# Configure with ERL_LIBS set.
+rebar_src_configure() {
+	debug-print-function ${FUNCNAME} "${@}"
+
+	local -x ERL_LIBS="${EPREFIX}$(get_erl_libs)"
+	default
+}
+
+# @FUNCTION: rebar_src_compile
+# @DESCRIPTION:
+# Compile project with rebar.
+rebar_src_compile() {
+	debug-print-function ${FUNCNAME} "${@}"
+
+	erebar compile
+}
+
+# @FUNCTION: rebar_src_install
+# @DESCRIPTION:
+# Install BEAM files, include headers, executables and native libraries.
+# Install standard docs like README or defined in DOCS variable.
+#
+# Function expects that project conforms to Erlang/OTP structure.
+rebar_src_install() {
+	debug-print-function ${FUNCNAME} "${@}"
+
+	local bin
+	local dest="$(get_erl_libs)/${P}"
+
+	insinto "${dest}"
+	doins -r ebin
+	[[ -d include ]] && doins -r include
+	[[ -d bin ]] && for bin in bin/*; do dobin "$bin"; done
+
+	if [[ -d priv ]]; then
+		cp -pR priv "${ED}${dest}/" || die "failed to install priv/"
+	fi
+
+	einstalldocs
+}

diff --git a/eclass/tests/rebar_fix_include_path.sh b/eclass/tests/rebar_fix_include_path.sh
new file mode 100755
index 0000000..9047f8d
--- /dev/null
+++ b/eclass/tests/rebar_fix_include_path.sh
@@ -0,0 +1,159 @@
+#!/bin/bash
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+source tests-common.sh
+
+EAPI=6
+
+inherit rebar
+
+EPREFIX="${tmpdir}/fakeroot"
+S="${WORKDIR}/${P}"
+
+setup() {
+	mkdir -p "${S}" || die
+
+	for pkg in foo-0.1.0 bar-0.1.0; do
+		mkdir -p "${EPREFIX}$(get_erl_libs)/${pkg}/include" || die
+	done
+
+	cat <<EOF >"${S}/typical.config" || die
+%%% Comment
+
+{erl_opts, [debug_info, {src_dirs, ["src"]},
+			{i, "include"},
+			{i, "deps/foo/include"},
+			{i, "../foo/include"}]}.
+
+{port_env, [{"CFLAGS", "\$CFLAGS"}, {"LDFLAGS", "\$LDFLAGS"}]}.
+EOF
+
+	cat <<EOF >"${S}/typical.config.expected" || die
+%%% Comment
+
+{erl_opts, [debug_info, {src_dirs, ["src"]},
+			{i, "include"},
+			{i, "${EPREFIX}$(get_erl_libs)/foo-0.1.0/include"},
+			{i, "../foo/include"}]}.
+
+{port_env, [{"CFLAGS", "\$CFLAGS"}, {"LDFLAGS", "\$LDFLAGS"}]}.
+EOF
+
+	cat <<EOF >"${S}/inc_one_line.config" || die
+%%% Comment
+
+{erl_opts, [debug_info, {src_dirs, ["src"]}, {i, "include"}, {i, "deps/foo/include"}, {i, "../foo/include"}]}.
+
+{port_env, [{"CFLAGS", "\$CFLAGS"}, {"LDFLAGS", "\$LDFLAGS"}]}.
+EOF
+
+	cat <<EOF >"${S}/inc_one_line.config.expected" || die
+%%% Comment
+
+{erl_opts, [debug_info, {src_dirs, ["src"]}, {i, "include"}, {i, "${EPREFIX}$(get_erl_libs)/foo-0.1.0/include"}, {i, "../foo/include"}]}.
+
+{port_env, [{"CFLAGS", "\$CFLAGS"}, {"LDFLAGS", "\$LDFLAGS"}]}.
+EOF
+}
+
+test_typical_config() {
+	local diff_rc
+	local unit_rc
+
+	# Prepare
+	cd "${S}" || die
+	cp typical.config rebar.config || die
+
+	# Run unit
+	(rebar_fix_include_path foo)
+	unit_rc=$?
+
+	# Test result
+	diff rebar.config typical.config.expected
+	diff_rc=$?
+
+	[[ ${unit_rc}${diff_rc} = 00 ]]
+}
+
+test_multiple_versions() {
+	local diff_rc
+	local unit_rc
+
+	# Prepare
+	cd "${S}" || die
+	cp typical.config rebar.config || die
+	mkdir -p "${EPREFIX}$(get_erl_libs)/foo-1.0.0/include" || die
+
+	# Run unit
+	(rebar_fix_include_path foo 2>/dev/null)
+	unit_rc=$?
+
+	# Test result
+	diff rebar.config typical.config
+	diff_rc=$?
+
+	# Clean up
+	rm -r "${EPREFIX}$(get_erl_libs)/foo-1.0.0" || die
+
+	[[ ${unit_rc}${diff_rc} = 10 ]]
+}
+
+test_not_found() {
+	local diff_rc
+	local unit_rc
+
+	# Prepare
+	cd "${S}" || die
+	cp typical.config rebar.config || die
+
+	# Run unit
+	(rebar_fix_include_path fo 2>/dev/null)
+	unit_rc=$?
+
+	# Test result
+	diff rebar.config typical.config
+	diff_rc=$?
+
+	[[ ${unit_rc}${diff_rc} = 10 ]]
+}
+
+test_includes_in_one_line() {
+	local diff_rc
+	local unit_rc
+
+	# Prepare
+	cd "${S}" || die
+	cp inc_one_line.config rebar.config || die
+
+	# Run unit
+	(rebar_fix_include_path foo)
+	unit_rc=$?
+
+	# Test result
+	diff rebar.config inc_one_line.config.expected
+	diff_rc=$?
+
+	[[ ${unit_rc}${diff_rc} = 00 ]]
+}
+
+setup
+
+tbegin "rebar_fix_include_path deals with typical config"
+test_typical_config
+tend $?
+
+tbegin "rebar_fix_include_path fails on multiple versions of dependency"
+test_multiple_versions
+tend $?
+
+tbegin "rebar_fix_include_path fails if dependency is not found"
+test_not_found
+tend $?
+
+tbegin "rebar_fix_include_path deals with all includes in one line"
+test_includes_in_one_line
+tend $?
+
+texit

diff --git a/eclass/tests/rebar_remove_deps.sh b/eclass/tests/rebar_remove_deps.sh
new file mode 100755
index 0000000..05207a7
--- /dev/null
+++ b/eclass/tests/rebar_remove_deps.sh
@@ -0,0 +1,99 @@
+#!/bin/bash
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+source tests-common.sh
+
+EAPI=6
+
+inherit rebar
+
+EPREFIX="${tmpdir}/fakeroot"
+S="${WORKDIR}/${P}"
+
+setup() {
+	mkdir -p "${S}" || die
+
+	cat <<EOF >"${S}/rebar.config.expected" || die
+%%% Comment
+
+{port_specs, [{"priv/lib/esip_drv.so", ["c_src/esip_codec.c"]}]}.
+
+{deps, []}.
+
+{clean_files, ["c_src/esip_codec.gcda", "c_src/esip_codec.gcno"]}.
+EOF
+
+	cat <<EOF >"${S}/typical.config" || die
+%%% Comment
+
+{port_specs, [{"priv/lib/esip_drv.so", ["c_src/esip_codec.c"]}]}.
+
+{deps, [{stun, ".*", {git, "https://github.com/processone/stun", {tag, "1.0.3"}}},
+	{fast_tls, ".*", {git, "https://github.com/processone/fast_tls", {tag, "1.0.3"}}},
+	{p1_utils, ".*", {git, "https://github.com/processone/p1_utils", {tag, "1.0.3"}}}]}.
+
+{clean_files, ["c_src/esip_codec.gcda", "c_src/esip_codec.gcno"]}.
+EOF
+
+	cat <<EOF >"${S}/deps_one_line.config" || die
+%%% Comment
+
+{port_specs, [{"priv/lib/esip_drv.so", ["c_src/esip_codec.c"]}]}.
+
+{deps, [{stun, ".*", {git, "https://github.com/processone/stun", {tag, "1.0.3"}}}, {fast_tls, ".*", {git, "https://github.com/processone/fast_tls", {tag, "1.0.3"}}}, {p1_utils, ".*", {git, "https://github.com/processone/p1_utils", {tag, "1.0.3"}}}]}.
+
+{clean_files, ["c_src/esip_codec.gcda", "c_src/esip_codec.gcno"]}.
+EOF
+}
+
+test_typical_config() {
+	local diff_rc
+	local unit_rc
+
+	# Prepare
+	cd "${S}" || die
+	cp typical.config rebar.config || die
+
+	# Run unit
+	(rebar_remove_deps)
+	unit_rc=$?
+
+	# Test result
+	diff rebar.config rebar.config.expected
+	diff_rc=$?
+
+	[[ ${unit_rc}${diff_rc} = 00 ]]
+}
+
+test_deps_in_one_line() {
+	local diff_rc
+	local unit_rc
+
+	# Prepare
+	cd "${S}" || die
+	cp deps_one_line.config rebar.config || die
+
+	# Run unit
+	(rebar_remove_deps)
+	unit_rc=$?
+
+	# Test result
+	diff rebar.config rebar.config.expected
+	diff_rc=$?
+
+	[[ ${unit_rc}${diff_rc} = 00 ]]
+}
+
+setup
+
+tbegin "rebar_remove_deps deals with typical config"
+test_typical_config
+tend $?
+
+tbegin "rebar_remove_deps deals with all deps in one line"
+test_deps_in_one_line
+tend $?
+
+texit

diff --git a/eclass/tests/rebar_set_vsn.sh b/eclass/tests/rebar_set_vsn.sh
new file mode 100755
index 0000000..2a9f5bc
--- /dev/null
+++ b/eclass/tests/rebar_set_vsn.sh
@@ -0,0 +1,115 @@
+#!/bin/bash
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+source tests-common.sh
+
+EAPI=6
+
+inherit rebar
+
+EPREFIX="${tmpdir}/fakeroot"
+S="${WORKDIR}/${P}"
+
+setup() {
+	mkdir -p "${S}/src" || die
+
+	cat <<EOF >"${S}/app.src.expected" || die
+%%% Comment
+
+{application, esip,
+ [{description, "ProcessOne SIP server component in Erlang"},
+  {vsn, "0"},
+  {modules, []},
+  {registered, []},
+EOF
+
+	cat <<EOF >"${S}/app.src" || die
+%%% Comment
+
+{application, esip,
+ [{description, "ProcessOne SIP server component in Erlang"},
+  {vsn, git},
+  {modules, []},
+  {registered, []},
+EOF
+}
+
+test_typical_app_src() {
+	local diff_rc
+	local unit_rc
+
+	# Prepare
+	cd "${S}" || die
+	cp app.src "src/${PN}.app.src" || die
+
+	# Run unit
+	(rebar_set_vsn)
+	unit_rc=$?
+
+	# Test result
+	diff "src/${PN}.app.src" app.src.expected
+	diff_rc=$?
+
+	[[ ${unit_rc}${diff_rc} = 00 ]]
+}
+
+test_app_src_missing() {
+	local unit_rc
+
+	# Prepare
+	cd "${S}" || die
+	rm -f "src/${PN}.app.src" || die
+
+	# Run unit
+	(rebar_set_vsn 2>/dev/null)
+	unit_rc=$?
+
+	[[ ${unit_rc} = 1 ]]
+}
+
+test_set_custom_version() {
+	local diff_rc
+	local unit_rc
+
+	# Prepare
+	cd "${S}" || die
+	cp app.src "src/${PN}.app.src" || die
+	cat <<EOF >"${S}/custom_app.src.expected" || die
+%%% Comment
+
+{application, esip,
+ [{description, "ProcessOne SIP server component in Erlang"},
+  {vsn, "1.2.3"},
+  {modules, []},
+  {registered, []},
+EOF
+
+	# Run unit
+	(rebar_set_vsn 1.2.3)
+	unit_rc=$?
+
+	# Test result
+	diff "src/${PN}.app.src" custom_app.src.expected
+	diff_rc=$?
+
+	[[ ${unit_rc}${diff_rc} = 00 ]]
+}
+
+
+setup
+
+tbegin "rebar_set_vsn deals with typical app.src"
+test_typical_app_src
+tend $?
+
+tbegin "rebar_set_vsn fails when app.src is missing"
+test_app_src_missing
+tend $?
+
+tbegin "rebar_set_vsn sets custom version in app.src"
+test_set_custom_version
+tend $?
+
+texit


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: eclass/, eclass/tests/
@ 2016-05-29  9:23 Amadeusz Piotr Żołnowski
  0 siblings, 0 replies; 40+ messages in thread
From: Amadeusz Piotr Żołnowski @ 2016-05-29  9:23 UTC (permalink / raw
  To: gentoo-commits

commit:     98ba2191992c67244e50da4e95d38fd426b817ee
Author:     Amadeusz Żołnowski <aidecoe <AT> aidecoe <DOT> name>
AuthorDate: Thu May 26 19:59:11 2016 +0000
Commit:     Amadeusz Piotr Żołnowski <aidecoe <AT> gentoo <DOT> org>
CommitDate: Sun May 29 09:23:21 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=98ba2191

rebar.eclass: Optionally provide alternate rebar config to alter

Some packages have separate configs for build and tests. Build config is
always named 'rebar.config' and there seem to be no standard name for
tests config.

 eclass/rebar.eclass                    | 14 +++++++++++---
 eclass/tests/rebar_fix_include_path.sh | 23 +++++++++++++++++++++++
 eclass/tests/rebar_remove_deps.sh      | 23 +++++++++++++++++++++++
 3 files changed, 57 insertions(+), 3 deletions(-)

diff --git a/eclass/rebar.eclass b/eclass/rebar.eclass
index 9f3d9e2..c8a2cf4 100644
--- a/eclass/rebar.eclass
+++ b/eclass/rebar.eclass
@@ -93,17 +93,20 @@ erebar() {
 }
 
 # @FUNCTION: rebar_fix_include_path
-# @USAGE: <project_name>
+# @USAGE: <project_name> [<rebar_config>]
 # @DESCRIPTION:
 # Fix path in rebar.config to 'include' directory of dependant project/package,
 # so it points to installation in system Erlang lib rather than relative 'deps'
 # directory.
 #
+# <rebar_config> is optional. Default is 'rebar.config'.
+#
 # The function dies on failure.
 rebar_fix_include_path() {
 	debug-print-function ${FUNCNAME} "${@}"
 
 	local pn="$1"
+	local rebar_config="${2:-rebar.config}"
 	local erl_libs="${EPREFIX}$(get_erl_libs)"
 	local p
 
@@ -121,19 +124,24 @@ rebar_fix_include_path() {
 	next;
 }
 1
-' rebar.config || die "failed to fix include paths in rebar.config for '${pn}'"
+' "${rebar_config}" || die "failed to fix include paths in ${rebar_config} for '${pn}'"
 }
 
 # @FUNCTION: rebar_remove_deps
+# @USAGE: [<rebar_config>]
 # @DESCRIPTION:
 # Remove dependencies list from rebar.config and deceive build rules that any
 # dependencies are already fetched and built. Otherwise rebar tries to fetch
 # dependencies and compile them.
 #
+# <rebar_config> is optional. Default is 'rebar.config'.
+#
 # The function dies on failure.
 rebar_remove_deps() {
 	debug-print-function ${FUNCNAME} "${@}"
 
+	local rebar_config="${1:-rebar.config}"
+
 	mkdir -p "${S}/deps" && :>"${S}/deps/.got" && :>"${S}/deps/.built" || die
 	gawk -i inplace '
 /^{[[:space:]]*deps[[:space:]]*,/, /}[[:space:]]*\.$/ {
@@ -143,7 +151,7 @@ rebar_remove_deps() {
 	next;
 }
 1
-' rebar.config || die "failed to remove deps from rebar.config"
+' "${rebar_config}" || die "failed to remove deps from ${rebar_config}"
 }
 
 # @FUNCTION: rebar_set_vsn

diff --git a/eclass/tests/rebar_fix_include_path.sh b/eclass/tests/rebar_fix_include_path.sh
index 9047f8d..c8ab178 100755
--- a/eclass/tests/rebar_fix_include_path.sh
+++ b/eclass/tests/rebar_fix_include_path.sh
@@ -77,6 +77,25 @@ test_typical_config() {
 	[[ ${unit_rc}${diff_rc} = 00 ]]
 }
 
+test_typical_config_with_different_name() {
+	local diff_rc
+	local unit_rc
+
+	# Prepare
+	cd "${S}" || die
+	cp typical.config other.config || die
+
+	# Run unit
+	(rebar_fix_include_path foo other.config)
+	unit_rc=$?
+
+	# Test result
+	diff other.config typical.config.expected
+	diff_rc=$?
+
+	[[ ${unit_rc}${diff_rc} = 00 ]]
+}
+
 test_multiple_versions() {
 	local diff_rc
 	local unit_rc
@@ -144,6 +163,10 @@ tbegin "rebar_fix_include_path deals with typical config"
 test_typical_config
 tend $?
 
+tbegin "rebar_fix_include_path deals with typical config with different name"
+test_typical_config_with_different_name
+tend $?
+
 tbegin "rebar_fix_include_path fails on multiple versions of dependency"
 test_multiple_versions
 tend $?

diff --git a/eclass/tests/rebar_remove_deps.sh b/eclass/tests/rebar_remove_deps.sh
index 05207a7..32351bf 100755
--- a/eclass/tests/rebar_remove_deps.sh
+++ b/eclass/tests/rebar_remove_deps.sh
@@ -67,6 +67,25 @@ test_typical_config() {
 	[[ ${unit_rc}${diff_rc} = 00 ]]
 }
 
+test_typical_config_with_different_name() {
+	local diff_rc
+	local unit_rc
+
+	# Prepare
+	cd "${S}" || die
+	cp typical.config other.config || die
+
+	# Run unit
+	(rebar_remove_deps other.config)
+	unit_rc=$?
+
+	# Test result
+	diff other.config rebar.config.expected
+	diff_rc=$?
+
+	[[ ${unit_rc}${diff_rc} = 00 ]]
+}
+
 test_deps_in_one_line() {
 	local diff_rc
 	local unit_rc
@@ -92,6 +111,10 @@ tbegin "rebar_remove_deps deals with typical config"
 test_typical_config
 tend $?
 
+tbegin "rebar_remove_deps deals with typical config with different name"
+test_typical_config_with_different_name
+tend $?
+
 tbegin "rebar_remove_deps deals with all deps in one line"
 test_deps_in_one_line
 tend $?


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: eclass/, eclass/tests/
@ 2016-06-26 15:36 Michał Górny
  0 siblings, 0 replies; 40+ messages in thread
From: Michał Górny @ 2016-06-26 15:36 UTC (permalink / raw
  To: gentoo-commits

commit:     6984a5b149a215dd96a9759d3d1f251354faf38f
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 22 19:54:44 2016 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Jun 26 15:34:47 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6984a5b1

toolchain-funcs.eclass: Add helpful tc-is-{gcc,clang} wrappers

 eclass/tests/toolchain-funcs.sh | 28 ++++++++++++++++++++++++++++
 eclass/toolchain-funcs.eclass   | 12 ++++++++++++
 2 files changed, 40 insertions(+)

diff --git a/eclass/tests/toolchain-funcs.sh b/eclass/tests/toolchain-funcs.sh
index 6f37996..e6a1538 100755
--- a/eclass/tests/toolchain-funcs.sh
+++ b/eclass/tests/toolchain-funcs.sh
@@ -120,6 +120,20 @@ export CC=gcc
 )
 tend $?
 
+tbegin "tc-is-gcc (gcc)"
+(
+export CC=gcc
+tc-is-gcc
+)
+tend $?
+
+tbegin "! tc-is-clang (gcc)"
+(
+export CC=gcc
+! tc-is-clang
+)
+tend $?
+
 if type -P clang &>/dev/null; then
 	tbegin "tc-get-compiler-type (clang)"
 	(
@@ -127,6 +141,20 @@ if type -P clang &>/dev/null; then
 	[[ $(tc-get-compiler-type) == clang ]]
 	)
 	tend $?
+
+	tbegin "! tc-is-gcc (clang)"
+	(
+	export CC=clang
+	! tc-is-gcc
+	)
+	tend $?
+
+	tbegin "tc-is-clang (clang)"
+	(
+	export CC=clang
+	tc-is-clang
+	)
+	tend $?
 fi
 
 if type -P pathcc &>/dev/null; then

diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
index a29784c..d3abfb5 100644
--- a/eclass/toolchain-funcs.eclass
+++ b/eclass/toolchain-funcs.eclass
@@ -607,6 +607,18 @@ tc-get-compiler-type() {
 	esac
 }
 
+# @FUNCTION: tc-is-gcc
+# @RETURN: Shell true if the current compiler is GCC, false otherwise.
+tc-is-gcc() {
+	[[ $(tc-get-compiler-type) == gcc ]]
+}
+
+# @FUNCTION: tc-is-clang
+# @RETURN: Shell true if the current compiler is clang, false otherwise.
+tc-is-clang() {
+	[[ $(tc-get-compiler-type) == clang ]]
+}
+
 # Internal func.  The first argument is the version info to expand.
 # Query the preprocessor to improve compatibility across different
 # compilers rather than maintaining a --version flag matrix. #335943


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: eclass/, eclass/tests/
@ 2016-12-18 13:47 Michał Górny
  0 siblings, 0 replies; 40+ messages in thread
From: Michał Górny @ 2016-12-18 13:47 UTC (permalink / raw
  To: gentoo-commits

commit:     83e052c75fcfff084d1cd98ddb914c63926ece64
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 13 09:31:12 2016 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Dec 18 13:46:46 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=83e052c7

multiprocessing.eclass: Support passing custom inf values for getters

Support passing custom values for 'infinity' in makeopts_jobs()
and makeopts_loadavg(). This can be used e.g. when a build system does
not support --loadavg, and therefore '--jobs 999' would most likely
be a really bad idea. Combined with get_nproc(), this can be used to
provide a sane replacement instead.

 eclass/multiprocessing.eclass                    | 17 ++++++++++-------
 eclass/tests/multiprocessing_makeopts_jobs.sh    |  5 ++++-
 eclass/tests/multiprocessing_makeopts_loadavg.sh |  5 ++++-
 3 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/eclass/multiprocessing.eclass b/eclass/multiprocessing.eclass
index 3c5dfff..70ca475 100644
--- a/eclass/multiprocessing.eclass
+++ b/eclass/multiprocessing.eclass
@@ -86,26 +86,27 @@ get_nproc() {
 }
 
 # @FUNCTION: makeopts_jobs
-# @USAGE: [${MAKEOPTS}]
+# @USAGE: [${MAKEOPTS}] [${inf:-999}]
 # @DESCRIPTION:
 # Searches the arguments (defaults to ${MAKEOPTS}) and extracts the jobs number
 # specified therein.  Useful for running non-make tools in parallel too.
 # i.e. if the user has MAKEOPTS=-j9, this will echo "9" -- we can't return the
 # number as bash normalizes it to [0, 255].  If the flags haven't specified a
 # -j flag, then "1" is shown as that is the default `make` uses.  Since there's
-# no way to represent infinity, we return 999 if the user has -j without a number.
+# no way to represent infinity, we return ${inf} (defaults to 999) if the user
+# has -j without a number.
 makeopts_jobs() {
 	[[ $# -eq 0 ]] && set -- ${MAKEOPTS}
 	# This assumes the first .* will be more greedy than the second .*
 	# since POSIX doesn't specify a non-greedy match (i.e. ".*?").
 	local jobs=$(echo " $* " | sed -r -n \
 		-e 's:.*[[:space:]](-[a-z]*j|--jobs[=[:space:]])[[:space:]]*([0-9]+).*:\2:p' \
-		-e 's:.*[[:space:]](-[a-z]*j|--jobs)[[:space:]].*:999:p')
+		-e "s:.*[[:space:]](-[a-z]*j|--jobs)[[:space:]].*:${2:-999}:p")
 	echo ${jobs:-1}
 }
 
 # @FUNCTION: makeopts_loadavg
-# @USAGE: [${MAKEOPTS}]
+# @USAGE: [${MAKEOPTS}] [${inf:-999}]
 # @DESCRIPTION:
 # Searches the arguments (defaults to ${MAKEOPTS}) and extracts the value set
 # for load-average. For make and ninja based builds this will mean new jobs are
@@ -113,15 +114,17 @@ makeopts_jobs() {
 # get excessive due to I/O and not just due to CPU load.
 # Be aware that the returned number might be a floating-point number. Test
 # whether your software supports that.
+# If no limit is specified or --load-average is used without a number, ${inf}
+# (defaults to 999) is returned.
 makeopts_loadavg() {
 	[[ $# -eq 0 ]] && set -- ${MAKEOPTS}
 	# This assumes the first .* will be more greedy than the second .*
 	# since POSIX doesn't specify a non-greedy match (i.e. ".*?").
 	local lavg=$(echo " $* " | sed -r -n \
 		-e 's:.*[[:space:]](-[a-z]*l|--(load-average|max-load)[=[:space:]])[[:space:]]*([0-9]+|[0-9]+\.[0-9]+).*:\3:p' \
-		-e 's:.*[[:space:]](-[a-z]*l|--(load-average|max-load))[[:space:]].*:999:p')
-	# Default to 999 since the default is to not use a load limit.
-	echo ${lavg:-999}
+		-e "s:.*[[:space:]](-[a-z]*l|--(load-average|max-load))[[:space:]].*:${2:-999}:p")
+	# Default to ${inf} since the default is to not use a load limit.
+	echo ${lavg:-${2:-999}}
 }
 
 # @FUNCTION: multijob_init

diff --git a/eclass/tests/multiprocessing_makeopts_jobs.sh b/eclass/tests/multiprocessing_makeopts_jobs.sh
index a1e43c8..ef47727 100755
--- a/eclass/tests/multiprocessing_makeopts_jobs.sh
+++ b/eclass/tests/multiprocessing_makeopts_jobs.sh
@@ -9,7 +9,7 @@ inherit multiprocessing
 
 test-makeopts_jobs() {
 	local exp=$1; shift
-	tbegin "makeopts_jobs($*) == ${exp}"
+	tbegin "makeopts_jobs($1${2+; inf=${2}}) == ${exp}"
 	local act=$(makeopts_jobs "$@")
 	[[ ${act} == "${exp}" ]]
 	tend $? "Got back: ${act}"
@@ -39,4 +39,7 @@ for (( i = 0; i < ${#tests[@]}; i += 2 )) ; do
 	test-makeopts_jobs "${tests[i]}" "${tests[i+1]}"
 done
 
+# test custom inf value
+test-makeopts_jobs 645 "-j" 645
+
 texit

diff --git a/eclass/tests/multiprocessing_makeopts_loadavg.sh b/eclass/tests/multiprocessing_makeopts_loadavg.sh
index 276b7e7..6b976be 100755
--- a/eclass/tests/multiprocessing_makeopts_loadavg.sh
+++ b/eclass/tests/multiprocessing_makeopts_loadavg.sh
@@ -9,7 +9,7 @@ inherit multiprocessing
 
 test-makeopts_loadavg() {
 	local exp=$1; shift
-	tbegin "makeopts_loadavg($*) == ${exp}"
+	tbegin "makeopts_loadavg($1${2+; inf=${2}}) == ${exp}"
 	local act=$(makeopts_loadavg "$@")
 	[[ ${act} == "${exp}" ]]
 	tend $? "Got back: ${act}"
@@ -36,4 +36,7 @@ for (( i = 0; i < ${#tests[@]}; i += 2 )) ; do
 	test-makeopts_loadavg "${tests[i]}" "${tests[i+1]}"
 done
 
+# test custom inf value
+test-makeopts_loadavg 645 "-l" 645
+
 texit


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: eclass/, eclass/tests/
@ 2017-08-25 13:53 Michał Górny
  0 siblings, 0 replies; 40+ messages in thread
From: Michał Górny @ 2017-08-25 13:53 UTC (permalink / raw
  To: gentoo-commits

commit:     6f0e2e53c401a01ee8015e356699bbfb9d246e35
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Jul  1 16:14:44 2017 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Aug 25 13:53:18 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6f0e2e53

flag-o-matic.eclass: Strip LDFLAGS unsupported by the C compiler, #621274

Include LDFLAGS in the variables stripped by strip-unsupported-flags.
The code reuses the current functions for testing CC, and so only remove
LDFLAGS that are rejected by the C compiler and not the linker. This
solves the case of bug #621274 where LDFLAGS contained GCC-specific
-flto flag.

 eclass/flag-o-matic.eclass   | 3 +++
 eclass/tests/flag-o-matic.sh | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/eclass/flag-o-matic.eclass b/eclass/flag-o-matic.eclass
index 79866e04a48..4e3cfff5afd 100644
--- a/eclass/flag-o-matic.eclass
+++ b/eclass/flag-o-matic.eclass
@@ -546,6 +546,9 @@ strip-unsupported-flags() {
 	export CXXFLAGS=$(test-flags-CXX ${CXXFLAGS})
 	export FFLAGS=$(test-flags-F77 ${FFLAGS})
 	export FCFLAGS=$(test-flags-FC ${FCFLAGS})
+	# note: this does not verify the linker flags but it is enough
+	# to strip invalid C flags which are much more likely, #621274
+	export LDFLAGS=$(test-flags-CC ${LDFLAGS})
 }
 
 # @FUNCTION: get-flag

diff --git a/eclass/tests/flag-o-matic.sh b/eclass/tests/flag-o-matic.sh
index 5e7ee354bf3..53af9f862c4 100755
--- a/eclass/tests/flag-o-matic.sh
+++ b/eclass/tests/flag-o-matic.sh
@@ -55,7 +55,7 @@ done <<<"
 
 tbegin "strip-unsupported-flags"
 strip-unsupported-flags
-[[ ${CFLAGS} == "" ]] && [[ ${CXXFLAGS} == "-z=2" ]]
+[[ ${CFLAGS} == "" ]] && [[ ${CXXFLAGS} == "-z=2" ]] && [[ ${LDFLAGS} == "" ]]
 ftend
 
 for var in $(all-flag-vars) ; do


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: eclass/, eclass/tests/
@ 2017-09-26 18:46 Ulrich Müller
  0 siblings, 0 replies; 40+ messages in thread
From: Ulrich Müller @ 2017-09-26 18:46 UTC (permalink / raw
  To: gentoo-commits

commit:     8a8ce07898a3aabce36291d13ea8a313ebd32d79
Author:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Wed Sep 20 19:28:22 2017 +0000
Commit:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Tue Sep 26 18:46:26 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8a8ce078

eapi7-ver.eclass: Initial implementation of ver_test().

This should strictly follow Algorithms 3.1 to 3.7 specified in PMS:
https://projects.gentoo.org/pms/6/pms.html#x1-310003.3

 eclass/eapi7-ver.eclass             | 126 +++++++++++++++++++++++++++++++++++-
 eclass/tests/eapi7-ver.sh           | 112 ++++++++++++++++++++++++++++++++
 eclass/tests/eapi7-ver_benchmark.sh |  34 ++++++++++
 3 files changed, 269 insertions(+), 3 deletions(-)

diff --git a/eclass/eapi7-ver.eclass b/eclass/eapi7-ver.eclass
index 6f8f0c0a1c3..1ad1cbe2edc 100644
--- a/eclass/eapi7-ver.eclass
+++ b/eclass/eapi7-ver.eclass
@@ -16,8 +16,6 @@
 #
 # https://bugs.gentoo.org/482170
 #
-# Note: version comparison function is not included currently.
-#
 # @ROFF .SS
 # Version strings
 #
@@ -185,5 +183,127 @@ ver_rs() {
 # revision parts), and the comparison is performed according to
 # the algorithm specified in the PMS.
 ver_test() {
-	die "${FUNCNAME}: not implemented"
+	local v1 v2 op i tail result
+	local -a v1comp v2comp
+	local match=(
+		"+([0-9])*(.+([0-9]))"						# numeric components
+		"[a-z]"										# letter component
+		"*(@(_alpha|_beta|_pre|_rc|_p)*([0-9]))"	# suffixes
+		"-r+([0-9])"								# revision
+	)
+
+	local LC_ALL=C shopt_save=$(shopt -p extglob)
+	shopt -s extglob
+
+	if [[ $# -eq 2 ]]; then
+		v1=${PVR}
+	elif [[ $# -eq 3 ]]; then
+		v1=$1; shift
+	else
+		die "${FUNCNAME}: bad number of arguments"
+	fi
+	op=$1
+	v2=$2
+
+	case ${op} in
+		-eq|-ne|-lt|-le|-gt|-ge) ;;
+		*) die "${FUNCNAME}: invalid operator: ${op}" ;;
+	esac
+
+	# Test for both versions being valid, and split them into parts
+	for (( i=0; i<4; i++ )); do
+		tail=${v1##${match[i]}}
+		v1comp[i]=${v1%"${tail}"}
+		v1=${tail}
+		tail=${v2##${match[i]}}
+		v2comp[i]=${v2%"${tail}"}
+		v2=${tail}
+	done
+	# There must not be any remaining tail, and the numeric part
+	# must be non-empty.  All other parts are optional.
+	[[ -z ${v1} && -z ${v2} && -n ${v1comp[0]} && -n ${v2comp[0]} ]] \
+		|| die "${FUNCNAME}: invalid version"
+
+	# Compare numeric components (PMS algorithm 3.2)
+	_ver_cmp_num() {
+		local a=(${1//./ }) b=(${2//./ })
+		local an=${#a[@]} bn=${#b[@]}
+		local i
+		# First component
+		[[ 10#${a[0]} -gt 10#${b[0]} ]] && return 2
+		[[ 10#${a[0]} -lt 10#${b[0]} ]] && return 1
+		for (( i=1; i<an && i<bn; i++ )); do
+			# Other components (PMS algorithm 3.3)
+			if [[ ${a[i]} == 0* || ${b[i]} == 0* ]]; then
+				local ap=${a[i]%%*(0)} bp=${b[i]%%*(0)}
+				[[ ${ap} > ${bp} ]] && return 2
+				[[ ${ap} < ${bp} ]] && return 1
+			else
+				[[ ${a[i]} -gt ${b[i]} ]] && return 2
+				[[ ${a[i]} -lt ${b[i]} ]] && return 1
+			fi
+		done
+		[[ ${an} -gt ${bn} ]] && return 2
+		[[ ${an} -lt ${bn} ]] && return 1
+		return 0
+	}
+
+	# Compare letter components (PMS algorithm 3.4)
+	_ver_cmp_let() {
+		local a=$1 b=$2
+		[[ ${a} > ${b} ]] && return 2
+		[[ ${a} < ${b} ]] && return 1
+		return 0
+	}
+
+	# Compare suffixes (PMS algorithm 3.5)
+	_ver_cmp_suf() {
+		local a=(${1//_/ }) b=(${2//_/ })
+		local an=${#a[@]} bn=${#b[@]}
+		local i
+		for (( i=0; i<an && i<bn; i++ )); do
+			# Compare each suffix (PMS algorithm 3.6)
+			if [[ ${a[i]%%*([0-9])} == "${b[i]%%*([0-9])}" ]]; then
+				[[ 10#${a[i]##*([a-z])} -gt 10#${b[i]##*([a-z])} ]] && return 2
+				[[ 10#${a[i]##*([a-z])} -lt 10#${b[i]##*([a-z])} ]] && return 1
+			else
+				# Check for p first
+				[[ ${a[i]} == p*([0-9]) ]] && return 2
+				[[ ${b[i]} == p*([0-9]) ]] && return 1
+				# Hack: Use that alpha < beta < pre < rc alphabetically
+				[[ ${a[i]} > ${b[i]} ]] && return 2 || return 1
+			fi
+		done
+		if [[ ${an} -gt ${bn} ]]; then
+			[[ ${a[bn]} == p*([0-9]) ]] && return 2 || return 1
+		elif [[ ${an} -lt ${bn} ]]; then
+			[[ ${b[an]} == p*([0-9]) ]] && return 1 || return 2
+		fi
+		return 0
+	}
+
+	# Compare revision components (PMS algorithm 3.7)
+	_ver_cmp_rev() {
+		local a=${1#-r} b=${2#-r}
+		[[ 10#${a} -gt 10#${b} ]] && return 2
+		[[ 10#${a} -lt 10#${b} ]] && return 1
+		return 0
+	}
+
+	# Version comparison top-level logic (PMS algorithm 3.1)
+	_ver_cmp_num "${v1comp[0]}" "${v2comp[0]}" &&
+	_ver_cmp_let "${v1comp[1]}" "${v2comp[1]}" &&
+	_ver_cmp_suf "${v1comp[2]}" "${v2comp[2]}" &&
+	_ver_cmp_rev "${v1comp[3]}" "${v2comp[3]}"
+
+	case $? in
+		0) result=0  ;;			# a = b
+		1) result=-1 ;;			# a < b
+		2) result=1  ;;			# a > b
+		*) die "${FUNCNAME}: invalid return code: $?" ;;
+	esac
+
+	${shopt_save}
+
+	test "${result}" "${op}" 0
 }

diff --git a/eclass/tests/eapi7-ver.sh b/eclass/tests/eapi7-ver.sh
index 8a96e4d29b1..fd085a415b6 100755
--- a/eclass/tests/eapi7-ver.sh
+++ b/eclass/tests/eapi7-ver.sh
@@ -17,6 +17,15 @@ teq() {
 	tend ${?} "returned: ${got}"
 }
 
+teqr() {
+	local expected=$1; shift
+	tbegin "$* -> ${expected}"
+	"$@"
+	local ret=$?
+	[[ ${ret} -eq ${expected} ]]
+	tend $? "returned: ${ret}"
+}
+
 txf() {
 	tbegin "XFAIL: ${*}"
 	local got=$("${@}" 2>&1)
@@ -63,3 +72,106 @@ teq 1.2.3 ver_rs 3-5 . 1.2.3
 txf ver_cut foo 1.2.3
 txf ver_rs -3 _ a1b2c3d4e5
 txf ver_rs 5-3 _ a1b2c3d4e5
+
+# Tests from Portage's test_vercmp.py
+teqr 0 ver_test 6.0 -gt 5.0
+teqr 0 ver_test 5.0 -gt 5
+teqr 0 ver_test 1.0-r1 -gt 1.0-r0
+teqr 0 ver_test 999999999999999999 -gt 999999999999999998 # 18 digits
+teqr 0 ver_test 1.0.0 -gt 1.0
+teqr 0 ver_test 1.0.0 -gt 1.0b
+teqr 0 ver_test 1b -gt 1
+teqr 0 ver_test 1b_p1 -gt 1_p1
+teqr 0 ver_test 1.1b -gt 1.1
+teqr 0 ver_test 12.2.5 -gt 12.2b
+teqr 0 ver_test 4.0 -lt 5.0
+teqr 0 ver_test 5 -lt 5.0
+teqr 0 ver_test 1.0_pre2 -lt 1.0_p2
+teqr 0 ver_test 1.0_alpha2 -lt 1.0_p2
+teqr 0 ver_test 1.0_alpha1 -lt 1.0_beta1
+teqr 0 ver_test 1.0_beta3 -lt 1.0_rc3
+teqr 0 ver_test 1.001000000000000001 -lt 1.001000000000000002
+teqr 0 ver_test 1.00100000000 -lt 1.001000000000000001
+teqr 0 ver_test 999999999999999998 -lt 999999999999999999
+teqr 0 ver_test 1.01 -lt 1.1
+teqr 0 ver_test 1.0-r0 -lt 1.0-r1
+teqr 0 ver_test 1.0 -lt 1.0-r1
+teqr 0 ver_test 1.0 -lt 1.0.0
+teqr 0 ver_test 1.0b -lt 1.0.0
+teqr 0 ver_test 1_p1 -lt 1b_p1
+teqr 0 ver_test 1 -lt 1b
+teqr 0 ver_test 1.1 -lt 1.1b
+teqr 0 ver_test 12.2b -lt 12.2.5
+teqr 0 ver_test 4.0 -eq 4.0
+teqr 0 ver_test 1.0 -eq 1.0
+teqr 0 ver_test 1.0-r0 -eq 1.0
+teqr 0 ver_test 1.0 -eq 1.0-r0
+teqr 0 ver_test 1.0-r0 -eq 1.0-r0
+teqr 0 ver_test 1.0-r1 -eq 1.0-r1
+teqr 1 ver_test 1 -eq 2
+teqr 1 ver_test 1.0_alpha -eq 1.0_pre
+teqr 1 ver_test 1.0_beta -eq 1.0_alpha
+teqr 1 ver_test 1 -eq 0.0
+teqr 1 ver_test 1.0-r0 -eq 1.0-r1
+teqr 1 ver_test 1.0-r1 -eq 1.0-r0
+teqr 1 ver_test 1.0 -eq 1.0-r1
+teqr 1 ver_test 1.0-r1 -eq 1.0
+teqr 1 ver_test 1.0 -eq 1.0.0
+teqr 1 ver_test 1_p1 -eq 1b_p1
+teqr 1 ver_test 1b -eq 1
+teqr 1 ver_test 1.1b -eq 1.1
+teqr 1 ver_test 12.2b -eq 12.2
+
+# A subset of tests from Paludis
+teqr 0 ver_test 1.0_alpha -gt 1_alpha
+teqr 0 ver_test 1.0_alpha -gt 1
+teqr 0 ver_test 1.0_alpha -lt 1.0
+teqr 0 ver_test 1.2.0.0_alpha7-r4 -gt 1.2_alpha7-r4
+teqr 0 ver_test 0001 -eq 1
+teqr 0 ver_test 01 -eq 001
+teqr 0 ver_test 0001.1 -eq 1.1
+teqr 0 ver_test 01.01 -eq 1.01
+teqr 0 ver_test 1.010 -eq 1.01
+teqr 0 ver_test 1.00 -eq 1.0
+teqr 0 ver_test 1.0100 -eq 1.010
+teqr 0 ver_test 1-r00 -eq 1-r0
+
+# Additional tests
+teqr 0 ver_test 0_rc99 -lt 0
+teqr 0 ver_test 011 -eq 11
+teqr 0 ver_test 019 -eq 19
+teqr 0 ver_test 1.2 -eq 001.2
+teqr 0 ver_test 1.2 -gt 1.02
+teqr 0 ver_test 1.2a -lt 1.2b
+teqr 0 ver_test 1.2_pre1 -gt 1.2_pre1_beta2
+teqr 0 ver_test 1.2_pre1 -lt 1.2_pre1_p2
+teqr 0 ver_test 1.00 -lt 1.0.0
+teqr 0 ver_test 1.010 -eq 1.01
+teqr 0 ver_test 1.01 -lt 1.1
+teqr 0 ver_test 1.2_pre08-r09 -eq 1.2_pre8-r9
+teqr 0 ver_test 0 -lt 576460752303423488 # 2**59
+#teqr 0 ver_test 0 -lt 9223372036854775808 # 2**63 fails, integer rollover
+
+# Bad number or ordering of arguments
+txf ver_test 1
+txf ver_test 1 -lt 2 3
+txf ver_test -lt 1 2
+
+# Bad operators
+txf ver_test 1 "<" 2
+txf ver_test 1 lt 2
+txf ver_test 1 -foo 2
+
+# Malformed versions
+txf ver_test "" -ne 1
+txf ver_test 1. -ne 1
+txf ver_test 1ab -ne 1
+txf ver_test b -ne 1
+txf ver_test 1-r1_pre -ne 1
+txf ver_test 1-pre1 -ne 1
+txf ver_test 1_foo -ne 1
+txf ver_test 1_pre1.1 -ne 1
+txf ver_test 1-r1.0 -ne 1
+txf ver_test cvs.9999 -ne 9999
+
+texit

diff --git a/eclass/tests/eapi7-ver_benchmark.sh b/eclass/tests/eapi7-ver_benchmark.sh
index 1de26444c9b..c4671371336 100755
--- a/eclass/tests/eapi7-ver_benchmark.sh
+++ b/eclass/tests/eapi7-ver_benchmark.sh
@@ -76,6 +76,38 @@ replacing_versionator() {
 	done >/dev/null
 }
 
+comparing() {
+	local x
+	for x in {1..1000}; do
+		ver_test 1b_p1 -le 1_p1
+		ver_test 1.1b -le 1.1
+		ver_test 12.2.5 -le 12.2b
+		ver_test 4.0 -le 5.0
+		ver_test 5 -le 5.0
+		ver_test 1.0_pre2 -le 1.0_p2
+		ver_test 1.0_alpha2 -le 1.0_p2
+		ver_test 1.0_alpha1 -le 1.0_beta1
+		ver_test 1.0_beta3 -le 1.0_rc3
+		ver_test 1.001000000000000001 -le 1.001000000000000002
+	done
+}
+
+comparing_versionator() {
+	local x
+	for x in {1..100}; do
+		version_is_at_least 1b_p1 1_p1
+		version_is_at_least 1.1b 1.1
+		version_is_at_least 12.2.5 12.2b
+		version_is_at_least 4.0 5.0
+		version_is_at_least 5 5.0
+		version_is_at_least 1.0_pre2 1.0_p2
+		version_is_at_least 1.0_alpha2 1.0_p2
+		version_is_at_least 1.0_alpha1 1.0_beta1
+		version_is_at_least 1.0_beta3 1.0_rc3
+		version_is_at_least 1.001000000000000001 1.001000000000000002
+	done
+}
+
 get_times() {
 	local factor=${1}; shift
 	echo "${*}"
@@ -111,3 +143,5 @@ get_times 1 cutting
 get_times 10 cutting_versionator
 get_times 1 replacing
 get_times 10 replacing_versionator
+get_times 1 comparing
+get_times 10 comparing_versionator


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: eclass/, eclass/tests/
@ 2018-08-15  7:31 Michał Górny
  0 siblings, 0 replies; 40+ messages in thread
From: Michał Górny @ 2018-08-15  7:31 UTC (permalink / raw
  To: gentoo-commits

commit:     5f97ce827b9db74b9b5ebf76f868726180d07ebb
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Aug  9 15:11:04 2018 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Aug 15 07:31:00 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5f97ce82

eutils.eclass: Ban path_exists

Closes: https://github.com/gentoo/gentoo/pull/9517

 eclass/eutils.eclass               | 30 ++++--------------------------
 eclass/tests/eutils_path_exists.sh | 35 -----------------------------------
 2 files changed, 4 insertions(+), 61 deletions(-)

diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass
index e5d0ebeebb0..7b6336e2aee 100644
--- a/eclass/eutils.eclass
+++ b/eclass/eutils.eclass
@@ -168,33 +168,11 @@ make_wrapper() {
 	fi
 }
 
-# @FUNCTION: path_exists
-# @USAGE: [-a|-o] <paths>
-# @DESCRIPTION:
-# Check if the specified paths exist.  Works for all types of paths
-# (files/dirs/etc...).  The -a and -o flags control the requirements
-# of the paths.  They correspond to "and" and "or" logic.  So the -a
-# flag means all the paths must exist while the -o flag means at least
-# one of the paths must exist.  The default behavior is "and".  If no
-# paths are specified, then the return value is "false".
 path_exists() {
-	local opt=$1
-	[[ ${opt} == -[ao] ]] && shift || opt="-a"
-
-	# no paths -> return false
-	# same behavior as: [[ -e "" ]]
-	[[ $# -eq 0 ]] && return 1
-
-	local p r=0
-	for p in "$@" ; do
-		[[ -e ${p} ]]
-		: $(( r += $? ))
-	done
-
-	case ${opt} in
-		-a) return $(( r != 0 )) ;;
-		-o) return $(( r == $# )) ;;
-	esac
+	eerror "path_exists has been removed.  Please see the following post"
+	eerror "for a replacement snippet:"
+	eerror "https://blogs.gentoo.org/mgorny/2018/08/09/inlining-path_exists/"
+	die "path_exists is banned"
 }
 
 # @FUNCTION: use_if_iuse

diff --git a/eclass/tests/eutils_path_exists.sh b/eclass/tests/eutils_path_exists.sh
deleted file mode 100755
index 00a89c7e446..00000000000
--- a/eclass/tests/eutils_path_exists.sh
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/bin/bash
-# Copyright 1999-2015 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-source tests-common.sh
-
-inherit eutils
-
-test-path_exists() {
-	local exp=$1; shift
-	tbegin "path_exists($*) == ${exp}"
-	path_exists "$@"
-	[[ ${exp} -eq $? ]]
-	tend $?
-}
-
-test-path_exists 1
-test-path_exists 1 -a
-test-path_exists 1 -o
-
-good="/ . tests-common.sh /bin/bash"
-test-path_exists 0 ${good}
-test-path_exists 0 -a ${good}
-test-path_exists 0 -o ${good}
-
-bad="/asjdkfljasdlfkja jlakjdsflkasjdflkasdjflkasdjflaskdjf"
-test-path_exists 1 ${bad}
-test-path_exists 1 -a ${bad}
-test-path_exists 1 -o ${bad}
-
-test-path_exists 1 ${good} ${bad}
-test-path_exists 1 -a ${good} ${bad}
-test-path_exists 0 -o ${good} ${bad}
-
-texit


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: eclass/, eclass/tests/
@ 2019-06-23  8:53 Sergei Trofimovich
  0 siblings, 0 replies; 40+ messages in thread
From: Sergei Trofimovich @ 2019-06-23  8:53 UTC (permalink / raw
  To: gentoo-commits

commit:     82b182fb344a841fccb2b599fc4ea0d5c4ab254f
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 23 08:45:11 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Jun 23 08:53:42 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=82b182fb

flag-o-matic.eclass: filter out '-B/foo' and '-B /foo' equally

In bug #687198 Julian noticed that strip-unsupported-flags()
filters out '-B' but not '/foo' in CFLAGS='-B /foo' and causes
breakage.

This change still does not allow -B flag but at least filters
out both '-B' and it's parameter.

Reported-by: Julian Cléaud
Bug: https://bugs.gentoo.org/687198
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 eclass/flag-o-matic.eclass   |  3 ++-
 eclass/tests/flag-o-matic.sh | 16 ++++++++++++++++
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/eclass/flag-o-matic.eclass b/eclass/flag-o-matic.eclass
index 933104190ae..3b32bd9d631 100644
--- a/eclass/flag-o-matic.eclass
+++ b/eclass/flag-o-matic.eclass
@@ -496,7 +496,8 @@ test-flags-PROG() {
 
 	while (( $# )); do
 		case "$1" in
-			--param)
+			# '-B /foo': bug # 687198
+			--param|-B)
 				if test-flag-${comp} "$1" "$2"; then
 					flags+=( "$1" "$2" )
 				fi

diff --git a/eclass/tests/flag-o-matic.sh b/eclass/tests/flag-o-matic.sh
index 97cd71d710a..691b052c3d4 100755
--- a/eclass/tests/flag-o-matic.sh
+++ b/eclass/tests/flag-o-matic.sh
@@ -58,6 +58,22 @@ strip-unsupported-flags
 [[ ${CFLAGS} == "--param l1-cache-size=32" ]] && [[ ${CXXFLAGS} == "-z=2" ]] && [[ ${LDFLAGS} == "" ]]
 ftend
 
+CFLAGS="-O2 -B/foo -O1"
+CXXFLAGS="-O2 -B/foo -O1"
+LDFLAGS="-O2 -B/foo -O1"
+tbegin "strip-unsupported-flags for '-B/foo'"
+strip-unsupported-flags
+[[ ${CFLAGS} == "-O2 -O1" ]] && [[ ${CXXFLAGS} == "-O2 -O1" ]] && [[ ${LDFLAGS} == "" ]]
+ftend
+
+CFLAGS="-O2 -B /foo -O1"
+CXXFLAGS="-O2 -B /foo -O1"
+LDFLAGS="-O2 -B /foo -O1"
+tbegin "strip-unsupported-flags for '-B /foo'"
+strip-unsupported-flags
+[[ ${CFLAGS} == "-O2 -O1" ]] && [[ ${CXXFLAGS} == "-O2 -O1" ]] && [[ ${LDFLAGS} == "" ]]
+ftend
+
 for var in $(all-flag-vars) ; do
 	eval ${var}=\"-filter -filter-glob -foo-${var%FLAGS}\"
 done


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: eclass/, eclass/tests/
@ 2019-10-19 21:20 Sergei Trofimovich
  0 siblings, 0 replies; 40+ messages in thread
From: Sergei Trofimovich @ 2019-10-19 21:20 UTC (permalink / raw
  To: gentoo-commits

commit:     7603aa1fbbe1079e2e011548895f27b7ef82ca36
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 19 11:15:39 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Oct 19 21:20:28 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7603aa1f

toolchain.eclass: drop support for 'BRANCH_UPDATE'

BRANCH_UPDATE needs explicit tarball creation. Live ebuilds
or weekly snapshots suit better for tracking upstream development.

Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 eclass/tests/toolchain.sh |  1 -
 eclass/toolchain.eclass   | 24 ------------------------
 2 files changed, 25 deletions(-)

diff --git a/eclass/tests/toolchain.sh b/eclass/tests/toolchain.sh
index ec225356856..2c09f2238d7 100755
--- a/eclass/tests/toolchain.sh
+++ b/eclass/tests/toolchain.sh
@@ -168,7 +168,6 @@ test_var_assert GCC_BRANCH_VER  7.3
 test_var_assert GCCMAJOR        7
 test_var_assert GCCMINOR        3
 test_var_assert GCCMICRO        0
-test_var_assert BRANCH_UPDATE   ''
 test_var_assert GCC_CONFIG_VER  7.3.0
 test_var_assert PREFIX          /usr
 

diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index d26a12a024b..0c0378d9a7e 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -67,8 +67,6 @@ GCC_BRANCH_VER=$(ver_cut 1-2 ${GCC_PV})
 GCCMAJOR=$(ver_cut 1 ${GCC_PV})
 GCCMINOR=$(ver_cut 2 ${GCC_PV})
 GCCMICRO=$(ver_cut 3 ${GCC_PV})
-[[ ${BRANCH_UPDATE-notset} == "notset" ]] && \
-	BRANCH_UPDATE=$(ver_cut 4 ${GCC_PV})
 
 # According to gcc/c-cppbuiltin.c, GCC_CONFIG_VER MUST match this regex.
 # ([^0-9]*-)?[0-9]+[.][0-9]+([.][0-9]+)?([- ].*)?
@@ -282,14 +280,6 @@ gentoo_urls() {
 #			the ebuild has a _pre suffix, this variable is ignored and the
 #			prerelease tarball is used instead.
 #
-#	BRANCH_UPDATE
-#			If set, this variable signals that we should be using the main
-#			release tarball (determined by ebuild version) and applying a
-#			CVS branch update patch against it. The location of this branch
-#			update patch is assumed to be in ${GENTOO_TOOLCHAIN_BASE_URI}.
-#			Just like with SNAPSHOT, this variable is ignored if the ebuild
-#			has a _pre suffix.
-#
 #	PATCH_VER
 #	PATCH_GCC_VER
 #			This should be set to the version of the gentoo patch tarball.
@@ -360,9 +350,6 @@ get_gcc_src_uri() {
 		else
 			GCC_SRC_URI="mirror://gnu/gcc/gcc-${GCC_PV}/gcc-${GCC_RELEASE_VER}.tar.bz2"
 		fi
-		# we want all branch updates to be against the main release
-		[[ -n ${BRANCH_UPDATE} ]] && \
-			GCC_SRC_URI+=" $(gentoo_urls gcc-${GCC_RELEASE_VER}-branch-update-${BRANCH_UPDATE}.patch.bz2)"
 	fi
 
 	[[ -n ${UCLIBC_VER} ]] && \
@@ -472,12 +459,6 @@ gcc_quick_unpack() {
 		else
 			unpack gcc-${GCC_RELEASE_VER}.tar.bz2
 		fi
-		# We want branch updates to be against a release tarball
-		if [[ -n ${BRANCH_UPDATE} ]] ; then
-			pushd "${S}" > /dev/null
-			epatch "${DISTDIR}"/gcc-${GCC_RELEASE_VER}-branch-update-${BRANCH_UPDATE}.patch.bz2
-			popd > /dev/null
-		fi
 	fi
 
 	if [[ -n ${D_VER} ]] && use d ; then
@@ -826,7 +807,6 @@ gcc_version_patch() {
 	tc_version_is_at_least 4.3 && return 0
 
 	local version_string=${GCC_CONFIG_VER}
-	[[ -n ${BRANCH_UPDATE} ]] && version_string+=" ${BRANCH_UPDATE}"
 
 	einfo "patching gcc version: ${version_string} (${BRANDING_GCC_PKGVERSION})"
 
@@ -2290,10 +2270,6 @@ toolchain_pkg_postrm() {
 	if [[ ! -e ${LIBPATH}/libstdc++.so ]] ; then
 		einfo "Running 'fix_libtool_files.sh ${GCC_RELEASE_VER}'"
 		fix_libtool_files.sh ${GCC_RELEASE_VER}
-		if [[ -n ${BRANCH_UPDATE} ]] ; then
-			einfo "Running 'fix_libtool_files.sh ${GCC_RELEASE_VER}-${BRANCH_UPDATE}'"
-			fix_libtool_files.sh ${GCC_RELEASE_VER}-${BRANCH_UPDATE}
-		fi
 	fi
 
 	return 0


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: eclass/, eclass/tests/
@ 2019-12-30 12:59 Michał Górny
  0 siblings, 0 replies; 40+ messages in thread
From: Michał Górny @ 2019-12-30 12:59 UTC (permalink / raw
  To: gentoo-commits

commit:     8f8b4aff201b3ba77d7cbd26fad8e1797b5e3126
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 30 12:32:33 2019 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Dec 30 12:58:58 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8f8b4aff

python-utils-r1.eclass: Eliminate virtual/pypy

Depend on dev-python/pypy directly, as that's the common package
with the new layout.

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 eclass/python-utils-r1.eclass   | 4 ++--
 eclass/tests/python-utils-r1.sh | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 301c9a029b5..91a32434dfa 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -472,9 +472,9 @@ python_export() {
 					python*)
 						PYTHON_PKG_DEP="dev-lang/python:${impl#python}";;
 					pypy)
-						PYTHON_PKG_DEP='>=virtual/pypy-5:0=';;
+						PYTHON_PKG_DEP='>=dev-python/pypy-5:0=';;
 					pypy3)
-						PYTHON_PKG_DEP='>=virtual/pypy3-5:0=';;
+						PYTHON_PKG_DEP='>=dev-python/pypy3-5:0=';;
 					jython2.7)
 						PYTHON_PKG_DEP='dev-java/jython:2.7';;
 					*)

diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh
index 4910b700308..279324e163b 100755
--- a/eclass/tests/python-utils-r1.sh
+++ b/eclass/tests/python-utils-r1.sh
@@ -109,7 +109,7 @@ if [[ -x /usr/bin/pypy ]]; then
 	test_var PYTHON_SITEDIR pypy "/usr/lib*/pypy2.7/site-packages"
 	test_var PYTHON_INCLUDEDIR pypy "/usr/lib*/pypy2.7/include"
 fi
-test_var PYTHON_PKG_DEP pypy '*virtual/pypy*:0='
+test_var PYTHON_PKG_DEP pypy '*dev-python/pypy*:0='
 test_var PYTHON_SCRIPTDIR pypy /usr/lib/python-exec/pypy
 
 test_var EPYTHON pypy3 pypy3
@@ -118,7 +118,7 @@ if [[ -x /usr/bin/pypy3 ]]; then
 	test_var PYTHON_SITEDIR pypy3 "/usr/lib*/pypy3.?/site-packages"
 	test_var PYTHON_INCLUDEDIR pypy3 "/usr/lib*/pypy3.?/include"
 fi
-test_var PYTHON_PKG_DEP pypy3 '*virtual/pypy3*:0='
+test_var PYTHON_PKG_DEP pypy3 '*dev-python/pypy3*:0='
 test_var PYTHON_SCRIPTDIR pypy3 /usr/lib/python-exec/pypy3
 
 test_is "python_is_python3 python2.7" 1


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: eclass/, eclass/tests/
@ 2019-12-30 12:59 Michał Górny
  0 siblings, 0 replies; 40+ messages in thread
From: Michał Górny @ 2019-12-30 12:59 UTC (permalink / raw
  To: gentoo-commits

commit:     b1b38d9aca3eb434c6a70bca37f4d41b847c3016
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 30 12:24:55 2019 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Dec 30 12:58:52 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b1b38d9a

python-utils-r1.eclass: Remove PYTHON_TARGETS="jython2_7"

Jython was supported as an experimental implementation but due to
interoperability issues and very slow development, its (re-)deployment
in ebuilds never took off.  Now that Python 2.7 is going away, there's
no point in keeping its future support.

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 eclass/python-utils-r1.eclass   | 5 ++---
 eclass/tests/python-utils-r1.sh | 2 +-
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 09b501a4ad2..301c9a029b5 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -39,7 +39,6 @@ inherit toolchain-funcs
 # @DESCRIPTION:
 # All supported Python implementations, most preferred last.
 _PYTHON_ALL_IMPLS=(
-	jython2_7
 	pypy3
 	python2_7
 	python3_6 python3_7 python3_8
@@ -78,10 +77,10 @@ _python_impl_supported() {
 	# keep in sync with _PYTHON_ALL_IMPLS!
 	# (not using that list because inline patterns shall be faster)
 	case "${impl}" in
-		python2_7|python3_[678]|jython2_7|pypy3)
+		python2_7|python3_[678]|pypy3)
 			return 0
 			;;
-		pypy|pypy1_[89]|pypy2_0|python2_[56]|python3_[12345])
+		jython2_7|pypy|pypy1_[89]|pypy2_0|python2_[56]|python3_[12345])
 			return 1
 			;;
 		*)

diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh
index f8d4858da7c..4910b700308 100755
--- a/eclass/tests/python-utils-r1.sh
+++ b/eclass/tests/python-utils-r1.sh
@@ -190,7 +190,7 @@ test_is "_python_impl_supported pypy1_9" 1
 test_is "_python_impl_supported pypy2_0" 1
 test_is "_python_impl_supported pypy" 1
 test_is "_python_impl_supported pypy3" 0
-test_is "_python_impl_supported jython2_7" 0
+test_is "_python_impl_supported jython2_7" 1
 
 # check _python_impl_matches behavior
 test_is "_python_impl_matches python2_7 -2" 0


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: eclass/, eclass/tests/
@ 2020-01-26 22:47 Sergei Trofimovich
  0 siblings, 0 replies; 40+ messages in thread
From: Sergei Trofimovich @ 2020-01-26 22:47 UTC (permalink / raw
  To: gentoo-commits

commit:     a2478718a9960f7844eee45e6b140fd071447428
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 26 22:42:49 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Jan 26 22:47:07 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a2478718

flag-o-matic.eclass: fix probe when CC points to absolute path

Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 eclass/flag-o-matic.eclass   | 4 ++--
 eclass/tests/flag-o-matic.sh | 6 ++++++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/eclass/flag-o-matic.eclass b/eclass/flag-o-matic.eclass
index 0aec22c83f2..ebfc49bf30b 100644
--- a/eclass/flag-o-matic.eclass
+++ b/eclass/flag-o-matic.eclass
@@ -474,8 +474,8 @@ test-flag-PROG() {
 			cmdline_extra+=(-xc)
 			;;
 	esac
-	local test_in=${T}/test-flag-${comp}.${lang}
-	local test_out=${T}/test-flag-${comp}.exe
+	local test_in=${T}/test-flag.${lang}
+	local test_out=${T}/test-flag.exe
 
 	printf "%s\n" "${in_src}" > "${test_in}" || return 1
 

diff --git a/eclass/tests/flag-o-matic.sh b/eclass/tests/flag-o-matic.sh
index 90eaf3a6ffb..229dff52af9 100755
--- a/eclass/tests/flag-o-matic.sh
+++ b/eclass/tests/flag-o-matic.sh
@@ -139,6 +139,12 @@ out=$(test-flags-CC -O3)
 [[ $? -eq 0 && ${out} == "-O3" ]]
 ftend
 
+tbegin "test-flags-CC (valid flags, absolute path)"
+absolute_CC=$(type -P $(tc-getCC))
+out=$(CC=${absolute_CC} test-flags-CC -O3)
+[[ $? -eq 0 && ${out} == "-O3" ]]
+ftend
+
 tbegin "test-flags-CC (invalid flags)"
 out=$(test-flags-CC -finvalid-flag)
 [[ $? -ne 0 && -z ${out} ]]


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: eclass/, eclass/tests/
@ 2020-03-20 22:33 Sergei Trofimovich
  0 siblings, 0 replies; 40+ messages in thread
From: Sergei Trofimovich @ 2020-03-20 22:33 UTC (permalink / raw
  To: gentoo-commits

commit:     ab8fe14ae2e9110faa85ca1c4528b470c0be1535
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 20 22:28:19 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Fri Mar 20 22:33:36 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ab8fe14a

flag-o-matic.eclass: don't use -Werror in test-flag-PROG(), bug #712488

-Werror filters out too much (everything) if used compiler happens
to always generate warnings. Let's drop cosmetic stripping of
ignored flags until we really need it. Then we can consider more
selective filtering by using more targeted -Werror= options.

Reported-by: Anton Gubarkov
Closes: https://bugs.gentoo.org/712488
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 eclass/flag-o-matic.eclass   | 19 ++++++++-----------
 eclass/tests/flag-o-matic.sh | 10 ++++++----
 2 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/eclass/flag-o-matic.eclass b/eclass/flag-o-matic.eclass
index 9ef9ac3685e..d8111fb9e38 100644
--- a/eclass/flag-o-matic.eclass
+++ b/eclass/flag-o-matic.eclass
@@ -487,11 +487,15 @@ test-flag-PROG() {
 
 	printf "%s\n" "${in_src}" > "${test_in}" || die "Failed to create '${test_in}'"
 
+	# Don't set -Werror as there are cases when benign
+	# always-on warnings filter out all flags like bug #712488.
+	# We'll have to live with potential '-Wunused-command-line-argument'.
+	# flags.
+	#
+	# We can add more selective detection of no-op flags via
+	# '-Werror=ignored-optimization-argument' and similar error options.
 	local cmdline=(
 		"${comp[@]}"
-		# Clang will warn about unknown gcc flags but exit 0.
-		# Need -Werror to force it to exit non-zero.
-		-Werror
 		"$@"
 		# -x<lang> options need to go before first source file
 		"${cmdline_extra[@]}"
@@ -499,14 +503,7 @@ test-flag-PROG() {
 		"${test_in}" -o "${test_out}"
 	)
 
-	if ! "${cmdline[@]}" &>/dev/null; then
-		# -Werror makes clang bail out on unused arguments as well;
-		# try to add -Qunused-arguments to work-around that
-		# other compilers don't support it but then, it's failure like
-		# any other
-		cmdline+=( -Qunused-arguments )
-		"${cmdline[@]}" &>/dev/null
-	fi
+	"${cmdline[@]}" &>/dev/null
 }
 
 # @FUNCTION: test-flag-CC

diff --git a/eclass/tests/flag-o-matic.sh b/eclass/tests/flag-o-matic.sh
index 229dff52af9..6dfacb04c07 100755
--- a/eclass/tests/flag-o-matic.sh
+++ b/eclass/tests/flag-o-matic.sh
@@ -161,10 +161,12 @@ out=$(CC=clang test-flags-CC -finvalid-flag)
 [[ $? -ne 0 && -z ${out} ]]
 ftend
 
-tbegin "test-flags-CC (gcc-valid but clang-invalid flags)"
-out=$(CC=clang test-flags-CC -finline-limit=1200)
-[[ $? -ne 0 && -z ${out} ]]
-ftend
+### '-finline-limit=1200' is 'ignored' flag, not invalid.
+### We don't filter out ignored flags currently, bug #712488
+#tbegin "test-flags-CC (gcc-valid but clang-invalid flags)"
+#out=$(CC=clang test-flags-CC -finline-limit=1200)
+#[[ $? -ne 0 && -z ${out} ]]
+#ftend
 
 tbegin "test-flags-CC (unused flags w/clang)"
 out=$(CC=clang test-flags-CC -Wl,-O1)


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: eclass/, eclass/tests/
@ 2020-03-27 23:54 Sergei Trofimovich
  0 siblings, 0 replies; 40+ messages in thread
From: Sergei Trofimovich @ 2020-03-27 23:54 UTC (permalink / raw
  To: gentoo-commits

commit:     26578a15abfca9149f296c33b754fa195e0ccf9b
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 27 23:47:15 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Fri Mar 27 23:54:41 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=26578a15

multilib.eclass: multilib_env(): set LIBDIR=lib for *-musl*

In contrast to glibc musl profiles use 'lib' layour for 32-bit
and 64-bit targets. multilib_env() did not take it into account
and assumed glibc's lib64 layout.

That breaks crossdev as it uses multilib_env to extract target
definition. Native builds are unaffected by this change.

Bug: https://bugs.gentoo.org/675954
Bug: https://gcc.gnu.org/PR90077
Bug: https://github.com/gentoo/musl/issues/245
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 eclass/multilib.eclass   | 13 ++++++++++++-
 eclass/tests/multilib.sh |  4 ++++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/eclass/multilib.eclass b/eclass/multilib.eclass
index 63bde5cbb60..8b4a7dacaa3 100644
--- a/eclass/multilib.eclass
+++ b/eclass/multilib.eclass
@@ -294,11 +294,22 @@ get_modname() {
 }
 
 # This is for the toolchain to setup profile variables when pulling in
-# a crosscompiler (and thus they aren't set in the profile)
+# a crosscompiler (and thus they aren't set in the profile).
 multilib_env() {
 	local CTARGET=${1:-${CTARGET}}
 	local cpu=${CTARGET%%*-}
 
+	if [[ ${CTARGET} = *-musl* ]]; then
+		# musl has no multilib support and can run only in 'lib':
+		# - https://bugs.gentoo.org/675954
+		# - https://gcc.gnu.org/PR90077
+		# - https://github.com/gentoo/musl/issues/245
+		: ${MULTILIB_ABIS=default}
+		: ${DEFAULT_ABI=default}
+		export MULTILIB_ABIS DEFAULT_ABI
+		return
+	fi
+
 	case ${cpu} in
 		aarch64*)
 			# Not possible to do multilib with aarch64 and a single toolchain.

diff --git a/eclass/tests/multilib.sh b/eclass/tests/multilib.sh
index 308c456b98d..68c0dd6e142 100755
--- a/eclass/tests/multilib.sh
+++ b/eclass/tests/multilib.sh
@@ -57,5 +57,9 @@ test-multilib_env \
 	"x86_64-pc-linux-gnux32" \
 	"x32:x32 amd64 x86" \
 	"x32? ( CHOST=x86_64-pc-linux-gnux32 LIBDIR=libx32 CFLAGS=-mx32 LDFLAGS= ) amd64? ( CHOST=x86_64-pc-linux-gnu LIBDIR=lib64 CFLAGS=-m64 LDFLAGS= ) x86? ( CHOST=i686-pc-linux-gnu LIBDIR=lib CFLAGS=-m32 LDFLAGS= )"
+test-multilib_env \
+	"x86_64-gentoo-linux-musl" \
+	"default:default" \
+	"default? ( CHOST=x86_64-gentoo-linux-musl LIBDIR=lib CFLAGS= LDFLAGS= )"
 
 texit


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: eclass/, eclass/tests/
@ 2020-05-28 11:41 Michał Górny
  0 siblings, 0 replies; 40+ messages in thread
From: Michał Górny @ 2020-05-28 11:41 UTC (permalink / raw
  To: gentoo-commits

commit:     f1e8874cc2de2055c3a07f7faf0c78d723106d06
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue May 26 07:41:40 2020 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu May 28 11:41:22 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f1e8874c

llvm.eclass: Fix prepending LLVM path before system paths

Do not prepend LLVM path before system path, in particular before
ccache/distcc paths.  Instead, prepend it before the first LLVM version
found in PATH, or append to the end if no LLVM is found in PATH.

Closes: https://bugs.gentoo.org/627726
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 eclass/llvm.eclass   | 25 +++++++++++++++++++++++--
 eclass/tests/llvm.sh | 16 ++++++++--------
 2 files changed, 31 insertions(+), 10 deletions(-)

diff --git a/eclass/llvm.eclass b/eclass/llvm.eclass
index 4f968dc39f8..61b34d4985e 100644
--- a/eclass/llvm.eclass
+++ b/eclass/llvm.eclass
@@ -198,8 +198,29 @@ llvm_pkg_setup() {
 	debug-print-function ${FUNCNAME} "${@}"
 
 	if [[ ${MERGE_TYPE} != binary ]]; then
-		local llvm_prefix=$(get_llvm_prefix "${LLVM_MAX_SLOT}")
-		export PATH=${llvm_prefix}/bin:${PATH}
+		local llvm_path=$(get_llvm_prefix "${LLVM_MAX_SLOT}")/bin
+		local IFS=:
+		local split_path=( ${PATH} )
+		local new_path=()
+		local x added=
+
+		# prepend new path before first LLVM version found
+		for x in "${split_path[@]}"; do
+			if [[ ${x} == */usr/lib/llvm/*/bin ]]; then
+				if [[ ${x} != ${llvm_path} ]]; then
+					new_path+=( "${llvm_path}" )
+				elif [[ ${added} && ${x} == ${llvm_path} ]]; then
+					# deduplicate
+					continue
+				fi
+				added=1
+			fi
+			new_path+=( "${x}" )
+		done
+		# ...or to the end of PATH
+		[[ ${added} ]] || new_path+=( "${llvm_path}" )
+
+		export PATH=${new_path[*]}
 	fi
 }
 

diff --git a/eclass/tests/llvm.sh b/eclass/tests/llvm.sh
index bb8d5fc998e..8527d81765d 100755
--- a/eclass/tests/llvm.sh
+++ b/eclass/tests/llvm.sh
@@ -91,17 +91,17 @@ eindent
 	LLVM_MAX_SLOT=11 \
 	LLVM_INSTALLED_SLOT=1* \
 	PATH=${BASEPATH}:/usr/lib/llvm/11/bin \
-	check_setup_path "/usr/lib/llvm/11/bin:${BASEPATH}:/usr/lib/llvm/11/bin"
+	check_setup_path "${BASEPATH}:/usr/lib/llvm/11/bin"
 
 	LLVM_MAX_SLOT=10 \
 	LLVM_INSTALLED_SLOT=1* \
 	PATH=${BASEPATH}:/usr/lib/llvm/11/bin:/usr/lib/llvm/10/bin \
-	check_setup_path "/usr/lib/llvm/10/bin:${BASEPATH}:/usr/lib/llvm/11/bin:/usr/lib/llvm/10/bin"
+	check_setup_path "${BASEPATH}:/usr/lib/llvm/10/bin:/usr/lib/llvm/11/bin"
 
 	LLVM_MAX_SLOT=11 \
 	LLVM_INSTALLED_SLOT=10 \
 	PATH=${BASEPATH}:/usr/lib/llvm/10/bin \
-	check_setup_path "/usr/lib/llvm/10/bin:${BASEPATH}:/usr/lib/llvm/10/bin"
+	check_setup_path "${BASEPATH}:/usr/lib/llvm/10/bin"
 eoutdent
 
 ebegin "Testing pkg_setup with the other LLVM version in PATH"
@@ -109,12 +109,12 @@ eindent
 	LLVM_MAX_SLOT=11 \
 	LLVM_INSTALLED_SLOT=1* \
 	PATH=${BASEPATH}:/usr/lib/llvm/10/bin \
-	check_setup_path "/usr/lib/llvm/11/bin:${BASEPATH}:/usr/lib/llvm/10/bin"
+	check_setup_path "${BASEPATH}:/usr/lib/llvm/11/bin:/usr/lib/llvm/10/bin"
 
 	LLVM_MAX_SLOT=10 \
 	LLVM_INSTALLED_SLOT=1* \
 	PATH=${BASEPATH}:/usr/lib/llvm/11/bin \
-	check_setup_path "/usr/lib/llvm/10/bin:${BASEPATH}:/usr/lib/llvm/11/bin"
+	check_setup_path "${BASEPATH}:/usr/lib/llvm/10/bin:/usr/lib/llvm/11/bin"
 eoutdent
 
 ebegin "Testing pkg_setup with LLVM missing from PATH"
@@ -122,17 +122,17 @@ eindent
 	LLVM_MAX_SLOT=11 \
 	LLVM_INSTALLED_SLOT=1* \
 	PATH=${BASEPATH} \
-	check_setup_path "/usr/lib/llvm/11/bin:${BASEPATH}"
+	check_setup_path "${BASEPATH}:/usr/lib/llvm/11/bin"
 
 	LLVM_MAX_SLOT=10 \
 	LLVM_INSTALLED_SLOT=1* \
 	PATH=${BASEPATH} \
-	check_setup_path "/usr/lib/llvm/10/bin:${BASEPATH}"
+	check_setup_path "${BASEPATH}:/usr/lib/llvm/10/bin"
 
 	LLVM_MAX_SLOT=11 \
 	LLVM_INSTALLED_SLOT=10 \
 	PATH=${BASEPATH} \
-	check_setup_path "/usr/lib/llvm/10/bin:${BASEPATH}"
+	check_setup_path "${BASEPATH}:/usr/lib/llvm/10/bin"
 eoutdent
 
 texit


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: eclass/, eclass/tests/
@ 2021-06-01 17:27 Sergei Trofimovich
  0 siblings, 0 replies; 40+ messages in thread
From: Sergei Trofimovich @ 2021-06-01 17:27 UTC (permalink / raw
  To: gentoo-commits

commit:     609743f9fff7194ca58fec4ad967bdd9ef093f75
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  1 17:13:57 2021 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Tue Jun  1 17:27:39 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=609743f9

toolchain.eclass: add -march=znver3 mangling

Noticed as a gcc-9 build failure as it does not support -march=znver3.

Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 eclass/tests/toolchain.sh | 1 +
 eclass/toolchain.eclass   | 1 +
 2 files changed, 2 insertions(+)

diff --git a/eclass/tests/toolchain.sh b/eclass/tests/toolchain.sh
index 118d68c63df..8e070cad4b9 100755
--- a/eclass/tests/toolchain.sh
+++ b/eclass/tests/toolchain.sh
@@ -86,6 +86,7 @@ test_downgrade_arch_flags 10  "-march=native"     "-march=native"
 test_downgrade_arch_flags 8   "-march=znver1"     "-march=znver2"
 test_downgrade_arch_flags 4.2 "-march=native"     "-march=native"
 test_downgrade_arch_flags 4.1 "-march=nocona"     "-march=native"
+test_downgrade_arch_flags 9   "-march=znver2"     "-march=znver3"
 
 test_downgrade_arch_flags 10  "-march=foo -mno-sha -mno-rtm -mno-avx2 -mno-avx -mno-sse4.1" "-march=foo -mno-sha -mno-rtm -mno-avx2 -mno-avx -mno-sse4.1"
 test_downgrade_arch_flags 4.9 "-march=foo -mno-sha -mno-rtm -mno-avx2 -mno-avx -mno-sse4.1" "-march=foo -mno-sha -mno-rtm -mno-avx2 -mno-avx -mno-sse4.1"

diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index f41ce22c591..3c495631a0e 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -1300,6 +1300,7 @@ downgrade_arch_flags() {
 
 	# "added" "arch" "replacement"
 	local archlist=(
+		10 znver3 znver2
 		9 znver2 znver1
 		4.9 bdver4 bdver3
 		4.9 bonnell atom


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: eclass/, eclass/tests/
@ 2021-08-17  1:41 Sam James
  0 siblings, 0 replies; 40+ messages in thread
From: Sam James @ 2021-08-17  1:41 UTC (permalink / raw
  To: gentoo-commits

commit:     6d0a5587e8f7d51544824fb7eb806ba5c4dcb4e7
Author:     Rolf Eike Beer <eike <AT> sf-mail <DOT> de>
AuthorDate: Thu Jun 17 14:39:07 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Aug 17 01:41:17 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6d0a5587

qmail.eclass: simplify is_prime()

The previous algorithm would scan for all primes for a given number, which
takes needlessly long.

Signed-off-by: Rolf Eike Beer <eike <AT> sf-mail.de>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 eclass/qmail.eclass   | 51 ++++++++++++++++++--------------------------------
 eclass/tests/qmail.sh | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 70 insertions(+), 33 deletions(-)

diff --git a/eclass/qmail.eclass b/eclass/qmail.eclass
index 8d05578dc3d..3cd8497363b 100644
--- a/eclass/qmail.eclass
+++ b/eclass/qmail.eclass
@@ -29,46 +29,31 @@ GENQMAIL_S="${WORKDIR}"/genqmail-${GENQMAIL_PV}
 QMAIL_SPP_F=qmail-spp-${QMAIL_SPP_PV}.tar.gz
 QMAIL_SPP_S="${WORKDIR}"/qmail-spp-${QMAIL_SPP_PV}
 
-# @FUNCTION: primes
-# @USAGE: <min> <max>
+# @FUNCTION: is_prime
+# @USAGE: <number>
 # @DESCRIPTION:
-# Prints a list of primes between min and max inclusive
-# Note: this functions gets very slow when used with large numbers.
-primes() {
-	local min=${1} max=${2}
-	local result= primelist=2 i p
+# Checks wether a number is a valid prime number for queue split
+is_prime() {
+	local number=${1} i
+
+	if [[ ${number} -lt 7 ]]; then
+		# too small
+		return 1
+	fi
 
-	[[ ${min} -le 2 ]] && result="${result} 2"
+	if [[ $[number % 2] == 0 ]]; then
+		return 1
+	fi
 
-	for ((i = 3; i <= max; i += 2))
+	# let i run up to the square root of number
+	for ((i = 3; i * i <= number; i += 2))
 	do
-		for p in ${primelist}
-		do
-			[[ $[i % p] == 0 || $[p * p] -gt ${i} ]] && \
-				break
-		done
-		if [[ $[i % p] != 0 ]]
-		then
-			primelist="${primelist} ${i}"
-			[[ ${i} -ge ${min} ]] && \
-				result="${result} ${i}"
+		if [[ $[number % i ] == 0 ]]; then
+			return 1
 		fi
 	done
 
-	echo ${result}
-}
-
-# @FUNCTION: is_prima
-# @USAGE: <number>
-# @DESCRIPTION:
-# Checks wether a number is a prime number
-is_prime() {
-	local number=${1} i
-	for i in $(primes ${number} ${number})
-	do
-		[[ ${i} == ${number} ]] && return 0
-	done
-	return 1
+	return 0
 }
 
 dospp() {

diff --git a/eclass/tests/qmail.sh b/eclass/tests/qmail.sh
new file mode 100755
index 00000000000..3520ed2a9d5
--- /dev/null
+++ b/eclass/tests/qmail.sh
@@ -0,0 +1,52 @@
+#!/bin/bash
+# Copyright 2020-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+source tests-common.sh
+
+inherit qmail
+
+# some numbers are blocked because they are to small even if prime
+test_low_numbers() {
+	tbegin "low numbers"
+
+	for i in $(seq 0 6); do
+		if is_prime ${i}; then
+			return tend 1 "${i} badly accepted"
+		fi
+	done
+
+	tend 0
+}
+
+# test a given number for being prime
+check_prime_number() {
+	# use factor from coreutils to count the factors
+	if [[ $(factor $1 | cut -d: -f2 | wc -w) == 1 ]]; then
+		return $(is_prime $1)
+	else
+		return $(is_prime $1 && false || true)
+	fi
+}
+
+test_primes() {
+	tbegin "factorizations from ${1} to ${2}"
+
+	for i in $(seq ${1:?} ${2:?}); do
+		if ! check_prime_number $i; then
+			tend 1 "${i} returned bad factorization"
+			return 1
+		fi
+	done
+
+	tend 0
+}
+
+test_low_numbers
+test_primes 7 99
+for i in $(seq 100 100 1000); do
+	test_primes $i $((i + 99))
+done
+
+texit


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: eclass/, eclass/tests/
@ 2022-01-09  8:09 Michał Górny
  0 siblings, 0 replies; 40+ messages in thread
From: Michał Górny @ 2022-01-09  8:09 UTC (permalink / raw
  To: gentoo-commits

commit:     348d59c6d8fc23042077364580d399337be6e5fb
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 31 09:16:25 2021 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Jan  9 08:09:07 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=348d59c6

python*-r1.eclass: Remove explicit dep on python-exec

The dev-lang/python-exec dependency is now enforced through
dev-lang/python, remove the explicit dep to reduce the metadata size
and make dependency resolution lighter.

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 eclass/python-r1.eclass             | 9 +--------
 eclass/python-single-r1.eclass      | 8 +-------
 eclass/tests/distutils-r1.sh        | 2 +-
 eclass/tests/distutils-r1_single.sh | 2 +-
 4 files changed, 4 insertions(+), 17 deletions(-)

diff --git a/eclass/python-r1.eclass b/eclass/python-r1.eclass
index dc624946cfc1..4b51cc18b959 100644
--- a/eclass/python-r1.eclass
+++ b/eclass/python-r1.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
 
 # @ECLASS: python-r1.eclass
@@ -125,7 +125,6 @@ fi
 #
 # Example value:
 # @CODE
-# dev-lang/python-exec:=
 # python_targets_python2_7? ( dev-lang/python:2.7[gdbm] )
 # python_targets_pypy? ( dev-python/pypy[gdbm] )
 # @CODE
@@ -207,12 +206,6 @@ _python_set_globals() {
 	local requse="|| ( ${flags[*]} )"
 	local usedep=${optflags// /,}
 
-	# 1) well, python-exec would suffice as an RDEP
-	# but no point in making this overcomplex, BDEP doesn't hurt anyone
-	# 2) python-exec should be built with all targets forced anyway
-	# but if new targets were added, we may need to force a rebuild
-	deps+=">=dev-lang/python-exec-2:=[${usedep}]"
-
 	if [[ ${PYTHON_DEPS+1} ]]; then
 		# IUSE is magical, so we can't really check it
 		# (but we verify PYTHON_COMPAT already)

diff --git a/eclass/python-single-r1.eclass b/eclass/python-single-r1.eclass
index 228c66a77af6..5a4bcea55da4 100644
--- a/eclass/python-single-r1.eclass
+++ b/eclass/python-single-r1.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
 
 # @ECLASS: python-single-r1.eclass
@@ -136,7 +136,6 @@ EXPORT_FUNCTIONS pkg_setup
 #
 # Example value:
 # @CODE
-# dev-lang/python-exec:=
 # python_single_target_python2_7? ( dev-lang/python:2.7[gdbm] )
 # python_single_target_pypy? ( dev-python/pypy[gdbm] )
 # @CODE
@@ -219,13 +218,8 @@ _python_single_set_globals() {
 	local deps= i PYTHON_PKG_DEP
 	for i in "${_PYTHON_SUPPORTED_IMPLS[@]}"; do
 		_python_export "${i}" PYTHON_PKG_DEP
-		# 1) well, python-exec would suffice as an RDEP
-		# but no point in making this overcomplex, BDEP doesn't hurt anyone
-		# 2) python-exec should be built with all targets forced anyway
-		# but if new targets were added, we may need to force a rebuild
 		deps+="python_single_target_${i}? (
 			${PYTHON_PKG_DEP}
-			>=dev-lang/python-exec-2:=[python_targets_${i}]
 		) "
 	done
 

diff --git a/eclass/tests/distutils-r1.sh b/eclass/tests/distutils-r1.sh
index a582bd9bbee7..cd768066bf37 100755
--- a/eclass/tests/distutils-r1.sh
+++ b/eclass/tests/distutils-r1.sh
@@ -97,7 +97,7 @@ tend
 einfo distutils_enable_tests
 eindent
 BASE_IUSE="python_targets_python3_8"
-BASE_DEPS="python_targets_python3_8? ( >=dev-lang/python-3.8.12_p1-r1:3.8 ) >=dev-lang/python-exec-2:=[python_targets_python3_8(-)?]"
+BASE_DEPS="python_targets_python3_8? ( >=dev-lang/python-3.8.12_p1-r1:3.8 )"
 TEST_RESTRICT="!test? ( test )"
 
 einfo "empty RDEPEND"

diff --git a/eclass/tests/distutils-r1_single.sh b/eclass/tests/distutils-r1_single.sh
index 8d07eebb133f..fdeba2e2b9b2 100755
--- a/eclass/tests/distutils-r1_single.sh
+++ b/eclass/tests/distutils-r1_single.sh
@@ -77,7 +77,7 @@ inherit distutils-r1
 einfo distutils_enable_tests
 eindent
 BASE_IUSE="+python_single_target_python3_8"
-BASE_DEPS="python_single_target_python3_8? ( >=dev-lang/python-3.8.12_p1-r1:3.8 >=dev-lang/python-exec-2:=[python_targets_python3_8] )"
+BASE_DEPS="python_single_target_python3_8? ( >=dev-lang/python-3.8.12_p1-r1:3.8 )"
 TEST_RESTRICT="!test? ( test )"
 
 einfo "empty RDEPEND"


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: eclass/, eclass/tests/
@ 2022-04-02 16:29 Michał Górny
  0 siblings, 0 replies; 40+ messages in thread
From: Michał Górny @ 2022-04-02 16:29 UTC (permalink / raw
  To: gentoo-commits

commit:     85820b0b54f298e1d96a4bc3ed9cd4952a46aea0
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 31 21:09:30 2022 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Apr  2 16:29:46 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=85820b0b

python-utils-r1.eclass: Make python_fix_shebang force full path

Change the behavior of python_fix_shebang to always output full path
to the Python interpreter (i.e. ${PYTHON}) instead of mangling
the original path.  Most importantly, this ensures that:

1. EPREFIX is included in the final path

2. /usr/bin/env is replaced by the absolute path to avoid issues
   when calling system executables from inside a venv

Note that this implies that a few unlikely corner cases may stop
working, notably:

a. "weird" shebangs such as "/usr/bin/foo python" will no longer work

b. the mangled scripts will escape temporary venv e.g. created
   in distutils-r1 PEP517 mode (python_fix_shebang is not used in such
   a way in ::gentoo)

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 eclass/python-utils-r1.eclass   | 134 +++++++++++++++-------------------------
 eclass/tests/python-utils-r1.sh |  86 ++++++++++++++++----------
 2 files changed, 106 insertions(+), 114 deletions(-)

diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 7b0c9aa280d8..98cb49c95fd7 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -1001,25 +1001,30 @@ _python_wrapper_setup() {
 # @FUNCTION: python_fix_shebang
 # @USAGE: [-f|--force] [-q|--quiet] <path>...
 # @DESCRIPTION:
-# Replace the shebang in Python scripts with the current Python
-# implementation (EPYTHON). If a directory is passed, works recursively
-# on all Python scripts.
+# Replace the shebang in Python scripts with the full path
+# to the current Python implementation (PYTHON, including EPREFIX).
+# If a directory is passed, works recursively on all Python scripts
+# found inside the directory tree.
 #
-# Only files having a 'python*' shebang will be modified. Files with
-# other shebang will either be skipped when working recursively
-# on a directory or treated as error when specified explicitly.
+# Only files having a Python shebang (a path to any known Python
+# interpreter, optionally preceded by env(1) invocation) will
+# be processed.  Files with any other shebang will either be skipped
+# silently when a directory was passed, or an error will be reported
+# for any files without Python shebangs specified explicitly.
 #
-# Shebangs matching explicitly current Python version will be left
-# unmodified. Shebangs requesting another Python version will be treated
-# as fatal error, unless --force is given.
+# Shebangs that are compatible with the current Python version will be
+# mangled unconditionally.  Incompatible shebangs will cause a fatal
+# error, unless --force is specified.
 #
-# --force causes the function to replace even shebangs that require
-# incompatible Python version. --quiet causes the function not to list
-# modified files verbosely.
+# --force causes the function to replace shebangs with incompatible
+# Python version (but not non-Python shebangs).  --quiet causes
+# the function not to list modified files verbosely.
 python_fix_shebang() {
 	debug-print-function ${FUNCNAME} "${@}"
 
 	[[ ${EPYTHON} ]] || die "${FUNCNAME}: EPYTHON unset (pkg_setup not called?)"
+	local PYTHON
+	_python_export "${EPYTHON}" PYTHON
 
 	local force quiet
 	while [[ ${@} ]]; do
@@ -1035,13 +1040,13 @@ python_fix_shebang() {
 
 	local path f
 	for path; do
-		local any_correct any_fixed is_recursive
+		local any_fixed is_recursive
 
 		[[ -d ${path} ]] && is_recursive=1
 
 		while IFS= read -r -d '' f; do
 			local shebang i
-			local error= from=
+			local error= match=
 
 			# note: we can't ||die here since read will fail if file
 			# has no newline characters
@@ -1050,64 +1055,36 @@ python_fix_shebang() {
 			# First, check if it's shebang at all...
 			if [[ ${shebang} == '#!'* ]]; then
 				local split_shebang=()
-				read -r -a split_shebang <<<${shebang} || die
-
-				# Match left-to-right in a loop, to avoid matching random
-				# repetitions like 'python2.7 python2'.
-				for i in "${split_shebang[@]}"; do
-					case "${i}" in
-						*"${EPYTHON}")
-							debug-print "${FUNCNAME}: in file ${f#${D%/}}"
-							debug-print "${FUNCNAME}: shebang matches EPYTHON: ${shebang}"
-
-							# Nothing to do, move along.
-							any_correct=1
-							from=${EPYTHON}
-							break
-							;;
-						*python|*python[23])
-							debug-print "${FUNCNAME}: in file ${f#${D%/}}"
-							debug-print "${FUNCNAME}: rewriting shebang: ${shebang}"
-
-							if [[ ${i} == *python2 ]]; then
-								from=python2
-								if [[ ! ${force} ]]; then
-									error=1
-								fi
-							elif [[ ${i} == *python3 ]]; then
-								from=python3
-							else
-								from=python
-							fi
-							break
-							;;
-						*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].[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].[0-9])
-										from="jython[23].[0-9]";;
-									*)
-										die "${FUNCNAME}: internal error in 2nd pattern match";;
-								esac
-							fi
-							break
-							;;
-					esac
-				done
+				read -r -a split_shebang <<<${shebang#"#!"} || die
+
+				local in_path=${split_shebang[0]}
+				local from='^#! *[^ ]*'
+				# if the first component is env(1), skip it
+				if [[ ${in_path} == */env ]]; then
+					in_path=${split_shebang[1]}
+					from+=' *[^ ]*'
+				fi
+
+				case ${in_path##*/} in
+					"${EPYTHON}")
+						match=1
+						;;
+					python|python[23])
+						match=1
+						[[ ${in_path##*/} == python2 ]] && error=1
+						;;
+					python[23].[0-9]|python3.[1-9][0-9]|pypy|pypy3|jython[23].[0-9])
+						# Explicit mismatch.
+						match=1
+						error=1
+						;;
+				esac
 			fi
 
-			if [[ ! ${error} && ! ${from} ]]; then
+			# disregard mismatches in force mode
+			[[ ${force} ]] && error=
+
+			if [[ ! ${match} ]]; then
 				# Non-Python shebang. Allowed in recursive mode,
 				# disallowed when specifying file explicitly.
 				[[ ${is_recursive} ]] && continue
@@ -1119,13 +1096,9 @@ python_fix_shebang() {
 			fi
 
 			if [[ ! ${error} ]]; then
-				# We either want to match ${from} followed by space
-				# or at end-of-string.
-				if [[ ${shebang} == *${from}" "* ]]; then
-					sed -i -e "1s:${from} :${EPYTHON} :" "${f}" || die
-				else
-					sed -i -e "1s:${from}$:${EPYTHON}:" "${f}" || die
-				fi
+				debug-print "${FUNCNAME}: in file ${f#${D%/}}"
+				debug-print "${FUNCNAME}: rewriting shebang: ${shebang}"
+				sed -i -e "1s@${from}@#!${PYTHON}@" "${f}" || die
 				any_fixed=1
 			else
 				eerror "The file has incompatible shebang:"
@@ -1138,12 +1111,7 @@ python_fix_shebang() {
 
 		if [[ ! ${any_fixed} ]]; then
 			eerror "QA error: ${FUNCNAME}, ${path#${D%/}} did not match any fixable files."
-			if [[ ${any_correct} ]]; then
-				eerror "All files have ${EPYTHON} shebang already."
-			else
-				eerror "There are no Python files in specified directory."
-			fi
-
+			eerror "There are no Python files in specified directory."
 			die "${FUNCNAME} did not match any fixable files"
 		fi
 	done

diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh
index 8c733b22294e..ef7687b8a9cf 100755
--- a/eclass/tests/python-utils-r1.sh
+++ b/eclass/tests/python-utils-r1.sh
@@ -41,7 +41,7 @@ test_fix_shebang() {
 	local expect=${3}
 	local args=( "${@:4}" )
 
-	tbegin "python_fix_shebang${args[@]+ ${args[*]}} from ${from} to ${to} (exp: ${expect})"
+	tbegin "python_fix_shebang${args[@]+ ${args[*]}} from ${from@Q} to ${to@Q} (exp: ${expect@Q})"
 
 	echo "${from}" > "${tmpfile}"
 	output=$( EPYTHON=${to} python_fix_shebang "${args[@]}" -q "${tmpfile}" 2>&1 )
@@ -156,36 +156,60 @@ fi
 test_var PYTHON_PKG_DEP pypy3 '*dev-python/pypy3*:0='
 test_var PYTHON_SCRIPTDIR pypy3 /usr/lib/python-exec/pypy3
 
-# generic shebangs
-test_fix_shebang '#!/usr/bin/python' python3.6 '#!/usr/bin/python3.6'
-test_fix_shebang '#!/usr/bin/python' pypy3 '#!/usr/bin/pypy3'
-
-# python2/python3 matching
-test_fix_shebang '#!/usr/bin/python3' python3.6 '#!/usr/bin/python3.6'
-test_fix_shebang '#!/usr/bin/python2' python3.6 FAIL
-test_fix_shebang '#!/usr/bin/python2' python3.6 '#!/usr/bin/python3.6' --force
-
-# pythonX.Y matching (those mostly test the patterns)
-test_fix_shebang '#!/usr/bin/python2.7' python3.2 FAIL
-test_fix_shebang '#!/usr/bin/python2.7' python3.2 '#!/usr/bin/python3.2' --force
-test_fix_shebang '#!/usr/bin/python3.2' python3.2 '#!/usr/bin/python3.2'
-
-# fancy path handling
-test_fix_shebang '#!/mnt/python2/usr/bin/python' python3.6 \
-	'#!/mnt/python2/usr/bin/python3.6'
-test_fix_shebang '#!/mnt/python2/usr/bin/python3' python3.8 \
-	'#!/mnt/python2/usr/bin/python3.8'
-test_fix_shebang '#!/mnt/python2/usr/bin/env python' python3.8 \
-	'#!/mnt/python2/usr/bin/env python3.8'
-test_fix_shebang '#!/mnt/python2/usr/bin/python3 python3' python3.8 \
-	'#!/mnt/python2/usr/bin/python3.8 python3'
-test_fix_shebang '#!/mnt/python2/usr/bin/python2 python3' python3.8 FAIL
-test_fix_shebang '#!/mnt/python2/usr/bin/python2 python3' python3.8 \
-	'#!/mnt/python2/usr/bin/python3.8 python3' --force
-test_fix_shebang '#!/usr/bin/foo' python3.8 FAIL
-
-# regression test for bug #522080
-test_fix_shebang '#!/usr/bin/python ' python3.8 '#!/usr/bin/python3.8 '
+for EPREFIX in '' /foo; do
+	einfo "with EPREFIX=${EPREFIX@Q}"
+	eindent
+	# generic shebangs
+	test_fix_shebang '#!/usr/bin/python' python3.6 \
+		"#!${EPREFIX}/usr/bin/python3.6"
+	test_fix_shebang '#!/usr/bin/python' pypy3 \
+		"#!${EPREFIX}/usr/bin/pypy3"
+
+	# python2/python3 matching
+	test_fix_shebang '#!/usr/bin/python3' python3.6 \
+		"#!${EPREFIX}/usr/bin/python3.6"
+	test_fix_shebang '#!/usr/bin/python2' python3.6 FAIL
+	test_fix_shebang '#!/usr/bin/python2' python3.6 \
+		"#!${EPREFIX}/usr/bin/python3.6" --force
+
+	# pythonX.Y matching (those mostly test the patterns)
+	test_fix_shebang '#!/usr/bin/python2.7' python3.2 FAIL
+	test_fix_shebang '#!/usr/bin/python2.7' python3.2 \
+		"#!${EPREFIX}/usr/bin/python3.2" --force
+	test_fix_shebang '#!/usr/bin/python3.2' python3.2 \
+		"#!${EPREFIX}/usr/bin/python3.2"
+
+	# fancy path handling
+	test_fix_shebang '#!/mnt/python2/usr/bin/python' python3.6 \
+		"#!${EPREFIX}/usr/bin/python3.6"
+	test_fix_shebang '#!/mnt/python2/usr/bin/python3' python3.8 \
+		"#!${EPREFIX}/usr/bin/python3.8"
+	test_fix_shebang '#!/mnt/python2/usr/bin/env python' python3.8 \
+		"#!${EPREFIX}/usr/bin/python3.8"
+	test_fix_shebang '#!/mnt/python2/usr/bin/python3 python3' python3.8 \
+		"#!${EPREFIX}/usr/bin/python3.8 python3"
+	test_fix_shebang '#!/mnt/python2/usr/bin/python2 python3' python3.8 FAIL
+	test_fix_shebang '#!/mnt/python2/usr/bin/python2 python3' python3.8 \
+		"#!${EPREFIX}/usr/bin/python3.8 python3" --force
+	test_fix_shebang '#!/usr/bin/foo' python3.8 FAIL
+
+	# regression test for bug #522080
+	test_fix_shebang '#!/usr/bin/python ' python3.8 \
+		"#!${EPREFIX}/usr/bin/python3.8 "
+
+	# test random whitespace in shebang
+	test_fix_shebang '#! /usr/bin/python' python3.8 \
+		"#!${EPREFIX}/usr/bin/python3.8"
+	test_fix_shebang '#!  /usr/bin/python' python3.8 \
+		"#!${EPREFIX}/usr/bin/python3.8"
+	test_fix_shebang '#! /usr/bin/env   python' python3.8 \
+		"#!${EPREFIX}/usr/bin/python3.8"
+
+	# test preserving options
+	test_fix_shebang '#! /usr/bin/python -b' python3.8 \
+		"#!${EPREFIX}/usr/bin/python3.8 -b"
+	eoutdent
+done
 
 # check _python_impl_matches behavior
 test_is "_python_impl_matches python3_6 -3" 0


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: eclass/, eclass/tests/
@ 2022-05-09 20:33 Michał Górny
  0 siblings, 0 replies; 40+ messages in thread
From: Michał Górny @ 2022-05-09 20:33 UTC (permalink / raw
  To: gentoo-commits

commit:     53fc3b443284eb94b3bfb4266ee0efb890441dbd
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun May  8 10:15:35 2022 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon May  9 20:31:45 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=53fc3b44

python-utils-r1.eclass: Add support for python3.11

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 eclass/python-utils-r1.eclass   | 10 ++++++----
 eclass/tests/python-utils-r1.sh | 14 ++++++++++++++
 2 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 7b1bd012a37e..2b22b0539ecb 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -43,7 +43,7 @@ inherit multiprocessing toolchain-funcs
 # All supported Python implementations, most preferred last.
 _PYTHON_ALL_IMPLS=(
 	pypy3
-	python3_{8..10}
+	python3_{8..11}
 )
 readonly _PYTHON_ALL_IMPLS
 
@@ -83,7 +83,7 @@ _python_verify_patterns() {
 	local impl pattern
 	for pattern; do
 		case ${pattern} in
-			-[23]|3.[89]|3.10)
+			-[23]|3.[89]|3.1[01])
 				continue
 				;;
 		esac
@@ -132,7 +132,7 @@ _python_set_impls() {
 			# please keep them in sync with _PYTHON_ALL_IMPLS
 			# and _PYTHON_HISTORICAL_IMPLS
 			case ${i} in
-				pypy3|python2_7|python3_[89]|python3_10)
+				pypy3|python2_7|python3_[89]|python3_1[01])
 					;;
 				jython2_7|pypy|pypy1_[89]|pypy2_0|python2_[5-6]|python3_[1-7])
 					obsolete+=( "${i}" )
@@ -245,7 +245,7 @@ _python_impl_matches() {
 				[[ ${impl} == python${pattern/./_} || ${impl} == pypy3 ]] &&
 					return 0
 				;;
-			3.8|3.10)
+			3.8|3.1[01])
 				[[ ${impl} == python${pattern/./_} ]] && return 0
 				;;
 			*)
@@ -461,6 +461,8 @@ _python_export() {
 						PYTHON_PKG_DEP=">=dev-lang/python-3.9.9-r1:3.9";;
 					python3.10)
 						PYTHON_PKG_DEP=">=dev-lang/python-3.10.0_p1-r1:3.10";;
+					python3.11)
+						PYTHON_PKG_DEP=">=dev-lang/python-3.11.0_beta1:3.11";;
 					python*)
 						PYTHON_PKG_DEP="dev-lang/python:${impl#python}";;
 					pypy)

diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh
index 9c41798c4727..e0fc0aab3c03 100755
--- a/eclass/tests/python-utils-r1.sh
+++ b/eclass/tests/python-utils-r1.sh
@@ -147,6 +147,20 @@ fi
 test_var PYTHON_PKG_DEP python3_10 '*dev-lang/python*:3.10'
 test_var PYTHON_SCRIPTDIR python3_10 /usr/lib/python-exec/python3.10
 
+test_var EPYTHON python3_11 python3.11
+test_var PYTHON python3_11 /usr/bin/python3.11
+if [[ -x /usr/bin/python3.11 ]]; then
+	abiflags=$(/usr/bin/python3.11 -c 'import sysconfig; print(sysconfig.get_config_var("ABIFLAGS"))')
+	test_var PYTHON_SITEDIR python3_11 "/usr/lib/python3.11/site-packages"
+	test_var PYTHON_INCLUDEDIR python3_11 "/usr/include/python3.11${abiflags}"
+	test_var PYTHON_LIBPATH python3_11 "/usr/lib*/libpython3.11${abiflags}$(get_libname)"
+	test_var PYTHON_CONFIG python3_11 "/usr/bin/python3.11${abiflags}-config"
+	test_var PYTHON_CFLAGS python3_11 "*-I/usr/include/python3.11*"
+	test_var PYTHON_LIBS python3_11 "*-lpython3.11*"
+fi
+test_var PYTHON_PKG_DEP python3_11 '*dev-lang/python*:3.11'
+test_var PYTHON_SCRIPTDIR python3_11 /usr/lib/python-exec/python3.11
+
 test_var EPYTHON pypy3 pypy3
 test_var PYTHON pypy3 /usr/bin/pypy3
 if [[ -x /usr/bin/pypy3 ]]; then


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: eclass/, eclass/tests/
@ 2022-09-27 20:28 Michał Górny
  0 siblings, 0 replies; 40+ messages in thread
From: Michał Górny @ 2022-09-27 20:28 UTC (permalink / raw
  To: gentoo-commits

commit:     98bce41166f1a62c6a9b843db7e68a7efedd5742
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 24 14:30:13 2022 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Sep 27 20:28:02 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=98bce411

unpacker.eclass: Add support for .lz4 and .lzo compression

Add support for .lz4 and .lzo formats that can be used for .tar.gpkg
compression.

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 eclass/tests/unpacker.sh | 7 +++++++
 eclass/unpacker.eclass   | 8 ++++++++
 2 files changed, 15 insertions(+)

diff --git a/eclass/tests/unpacker.sh b/eclass/tests/unpacker.sh
index 7a297d61babd..1f2327054521 100755
--- a/eclass/tests/unpacker.sh
+++ b/eclass/tests/unpacker.sh
@@ -165,6 +165,8 @@ test_compressed_file .lzma lzma
 test_compressed_file .xz xz
 test_compressed_file .lz lzip
 test_compressed_file .zst zstd
+test_compressed_file .lz4 lz4
+test_compressed_file .lzo lzop
 
 test_compressed_file_multistream .bz2 bzip2
 test_compressed_file_multistream .gz gzip
@@ -187,6 +189,8 @@ test_compressed_tar .tar.xz xz
 test_compressed_tar .txz xz
 test_compressed_tar .tar.lz lzip
 test_compressed_tar .tar.zst zstd
+test_compressed_tar .tar.lz4 lz4
+test_compressed_tar .tar.lzo lzop
 
 test_unpack test.cpio test.in cpio 'cpio -o --quiet <<<${TESTFILE} > ${archive}'
 test_compressed_cpio .cpio.bz2 bzip2
@@ -196,6 +200,8 @@ test_compressed_cpio .cpio.lzma lzma
 test_compressed_cpio .cpio.xz xz
 test_compressed_cpio .cpio.lz lzip
 test_compressed_cpio .cpio.zst zstd
+test_compressed_cpio .cpio.lz4 lz4
+test_compressed_cpio .cpio.lzo lzop
 
 test_deb
 test_deb .gz gzip
@@ -223,6 +229,7 @@ test_reject_junk .lz
 test_reject_junk .zst
 test_reject_junk .tar
 test_reject_junk .cpio
+test_reject_junk .gpkg.tar
 test_reject_junk .deb
 test_reject_junk .zip
 test_reject_junk .7z

diff --git a/eclass/unpacker.eclass b/eclass/unpacker.eclass
index 8fb1c2abd1cf..a64c5eae18aa 100644
--- a/eclass/unpacker.eclass
+++ b/eclass/unpacker.eclass
@@ -401,6 +401,10 @@ _unpacker_get_decompressor() {
 		echo "${UNPACKER_LZIP} -dc" ;;
 	*.zst)
 		echo "zstd -dc" ;;
+	*.lz4)
+		echo "lz4 -dc" ;;
+	*.lzo)
+		echo "lzop -dc" ;;
 	esac
 }
 
@@ -535,6 +539,10 @@ unpacker_src_uri_depends() {
 			d="app-arch/zstd" ;;
 		*.lha|*.lzh)
 			d="app-arch/lha" ;;
+		*.lz4)
+			d="app-arch/lz4" ;;
+		*.lzo)
+			d="app-arch/lzop" ;;
 		esac
 		deps+=" ${d}"
 	done


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: eclass/, eclass/tests/
@ 2022-09-27 20:28 Michał Górny
  0 siblings, 0 replies; 40+ messages in thread
From: Michał Górny @ 2022-09-27 20:28 UTC (permalink / raw
  To: gentoo-commits

commit:     a8d104aa0eda11f36aaa20256353bf6ce6543065
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Sep 25 07:49:06 2022 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Sep 27 20:28:06 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a8d104aa

unpacker.eclass: Fix handling GNU ar archives in handwoven impl

Fix the hand-weaved implementation of ar unpacking that is used
on Prefix to handle slash-terminated filenames of GNU ar format
correctly.

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 eclass/tests/unpacker.sh | 4 ++++
 eclass/unpacker.eclass   | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/eclass/tests/unpacker.sh b/eclass/tests/unpacker.sh
index 40bde1bf30de..b15953966f65 100755
--- a/eclass/tests/unpacker.sh
+++ b/eclass/tests/unpacker.sh
@@ -134,6 +134,10 @@ test_deb() {
 
 	test_unpack "test-${tool}_1.2.3_noarch.deb" test.in "ar tar ${tool}" \
 		"create_deb '${suffix}' '${tool_cmd}' \${archive} \${TESTFILE}"
+	# also test with the handwoven implementation used on Prefix
+	EPREFIX=/foo \
+	test_unpack "test_pfx-${tool}_1.2.3_noarch.deb" test.in "ar tar ${tool}" \
+		"create_deb '${suffix}' '${tool_cmd}' \${archive} \${TESTFILE}"
 }
 
 create_gpkg() {

diff --git a/eclass/unpacker.eclass b/eclass/unpacker.eclass
index 370f00a83bba..100f11428622 100644
--- a/eclass/unpacker.eclass
+++ b/eclass/unpacker.eclass
@@ -282,6 +282,8 @@ unpack_deb() {
 			local f timestamp uid gid mode size magic
 			while read f timestamp uid gid mode size magic ; do
 				[[ -n ${f} && -n ${size} ]] || continue # ignore empty lines
+				# GNU ar uses / as filename terminator (and .deb permits that)
+				f=${f%/}
 				if [[ ${f} = "data.tar"* ]] ; then
 					head -c "${size}" > "${f}"
 				else


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: eclass/, eclass/tests/
@ 2022-09-27 20:28 Michał Górny
  0 siblings, 0 replies; 40+ messages in thread
From: Michał Górny @ 2022-09-27 20:28 UTC (permalink / raw
  To: gentoo-commits

commit:     778904f14cd059327453557a26eaabc3c42ddc5c
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 24 14:27:09 2022 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Sep 27 20:28:03 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=778904f1

unpacker.eclass: Add on-the-fly .gpkg.tar unpacking support

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 eclass/tests/unpacker.sh | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 eclass/unpacker.eclass   | 38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 85 insertions(+)

diff --git a/eclass/tests/unpacker.sh b/eclass/tests/unpacker.sh
index 1f2327054521..40bde1bf30de 100755
--- a/eclass/tests/unpacker.sh
+++ b/eclass/tests/unpacker.sh
@@ -136,6 +136,43 @@ test_deb() {
 		"create_deb '${suffix}' '${tool_cmd}' \${archive} \${TESTFILE}"
 }
 
+create_gpkg() {
+	local suffix=${1}
+	local tool=${2}
+	local archive=${3}
+	local infile=${4}
+	local gpkg_dir=${archive%.gpkg.tar}
+
+	mkdir image metadata "${gpkg_dir}" || die
+	cp "${infile}" image/ || die
+	tar -c metadata | ${tool} > "${gpkg_dir}/metadata.tar${suffix}"
+	assert "packing metadata.tar${suffix} failed"
+	: > "${gpkg_dir}/metadata.tar${suffix}.sig" || die
+	tar -c image | ${tool} > "${gpkg_dir}/image.tar${suffix}"
+	assert "packing image.tar${suffix} failed"
+	: > "${gpkg_dir}/image.tar${suffix}.sig" || die
+	: > "${gpkg_dir}"/gpkg-1 || die
+	tar -cf "${archive}" --format=ustar \
+		"${gpkg_dir}"/{gpkg-1,{metadata,image}.tar"${suffix}"} || die
+	rm -r image metadata "${gpkg_dir}" || die
+}
+
+test_gpkg() {
+	local suffix=${1}
+	local tool=${2}
+	local tool_cmd
+
+	if [[ -n ${tool} ]]; then
+		tool_cmd="${tool} -c"
+	else
+		tool_cmd=cat
+	fi
+
+	test_unpack "test-${tool}-1.2.3-1.gpkg.tar" \
+		"test-${tool}-1.2.3-1/image/test.in" "tar ${tool}" \
+		"create_gpkg '${suffix}' '${tool_cmd}' \${archive} \${TESTFILE}"
+}
+
 test_reject_junk() {
 	local suffix=${1}
 	local archive=test${1}
@@ -209,6 +246,16 @@ test_deb .xz xz
 test_deb .bz2 bzip2
 test_deb .lzma lzma
 
+test_gpkg
+test_gpkg .gz gzip
+test_gpkg .bz2 bzip2
+test_gpkg .lz4 lz4
+test_gpkg .lz lzip
+test_gpkg .lzma lzma
+test_gpkg .lzo lzop
+test_gpkg .xz xz
+test_gpkg .zst zstd
+
 test_unpack test.zip test.in zip 'zip -q ${archive} ${TESTFILE}'
 # test handling non-adjusted zip with junk prepended
 test_unpack test.zip test.in zip \

diff --git a/eclass/unpacker.eclass b/eclass/unpacker.eclass
index a64c5eae18aa..70a46ac19709 100644
--- a/eclass/unpacker.eclass
+++ b/eclass/unpacker.eclass
@@ -408,6 +408,42 @@ _unpacker_get_decompressor() {
 	esac
 }
 
+# @FUNCTION: unpack_gpkg
+# @USAGE: <gpkg file>
+# @DESCRIPTION:
+# Unpack the image subarchive of a GPKG package on-the-fly, preserving
+# the original directory structure (i.e. into <gpkg-dir>/image).
+unpack_gpkg() {
+	[[ $# -eq 1 ]] || die "Usage: ${FUNCNAME} <file>"
+
+	local gpkg=$(find_unpackable_file "$1")
+	unpack_banner "${gpkg}"
+
+	local l images=()
+	while read -r l; do
+		case ${l} in
+			*/image.tar*.sig)
+				;;
+			*/image.tar*)
+				images+=( "${l}" )
+				;;
+		esac
+	done < <(tar -tf "${gpkg}" || die "unable to list ${gpkg}")
+
+	if [[ ${#images[@]} -eq 0 ]]; then
+		die "No image.tar found in ${gpkg}"
+	elif [[ ${#images[@]} -gt 1 ]]; then
+		die "More than one image.tar found in ${gpkg}"
+	fi
+
+	local decomp=$(_unpacker_get_decompressor "${images[0]}")
+	local dirname=${images[0]%/*}
+	mkdir -p "${dirname}" || die
+	tar -xOf "${gpkg}" "${images[0]}" | ${decomp:-cat} |
+		tar --no-same-owner -xC "${dirname}"
+	assert "Unpacking ${gpkg} failed"
+}
+
 # @FUNCTION: _unpacker
 # @USAGE: <one archive to unpack>
 # @INTERNAL
@@ -427,6 +463,8 @@ _unpacker() {
 	# then figure out if there are any archiving aspects
 	local arch=""
 	case ${m} in
+	*.gpkg.tar)
+		arch="unpack_gpkg" ;;
 	*.tgz|*.tbz|*.tbz2|*.txz|*.tar.*|*.tar)
 		arch="tar --no-same-owner -xof" ;;
 	*.cpio.*|*.cpio)


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: eclass/, eclass/tests/
@ 2022-10-10 20:52 Michał Górny
  0 siblings, 0 replies; 40+ messages in thread
From: Michał Górny @ 2022-10-10 20:52 UTC (permalink / raw
  To: gentoo-commits

commit:     2170307e8e09491f88b0c5f41d42aa096d1b3632
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Oct  7 15:02:28 2022 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Oct 10 20:52:34 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2170307e

toolchain-funcs.eclass: Add tc-get-cxx-stdlib() to get C++ stdlib

Add a new tc-get-cxx-stdlib() that attempts to get the C++ stdlib
variant used by the current C++ compiler.  Currently it supports libc++
and libstdc++ (GCC's stdlib).

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 eclass/tests/toolchain-funcs.sh | 22 ++++++++++++++++++++++
 eclass/toolchain-funcs.eclass   | 36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 58 insertions(+)

diff --git a/eclass/tests/toolchain-funcs.sh b/eclass/tests/toolchain-funcs.sh
index 56379b10cded..5a35a44ce018 100755
--- a/eclass/tests/toolchain-funcs.sh
+++ b/eclass/tests/toolchain-funcs.sh
@@ -198,4 +198,26 @@ for compiler in gcc clang not-really-a-compiler; do
 	fi
 done
 
+if type -P gcc &>/dev/null; then
+	tbegin "tc-get-cxx-stdlib (gcc)"
+	[[ $(CXX=g++ tc-get-cxx-stdlib) == libstdc++ ]]
+	tend $?
+fi
+
+if type -P clang &>/dev/null; then
+	for stdlib in libc++ libstdc++; do
+		if clang++ -stdlib=${stdlib} -x c++ -E -P - &>/dev/null \
+			<<<'#include <ciso646>'
+		then
+			tbegin "tc-get-cxx-stdlib (clang, ${stdlib})"
+			[[ $(CXX=clang++ CXXFLAGS="-stdlib=${stdlib}" tc-get-cxx-stdlib) == ${stdlib} ]]
+			tend $?
+		fi
+	done
+
+	tbegin "tc-get-cxx-stdlib (clang, invalid)"
+	! CXX=clang++ CXXFLAGS="-stdlib=invalid" tc-get-cxx-stdlib
+	tend $?
+fi
+
 texit

diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
index 48bf11606c4a..92494158201e 100644
--- a/eclass/toolchain-funcs.eclass
+++ b/eclass/toolchain-funcs.eclass
@@ -1173,4 +1173,40 @@ gen_usr_ldscript() {
 	done
 }
 
+# @FUNCTION: tc-get-cxx-stdlib
+# @DESCRIPTION:
+# Attempt to identify the C++ standard library used by the compiler.
+# If the library is identified, the function returns 0 and prints one
+# of the following:
+#
+# - ``libc++`` for ``sys-libs/libcxx``
+# - ``libstdc++`` for ``sys-devel/gcc``'s libstdc++
+#
+# If the library is not recognized, the function returns 1.
+tc-get-cxx-stdlib() {
+	local code='#include <ciso646>
+
+#if defined(_LIBCPP_VERSION)
+	HAVE_LIBCXX
+#elif defined(__GLIBCXX__)
+	HAVE_LIBSTDCPP
+#endif
+'
+	local res=$(
+		$(tc-getCXX) ${CXXFLAGS} ${CPPFLAGS} -x c++ -E -P - \
+			<<<"${code}" 2>/dev/null
+	)
+
+	case ${res} in
+		*HAVE_LIBCXX*)
+			echo libc++;;
+		*HAVE_LIBSTDCPP*)
+			echo libstdc++;;
+		*)
+			return 1;;
+	esac
+
+	return 0
+}
+
 fi


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: eclass/, eclass/tests/
@ 2022-10-19 11:53 Michał Górny
  0 siblings, 0 replies; 40+ messages in thread
From: Michał Górny @ 2022-10-19 11:53 UTC (permalink / raw
  To: gentoo-commits

commit:     31885dcc9d0a8743903846c61d4aeb575693ca0d
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 15 09:58:04 2022 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Oct 19 11:51:51 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=31885dcc

dist-kernel-utils.eclass: Add a PV → KV conversion function

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 eclass/dist-kernel-utils.eclass   | 16 ++++++++++++++++
 eclass/tests/dist-kernel-utils.sh | 28 ++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+)

diff --git a/eclass/dist-kernel-utils.eclass b/eclass/dist-kernel-utils.eclass
index 8c1b56f41506..439bdc87695d 100644
--- a/eclass/dist-kernel-utils.eclass
+++ b/eclass/dist-kernel-utils.eclass
@@ -155,5 +155,21 @@ dist-kernel_reinstall_initramfs() {
 		"${kernel_dir}/System.map"
 }
 
+# @FUNCTION: dist-kernel_PV_to_KV
+# @USAGE: <pv>
+# @DESCRIPTION:
+# Convert a Gentoo-style ebuild version to kernel "x.y.z[-rcN]" version.
+dist-kernel_PV_to_KV() {
+	debug-print-function ${FUNCNAME} "${@}"
+
+	[[ ${#} -ne 1 ]] && die "${FUNCNAME}: invalid arguments"
+	local pv=${1}
+
+	local kv=${pv%%_*}
+	[[ -z $(ver_cut 3- "${kv}") ]] && kv+=".0"
+	[[ ${pv} == *_* ]] && kv+=-${pv#*_}
+	echo "${kv}"
+}
+
 _DIST_KERNEL_UTILS=1
 fi

diff --git a/eclass/tests/dist-kernel-utils.sh b/eclass/tests/dist-kernel-utils.sh
new file mode 100755
index 000000000000..7f04f55ce302
--- /dev/null
+++ b/eclass/tests/dist-kernel-utils.sh
@@ -0,0 +1,28 @@
+#!/usr/bin/env bash
+# Copyright 2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+source tests-common.sh || exit
+
+inherit dist-kernel-utils
+# TODO: hack because tests-common don't implement ver_cut
+EAPI=6 inherit eapi7-ver
+
+test_PV_to_KV() {
+	local kv=${1}
+	local exp_PV=${2}
+
+	tbegin "dist-kernel_PV_to_KV ${kv} -> ${exp_PV}"
+	local val=$(dist-kernel_PV_to_KV "${kv}")
+	[[ ${val} == ${exp_PV} ]]
+	tend $?
+}
+
+test_PV_to_KV 6.0_rc1 6.0.0-rc1
+test_PV_to_KV 6.0 6.0.0
+test_PV_to_KV 6.0.1_rc1 6.0.1-rc1
+test_PV_to_KV 6.0.1 6.0.1
+
+texit


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: eclass/, eclass/tests/
@ 2022-12-24 20:16 Michał Górny
  0 siblings, 0 replies; 40+ messages in thread
From: Michał Górny @ 2022-12-24 20:16 UTC (permalink / raw
  To: gentoo-commits

commit:     46d18cd145b4fc1c0c179d70b81974334d3623a3
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 13 03:48:48 2022 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Dec 24 20:16:04 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=46d18cd1

llvm.eclass: Remove EAPI 6

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 eclass/llvm.eclass   | 43 ++++++++-----------------------------------
 eclass/tests/llvm.sh |  7 -------
 2 files changed, 8 insertions(+), 42 deletions(-)

diff --git a/eclass/llvm.eclass b/eclass/llvm.eclass
index 7657de4bc5a2..b4347163face 100644
--- a/eclass/llvm.eclass
+++ b/eclass/llvm.eclass
@@ -6,7 +6,7 @@
 # Michał Górny <mgorny@gentoo.org>
 # @AUTHOR:
 # Michał Górny <mgorny@gentoo.org>
-# @SUPPORTED_EAPIS: 6 7 8
+# @SUPPORTED_EAPIS: 7 8
 # @BLURB: Utility functions to build against slotted LLVM
 # @DESCRIPTION:
 # The llvm.eclass provides utility functions that can be used to build
@@ -56,15 +56,9 @@
 # }
 # @CODE
 
-case "${EAPI:-0}" in
-	0|1|2|3|4|5)
-		die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}"
-		;;
-	6|7|8)
-		;;
-	*)
-		die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}"
-		;;
+case ${EAPI} in
+	7|8) ;;
+	*) die "EAPI=${EAPI:-0} not supported";;
 esac
 
 EXPORT_FUNCTIONS pkg_setup
@@ -95,7 +89,7 @@ declare -g -r _LLVM_KNOWN_SLOTS=( {16..8} )
 #
 # If -b is specified, the checks are performed relative to BROOT,
 # and BROOT-path is returned.  This is appropriate when your package
-# calls llvm-config executable.  -b is supported since EAPI 7.
+# calls llvm-config executable.
 #
 # If -d is specified, the checks are performed relative to ESYSROOT,
 # and ESYSROOT-path is returned.  This is appropriate when your package
@@ -126,17 +120,6 @@ get_llvm_slot() {
 		shift
 	done
 
-	if [[ ${EAPI} == 6 ]]; then
-		case ${hv_switch} in
-			-b)
-				die "${FUNCNAME} -b is not supported in EAPI ${EAPI}"
-				;;
-			-d)
-				hv_switch=
-				;;
-		esac
-	fi
-
 	local max_slot=${1}
 	local slot
 	for slot in "${_LLVM_KNOWN_SLOTS[@]}"; do
@@ -179,17 +162,8 @@ get_llvm_slot() {
 get_llvm_prefix() {
 	debug-print-function ${FUNCNAME} "${@}"
 
-	local prefix=${EPREFIX}
-	if [[ ${EAPI} != 6 ]]; then
-		case ${1} in
-			-b)
-				prefix=${BROOT}
-				;;
-			*)
-				prefix=${ESYSROOT}
-				;;
-		esac
-	fi
+	local prefix=${ESYSROOT}
+	[[ ${1} == -b ]] && prefix=${BROOT}
 
 	echo "${prefix}/usr/lib/llvm/$(get_llvm_slot "${@}")"
 }
@@ -277,8 +251,7 @@ llvm_pkg_setup() {
 		llvm_fix_tool_path ADDR2LINE AR AS LD NM OBJCOPY OBJDUMP RANLIB
 		llvm_fix_tool_path READELF STRINGS STRIP
 
-		local prefix=${EPREFIX}
-		[[ ${EAPI} != 6 ]] && prefix=${ESYSROOT}
+		local prefix=${ESYSROOT}
 		local llvm_path=${prefix}/usr/lib/llvm/${LLVM_SLOT}/bin
 		local IFS=:
 		local split_path=( ${PATH} )

diff --git a/eclass/tests/llvm.sh b/eclass/tests/llvm.sh
index 93bc124a82af..e62fb4b002a2 100755
--- a/eclass/tests/llvm.sh
+++ b/eclass/tests/llvm.sh
@@ -74,13 +74,6 @@ eindent
 	check_prefix /sysroot/eprefix/usr/lib/llvm/11 -d
 eoutdent
 
-ebegin "Testing check_setup_path EAPI 6 API"
-eindent
-	EAPI=6 \
-	LLVM_INSTALLED_SLOT=11 \
-	check_prefix /usr/lib/llvm/11 -d
-eoutdent
-
 BASEPATH=/usr/lib/ccache/bin:/usr/bin:/usr/sbin:/bin:/sbin
 
 # TODO: cross support?


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: eclass/, eclass/tests/
@ 2023-02-12 19:05 Michał Górny
  0 siblings, 0 replies; 40+ messages in thread
From: Michał Górny @ 2023-02-12 19:05 UTC (permalink / raw
  To: gentoo-commits

commit:     4141f5032c5e45dc912f27d39d81ef0a65c6c56b
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Feb 11 10:30:54 2023 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Feb 12 19:00:47 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4141f503

pypi.eclass: Normalize PN and translate PV for S as well

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 eclass/pypi.eclass   | 19 ++++++++++++++-----
 eclass/tests/pypi.sh |  3 +++
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/eclass/pypi.eclass b/eclass/pypi.eclass
index be0e498fcbf3..f4367b3fbfec 100644
--- a/eclass/pypi.eclass
+++ b/eclass/pypi.eclass
@@ -11,12 +11,20 @@
 # @DESCRIPTION:
 # The pypi.eclass can be used to easily obtain URLs for artifacts
 # uploaded to PyPI.org.  When inherited, the eclass defaults SRC_URI
-# to fetch ${P}.tar.gz sdist.
+# and S to fetch .tar.gz sdist.  The project filename is normalized
+# by default, and the version is translated using
+# pypi_translate_version.
 #
-# If necessary, SRC_URI can be overriden by the ebuild.  Two helper
-# functions, pypi_sdist_url and pypi_wheel_url are provided to generate
-# URLs to artifacts of specified type, with customizable project name.
-# Additionally, pypi_wheel_name can be used to generate wheel filename.
+# If necessary, SRC_URI and S can be overriden by the ebuild.  Two
+# helper functions, pypi_sdist_url and pypi_wheel_url are provided
+# to generate URLs to artifacts of specified type, with customizable
+# URL components.  Additionally, pypi_wheel_name can be used to generate
+# wheel filename.
+#
+# pypi_normalize_name can be used to normalize an arbitrary project name
+# according to sdist/wheel normalization rules.  pypi_translate_version
+# can be used to translate a Gentoo version string into its PEP 440
+# equivalent.
 #
 # @EXAMPLE:
 # @CODE@
@@ -193,5 +201,6 @@ pypi_wheel_url() {
 }
 
 SRC_URI="$(pypi_sdist_url)"
+S="${WORKDIR}/$(pypi_normalize_name "${PN}")-$(pypi_translate_version "${PV}")"
 
 fi

diff --git a/eclass/tests/pypi.sh b/eclass/tests/pypi.sh
index e114549633a0..ebfcdb630856 100755
--- a/eclass/tests/pypi.sh
+++ b/eclass/tests/pypi.sh
@@ -7,6 +7,7 @@ source tests-common.sh || exit
 
 PN=Foo.Bar
 PV=1.2.3_beta2
+WORKDIR='<WORKDIR>'
 
 inherit pypi
 
@@ -89,5 +90,7 @@ test-eq "pypi_sdist_url --no-normalize Flask-BabelEx 4 .zip" \
 
 test-eq 'declare -p SRC_URI' \
 	'declare -- SRC_URI="https://files.pythonhosted.org/packages/source/F/Foo.Bar/foo_bar-1.2.3b2.tar.gz"'
+test-eq 'declare -p S' \
+	'declare -- S="<WORKDIR>/foo_bar-1.2.3b2"'
 
 texit


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: eclass/, eclass/tests/
@ 2023-03-17 22:04 David Seifert
  0 siblings, 0 replies; 40+ messages in thread
From: David Seifert @ 2023-03-17 22:04 UTC (permalink / raw
  To: gentoo-commits

commit:     2cba2db27919bc449ed2a7bf7ed3259c6b96e65f
Author:     David Seifert <soap <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 17 22:04:31 2023 +0000
Commit:     David Seifert <soap <AT> gentoo <DOT> org>
CommitDate: Fri Mar 17 22:04:31 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2cba2db2

eclass: standardize prologue/epilogue

Closes: https://github.com/gentoo/gentoo/pull/30061
Signed-off-by: David Seifert <soap <AT> gentoo.org>

 eclass/acct-group.eclass            |  9 +++++----
 eclass/acct-user.eclass             | 10 +++++-----
 eclass/ada.eclass                   |  7 ++++++-
 eclass/ant-tasks.eclass             | 11 ++++++++---
 eclass/autotools.eclass             | 16 +++++++---------
 eclass/bzr.eclass                   |  8 ++++----
 eclass/cargo.eclass                 | 23 +++++++++++------------
 eclass/check-reqs.eclass            | 10 +++++-----
 eclass/chromium-2.eclass            |  4 ++--
 eclass/cmake-multilib.eclass        |  4 ++--
 eclass/cmake.eclass                 |  2 +-
 eclass/common-lisp-3.eclass         | 10 +++++-----
 eclass/cuda.eclass                  | 25 +++++++++----------------
 eclass/cvs.eclass                   | 12 ++++++------
 eclass/distutils-r1.eclass          | 20 ++++++++------------
 eclass/docs.eclass                  |  4 ++--
 eclass/ecm.eclass                   |  4 ++--
 eclass/elisp.eclass                 |  8 ++++----
 eclass/fcaps.eclass                 |  6 +++---
 eclass/font-ebdftopcf.eclass        |  8 ++++----
 eclass/font.eclass                  | 14 +++++++-------
 eclass/fortran-2.eclass             | 20 +++++++++-----------
 eclass/frameworks.kde.org.eclass    |  4 ++--
 eclass/freedict.eclass              | 16 ++++++++--------
 eclass/gear.kde.org.eclass          |  4 ++--
 eclass/gnustep-2.eclass             |  4 ++--
 eclass/go-module.eclass             | 13 +++++++------
 eclass/haskell-cabal.eclass         | 15 ++++++++++-----
 eclass/java-ant-2.eclass            | 12 ++++++------
 eclass/java-vm-2.eclass             | 17 +++++++++++------
 eclass/kde.org.eclass               |  4 ++--
 eclass/kodi-addon.eclass            |  6 +++---
 eclass/llvm.org.eclass              | 13 +++++--------
 eclass/lua-single.eclass            | 19 +++++++------------
 eclass/lua-utils.eclass             | 13 ++++++-------
 eclass/lua.eclass                   | 19 +++++++------------
 eclass/mate-desktop.org.eclass      | 12 ++++++++----
 eclass/mate.eclass                  | 12 ++++++++----
 eclass/meson-multilib.eclass        |  6 +++---
 eclass/meson.eclass                 |  6 +++---
 eclass/mount-boot.eclass            |  8 ++++----
 eclass/myspell-r2.eclass            | 13 +++++--------
 eclass/netsurf.eclass               |  6 +++---
 eclass/optfeature.eclass            |  4 ++--
 eclass/out-of-source.eclass         |  4 ++--
 eclass/php-pear-r2.eclass           | 24 ++++++++++++------------
 eclass/plasma-mobile.kde.org.eclass |  4 ++--
 eclass/plasma.kde.org.eclass        |  4 ++--
 eclass/python-r1.eclass             |  4 ++--
 eclass/qt5-build.eclass             | 16 ++++++++++------
 eclass/qt6-build.eclass             | 22 +++++++++++++---------
 eclass/rebar.eclass                 |  9 +++++++--
 eclass/ruby-ng.eclass               | 25 +++++++++++--------------
 eclass/savedconfig.eclass           | 17 +++++++++++------
 eclass/sgml-catalog-r1.eclass       | 14 +++++++-------
 eclass/ssl-cert.eclass              |  8 ++++----
 eclass/tests/distutils-r1.sh        |  2 +-
 eclass/tests/distutils-r1_single.sh |  2 +-
 eclass/texlive-common.eclass        | 13 ++++++-------
 eclass/texlive-module.eclass        | 17 +++++++++--------
 eclass/toolchain.eclass             | 11 +++++------
 eclass/tree-sitter-grammar.eclass   | 19 +++++++++----------
 eclass/unpacker.eclass              |  8 ++++----
 eclass/verify-sig.eclass            |  8 ++++----
 eclass/vim-plugin.eclass            | 20 +++++++++-----------
 eclass/vim-spell.eclass             | 10 +++++-----
 eclass/virtualx.eclass              |  6 +++---
 eclass/xorg-3.eclass                | 28 ++++++++++++++--------------
 68 files changed, 382 insertions(+), 374 deletions(-)

diff --git a/eclass/acct-group.eclass b/eclass/acct-group.eclass
index f55c9f4c9587..47e2d278f73e 100644
--- a/eclass/acct-group.eclass
+++ b/eclass/acct-group.eclass
@@ -1,4 +1,4 @@
-# Copyright 2019-2022 Gentoo Authors
+# Copyright 2019-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: acct-group.eclass
@@ -36,9 +36,9 @@
 if [[ -z ${_ACCT_GROUP_ECLASS} ]]; then
 _ACCT_GROUP_ECLASS=1
 
-case ${EAPI:-0} in
+case ${EAPI} in
 	7|8) ;;
-	*) die "EAPI=${EAPI:-0} not supported";;
+	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
 inherit user-info
@@ -83,7 +83,6 @@ S=${WORKDIR}
 
 
 # << Phase functions >>
-EXPORT_FUNCTIONS pkg_pretend src_install pkg_preinst
 
 # @FUNCTION: acct-group_pkg_pretend
 # @DESCRIPTION:
@@ -184,3 +183,5 @@ acct-group_pkg_preinst() {
 }
 
 fi
+
+EXPORT_FUNCTIONS pkg_pretend src_install pkg_preinst

diff --git a/eclass/acct-user.eclass b/eclass/acct-user.eclass
index 14fda76ced73..145fdb41aaf8 100644
--- a/eclass/acct-user.eclass
+++ b/eclass/acct-user.eclass
@@ -1,4 +1,4 @@
-# Copyright 2019-2022 Gentoo Authors
+# Copyright 2019-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: acct-user.eclass
@@ -44,9 +44,9 @@
 if [[ -z ${_ACCT_USER_ECLASS} ]]; then
 _ACCT_USER_ECLASS=1
 
-case ${EAPI:-0} in
+case ${EAPI} in
 	7|8) ;;
-	*) die "EAPI=${EAPI:-0} not supported";;
+	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
 inherit user-info
@@ -212,8 +212,6 @@ eislocked() {
 }
 
 # << Phase functions >>
-EXPORT_FUNCTIONS pkg_pretend src_install pkg_preinst pkg_postinst \
-	pkg_prerm
 
 # @FUNCTION: acct-user_pkg_pretend
 # @DESCRIPTION:
@@ -490,3 +488,5 @@ acct-user_pkg_prerm() {
 }
 
 fi
+
+EXPORT_FUNCTIONS pkg_pretend src_install pkg_preinst pkg_postinst pkg_prerm

diff --git a/eclass/ada.eclass b/eclass/ada.eclass
index 39f76854e4fc..eea41c0cff48 100644
--- a/eclass/ada.eclass
+++ b/eclass/ada.eclass
@@ -28,7 +28,8 @@ case ${EAPI} in
 	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
-EXPORT_FUNCTIONS pkg_setup
+if [[ -z ${_ADA_ECLASS} ]]; then
+_ADA_ECLASS=1
 
 # @ECLASS_VARIABLE: ADA_DEPS
 # @OUTPUT_VARIABLE
@@ -523,3 +524,7 @@ ada_pkg_setup() {
 
 	[[ ${MERGE_TYPE} != binary ]] && ada_setup
 }
+
+fi
+
+EXPORT_FUNCTIONS pkg_setup

diff --git a/eclass/ant-tasks.eclass b/eclass/ant-tasks.eclass
index 98a35dd40c4d..d599238ba253 100644
--- a/eclass/ant-tasks.eclass
+++ b/eclass/ant-tasks.eclass
@@ -1,4 +1,4 @@
-# Copyright 2007-2022 Gentoo Authors
+# Copyright 2007-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: ant-tasks.eclass
@@ -18,14 +18,15 @@ case ${EAPI} in
 	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
+if [[ -z ${_ANT_TASKS_ECLASS} ]]; then
+_ANT_TASKS_ECLASS=1
+
 # we set ant-core dep ourselves, restricted
 JAVA_ANT_DISABLE_ANT_CORE_DEP=true
 # rewriting build.xml for are the testcases has no reason atm
 JAVA_PKG_BSFIX_ALL=no
 inherit java-pkg-2 java-ant-2
 
-EXPORT_FUNCTIONS src_unpack src_compile src_install
-
 # @ECLASS_VARIABLE: ANT_TASK_JDKVER
 # @PRE_INHERIT
 # @DESCRIPTION:
@@ -164,3 +165,7 @@ ant-tasks_src_install() {
 	dodir /usr/share/ant/lib
 	dosym /usr/share/${PN}/lib/${PN}.jar /usr/share/ant/lib/${PN}.jar
 }
+
+fi
+
+EXPORT_FUNCTIONS src_unpack src_compile src_install

diff --git a/eclass/autotools.eclass b/eclass/autotools.eclass
index e93338ac6b97..3a9119856abc 100644
--- a/eclass/autotools.eclass
+++ b/eclass/autotools.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: autotools.eclass
@@ -13,6 +13,11 @@
 # Note: We require GNU m4, as does autoconf.  So feel free to use any features
 # from the GNU version of m4 without worrying about other variants (i.e. BSD).
 
+case ${EAPI} in
+	6|7|8) ;;
+	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
+esac
+
 if [[ ${_AUTOTOOLS_AUTO_DEPEND+set} == "set" ]] ; then
 	# See if we were included already, but someone changed the value
 	# of AUTOTOOLS_AUTO_DEPEND on us.  We could reload the entire
@@ -26,14 +31,7 @@ fi
 if [[ -z ${_AUTOTOOLS_ECLASS} ]] ; then
 _AUTOTOOLS_ECLASS=1
 
-case ${EAPI} in
-	6)
-		# Needed for eqawarn
-		inherit eutils
-		;;
-	7|8) ;;
-	*) die "${ECLASS}: EAPI ${EAPI} not supported" ;;
-esac
+[[ ${EAPI} == 6 ]] && inherit eqawarn
 
 inherit gnuconfig libtool
 

diff --git a/eclass/bzr.eclass b/eclass/bzr.eclass
index ba4ddad45f18..552990e3a581 100644
--- a/eclass/bzr.eclass
+++ b/eclass/bzr.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: bzr.eclass
@@ -21,15 +21,13 @@
 
 case ${EAPI} in
 	7|8) ;;
-	*) die "${ECLASS}: EAPI ${EAPI:-0} is not supported" ;;
+	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
 PROPERTIES+=" live"
 
 BDEPEND="dev-vcs/breezy"
 
-EXPORT_FUNCTIONS src_unpack
-
 # @ECLASS_VARIABLE: EBZR_STORE_DIR
 # @USER_VARIABLE
 # @DESCRIPTION:
@@ -255,3 +253,5 @@ bzr_fetch() {
 bzr_src_unpack() {
 	bzr_fetch
 }
+
+EXPORT_FUNCTIONS src_unpack

diff --git a/eclass/cargo.eclass b/eclass/cargo.eclass
index 911ddabced14..e3f36fc6ad9b 100644
--- a/eclass/cargo.eclass
+++ b/eclass/cargo.eclass
@@ -10,6 +10,11 @@
 # @SUPPORTED_EAPIS: 7 8
 # @BLURB: common functions and variables for cargo builds
 
+case ${EAPI} in
+	7|8) ;;
+	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
+esac
+
 if [[ -z ${_CARGO_ECLASS} ]]; then
 _CARGO_ECLASS=1
 
@@ -17,15 +22,11 @@ _CARGO_ECLASS=1
 # https://github.com/rust-lang/cargo/blob/master/CHANGELOG.md
 RUST_DEPEND="virtual/rust"
 
-case "${EAPI:-0}" in
-	0|1|2|3|4|5|6)
-		die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}"
-		;;
+case ${EAPI} in
 	7)
 		# 1.37 added 'cargo vendor' subcommand and net.offline config knob
 		RUST_DEPEND=">=virtual/rust-1.37.0"
 		;;
-
 	8)
 		# 1.39 added --workspace
 		# 1.46 added --target dir
@@ -40,17 +41,11 @@ case "${EAPI:-0}" in
 			die "CRATES variable not defined"
 		fi
 		;;
-	*)
-		die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}"
-		;;
 esac
 
 inherit multiprocessing toolchain-funcs
 
-if [[ ! ${CARGO_OPTIONAL} ]]; then
-	BDEPEND="${RUST_DEPEND}"
-	EXPORT_FUNCTIONS src_unpack src_configure src_compile src_install src_test
-fi
+[[ ! ${CARGO_OPTIONAL} ]] && BDEPEND="${RUST_DEPEND}"
 
 IUSE="${IUSE} debug"
 
@@ -549,3 +544,7 @@ cargo_src_test() {
 }
 
 fi
+
+if [[ ! ${CARGO_OPTIONAL} ]]; then
+	EXPORT_FUNCTIONS src_unpack src_configure src_compile src_install src_test
+fi

diff --git a/eclass/check-reqs.eclass b/eclass/check-reqs.eclass
index ddf0a47775ae..f6409e9a02c5 100644
--- a/eclass/check-reqs.eclass
+++ b/eclass/check-reqs.eclass
@@ -1,4 +1,4 @@
-# Copyright 2004-2022 Gentoo Authors
+# Copyright 2004-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: check-reqs.eclass
@@ -40,12 +40,10 @@
 
 case ${EAPI} in
 	6|7|8) ;;
-	*) die "${ECLASS}: EAPI=${EAPI:-0} is not supported" ;;
+	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
-EXPORT_FUNCTIONS pkg_pretend pkg_setup
-
-if [[ ! ${_CHECK_REQS_ECLASS} ]]; then
+if [[ -z ${_CHECK_REQS_ECLASS} ]]; then
 _CHECK_REQS_ECLASS=1
 
 # @ECLASS_VARIABLE: CHECKREQS_MEMORY
@@ -467,3 +465,5 @@ _check-reqs_unsatisfied() {
 }
 
 fi
+
+EXPORT_FUNCTIONS pkg_pretend pkg_setup

diff --git a/eclass/chromium-2.eclass b/eclass/chromium-2.eclass
index cd4495767e58..0831f1f17aa5 100644
--- a/eclass/chromium-2.eclass
+++ b/eclass/chromium-2.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: chromium-2.eclass
@@ -11,7 +11,7 @@
 
 case ${EAPI} in
 	7|8) ;;
-	*) die "${ECLASS}: EAPI=${EAPI:-0} is not supported" ;;
+	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
 inherit linux-info

diff --git a/eclass/cmake-multilib.eclass b/eclass/cmake-multilib.eclass
index 4dd3eab3cd28..c8fad94ac0a9 100644
--- a/eclass/cmake-multilib.eclass
+++ b/eclass/cmake-multilib.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: cmake-multilib.eclass
@@ -36,7 +36,7 @@ case ${EAPI} in
 				;;
 		esac
 		;;
-	*) die "${ECLASS}: EAPI=${EAPI:-0} is not supported" ;;
+	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
 if [[ ${CMAKE_IN_SOURCE_BUILD} ]]; then

diff --git a/eclass/cmake.eclass b/eclass/cmake.eclass
index 46659867b1a8..76c63977aa07 100644
--- a/eclass/cmake.eclass
+++ b/eclass/cmake.eclass
@@ -20,7 +20,7 @@
 
 case ${EAPI} in
 	7|8) ;;
-	*) die "${ECLASS}: EAPI=${EAPI:-0} is not supported" ;;
+	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
 if [[ -z ${_CMAKE_ECLASS} ]]; then

diff --git a/eclass/common-lisp-3.eclass b/eclass/common-lisp-3.eclass
index df624d51607c..6c87ef3db842 100644
--- a/eclass/common-lisp-3.eclass
+++ b/eclass/common-lisp-3.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: common-lisp-3.eclass
@@ -11,15 +11,15 @@
 # to provide a simple way to write ebuilds with these characteristics.
 
 case ${EAPI} in
-	[67]) ;;
-	*) die "EAPI=${EAPI:-0} is not supported" ;;
+	6|7) ;;
+	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
-inherit eutils
-
 if [[ -z ${_COMMON_LISP_3_ECLASS} ]]; then
 _COMMON_LISP_3_ECLASS=1
 
+inherit eutils
+
 # @ECLASS_VARIABLE: CLIMPLEMENTATIONS
 # @DESCRIPTION:
 # Common Lisp implementations

diff --git a/eclass/cuda.eclass b/eclass/cuda.eclass
index 81c8c1f2fc59..d885e77d0616 100644
--- a/eclass/cuda.eclass
+++ b/eclass/cuda.eclass
@@ -1,17 +1,6 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-case "${EAPI:-0}" in
-	[0-6])
-		die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}"
-		;;
-	7|8)
-		;;
-	*)
-		die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}"
-		;;
-esac
-
 # @ECLASS: cuda.eclass
 # @MAINTAINER:
 # Gentoo Science Project <sci@gentoo.org>
@@ -25,10 +14,15 @@ esac
 # @EXAMPLE:
 # inherit cuda
 
+case ${EAPI} in
+	7|8) ;;
+	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
+esac
+
 if [[ -z ${_CUDA_ECLASS} ]]; then
+_CUDA_ECLASS=1
 
 inherit flag-o-matic toolchain-funcs
-[[ ${EAPI} == [56] ]] && inherit eapi7-ver
 
 # @ECLASS_VARIABLE: NVCCFLAGS
 # @DESCRIPTION:
@@ -195,7 +189,6 @@ cuda_src_prepare() {
 	cuda_sanitize
 }
 
-EXPORT_FUNCTIONS src_prepare
-
-_CUDA_ECLASS=1
 fi
+
+EXPORT_FUNCTIONS src_prepare

diff --git a/eclass/cvs.eclass b/eclass/cvs.eclass
index a90a4d87f1c5..5ba2197f5174 100644
--- a/eclass/cvs.eclass
+++ b/eclass/cvs.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: cvs.eclass
@@ -13,14 +13,14 @@
 # cvs_src_unpack. If you find that you need to call the cvs_* functions
 # directly, I'd be interested to hear about it.
 
-if [[ -z ${_CVS_ECLASS} ]]; then
-_CVS_ECLASS=1
-
 case ${EAPI} in
 	7|8) ;;
 	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
+if [[ -z ${_CVS_ECLASS} ]]; then
+_CVS_ECLASS=1
+
 # TODO:
 
 # Implement more auth types (gserver?, kserver?)
@@ -536,6 +536,6 @@ cvs_src_unpack() {
 	einfo "CVS module ${ECVS_MODULE} is now in ${WORKDIR}"
 }
 
-EXPORT_FUNCTIONS src_unpack
-
 fi
+
+EXPORT_FUNCTIONS src_unpack

diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index 95911f912ca0..78f53658285e 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -44,9 +44,9 @@
 # For more information, please see the Python Guide:
 # https://projects.gentoo.org/python/guide/
 
-case ${EAPI:-0} in
+case ${EAPI} in
 	7|8) ;;
-	*) die "EAPI=${EAPI:-0} not supported";;
+	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
 # @ECLASS_VARIABLE: DISTUTILS_OPTIONAL
@@ -169,7 +169,8 @@ esac
 #     ${DISTUTILS_DEPS}"
 # @CODE
 
-if [[ ! ${_DISTUTILS_R1} ]]; then
+if [[ -z ${_DISTUTILS_R1_ECLASS} ]]; then
+_DISTUTILS_R1_ECLASS=1
 
 inherit multibuild multilib multiprocessing ninja-utils toolchain-funcs
 
@@ -179,14 +180,6 @@ else
 	inherit python-single-r1
 fi
 
-fi
-
-if [[ ! ${DISTUTILS_OPTIONAL} ]]; then
-	EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test src_install
-fi
-
-if [[ ! ${_DISTUTILS_R1} ]]; then
-
 _distutils_set_globals() {
 	local rdep bdep
 	if [[ ${DISTUTILS_USE_PEP517} ]]; then
@@ -2107,5 +2100,8 @@ distutils-r1_src_install() {
 	return ${ret}
 }
 
-_DISTUTILS_R1=1
+fi
+
+if [[ ! ${DISTUTILS_OPTIONAL} ]]; then
+	EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test src_install
 fi

diff --git a/eclass/docs.eclass b/eclass/docs.eclass
index cbf35068de3a..810b56460f3f 100644
--- a/eclass/docs.eclass
+++ b/eclass/docs.eclass
@@ -146,7 +146,7 @@ esac
 # will initialize a dummy git repository before compiling. A dependency
 # on dev-vcs/git is automatically added.
 
-if [[ ! ${_DOCS_ECLASS} ]]; then
+if [[ -z ${_DOCS_ECLASS} ]]; then
 _DOCS_ECLASS=1
 
 # For the python based DOCS_BUILDERS we need to inherit any python eclass
@@ -424,7 +424,7 @@ BDEPEND+=" doc? ( ${DOCS_DEPEND} )"
 # then put the compile function in the specific
 # python function, else docs_compile should be manually
 # added to src_compile
-if [[ ${_DISTUTILS_R1} && ( ${DOCS_BUILDER}="mkdocs" || ${DOCS_BUILDER}="sphinx" ) ]]; then
+if [[ ${_DISTUTILS_R1_ECLASS} && ( ${DOCS_BUILDER}="mkdocs" || ${DOCS_BUILDER}="sphinx" ) ]]; then
 	python_compile_all() { docs_compile; }
 fi
 

diff --git a/eclass/ecm.eclass b/eclass/ecm.eclass
index d9215a534398..9fca1647778c 100644
--- a/eclass/ecm.eclass
+++ b/eclass/ecm.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: ecm.eclass
@@ -23,7 +23,7 @@
 
 case ${EAPI} in
 	8) ;;
-	*) die "${ECLASS}: EAPI=${EAPI:-0} is not supported" ;;
+	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
 if [[ -z ${_ECM_ECLASS} ]]; then

diff --git a/eclass/elisp.eclass b/eclass/elisp.eclass
index 7c05948c0f57..9d157c23d5b1 100644
--- a/eclass/elisp.eclass
+++ b/eclass/elisp.eclass
@@ -1,4 +1,4 @@
-# Copyright 2002-2022 Gentoo Authors
+# Copyright 2002-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: elisp.eclass
@@ -69,9 +69,6 @@ case ${EAPI} in
 	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
-EXPORT_FUNCTIONS src_{unpack,prepare,configure,compile,install} \
-	pkg_{setup,postinst,postrm}
-
 RDEPEND=">=app-editors/emacs-${NEED_EMACS}:*"
 BDEPEND="${RDEPEND}"
 
@@ -189,3 +186,6 @@ elisp_pkg_postinst() {
 elisp_pkg_postrm() {
 	elisp-site-regen
 }
+
+EXPORT_FUNCTIONS src_{unpack,prepare,configure,compile,install} \
+	pkg_{setup,postinst,postrm}

diff --git a/eclass/fcaps.eclass b/eclass/fcaps.eclass
index 349e72a63af2..477e1e954ab8 100644
--- a/eclass/fcaps.eclass
+++ b/eclass/fcaps.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: fcaps.eclass
@@ -191,6 +191,6 @@ fcaps_pkg_postinst() {
 	done
 }
 
-EXPORT_FUNCTIONS pkg_postinst
-
 fi
+
+EXPORT_FUNCTIONS pkg_postinst

diff --git a/eclass/font-ebdftopcf.eclass b/eclass/font-ebdftopcf.eclass
index 88256c3231bd..afd77e083bee 100644
--- a/eclass/font-ebdftopcf.eclass
+++ b/eclass/font-ebdftopcf.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: font-ebdftopcf.eclass
@@ -14,11 +14,9 @@
 
 case ${EAPI} in
 	7) ;;
-	*) die "EAPI=${EAPI:-0} is not supported" ;;
+	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
-EXPORT_FUNCTIONS src_compile
-
 if [[ -z ${_FONT_EBDFTOPCF_ECLASS} ]]; then
 _FONT_EBDFTOPCF_ECLASS=1
 
@@ -57,3 +55,5 @@ font-ebdftopcf_src_compile() {
 }
 
 fi
+
+EXPORT_FUNCTIONS src_compile

diff --git a/eclass/font.eclass b/eclass/font.eclass
index e772409fe201..3d2578172bc9 100644
--- a/eclass/font.eclass
+++ b/eclass/font.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: font.eclass
@@ -7,16 +7,14 @@
 # @SUPPORTED_EAPIS: 7 8
 # @BLURB: Eclass to make font installation uniform
 
-case ${EAPI:-0} in
-	[7-8]) ;;
-	*) die "EAPI ${EAPI} is not supported by font.eclass." ;;
+case ${EAPI} in
+	7|8) ;;
+	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
-if [[ ! ${_FONT_ECLASS} ]]; then
+if [[ -z ${_FONT_ECLASS} ]]; then
 _FONT_ECLASS=1
 
-EXPORT_FUNCTIONS pkg_setup src_install pkg_postinst pkg_postrm
-
 # @ECLASS_VARIABLE: FONT_SUFFIX
 # @DEFAULT_UNSET
 # @REQUIRED
@@ -264,3 +262,5 @@ font_pkg_postrm() {
 }
 
 fi
+
+EXPORT_FUNCTIONS pkg_setup src_install pkg_postinst pkg_postrm

diff --git a/eclass/fortran-2.eclass b/eclass/fortran-2.eclass
index e26dd700f7cf..72b3d2d1857b 100644
--- a/eclass/fortran-2.eclass
+++ b/eclass/fortran-2.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: fortran-2.eclass
@@ -26,18 +26,15 @@
 #
 # FORTRAN_NEED_OPENMP=1
 
-inherit toolchain-funcs
-
-case ${EAPI:-0} in
-	# not used in the eclass, but left for backward compatibility with legacy users
-	5|6) inherit eutils ;;
-	7|8) ;;
-	*) die "EAPI=${EAPI} is not supported" ;;
+case ${EAPI} in
+	6|7|8) ;;
+	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
-EXPORT_FUNCTIONS pkg_setup
+if [[ -z ${_FORTRAN_2_ECLASS} ]]; then
+_FORTRAN_2_ECLASS=1
 
-if [[ ! ${_FORTRAN_2_CLASS} ]]; then
+inherit toolchain-funcs
 
 # @ECLASS_VARIABLE: FORTRAN_NEED_OPENMP
 # @DESCRIPTION:
@@ -293,5 +290,6 @@ fortran-2_pkg_setup() {
 	fi
 }
 
-_FORTRAN_2_ECLASS=1
 fi
+
+EXPORT_FUNCTIONS pkg_setup

diff --git a/eclass/frameworks.kde.org.eclass b/eclass/frameworks.kde.org.eclass
index 876c05c9b6af..5201464a76c8 100644
--- a/eclass/frameworks.kde.org.eclass
+++ b/eclass/frameworks.kde.org.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: frameworks.kde.org.eclass
@@ -19,7 +19,7 @@
 
 case ${EAPI} in
 	8) ;;
-	*) die "EAPI=${EAPI:-0} is not supported" ;;
+	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
 if [[ -z ${_FRAMEWORKS_KDE_ORG_ECLASS} ]]; then

diff --git a/eclass/freedict.eclass b/eclass/freedict.eclass
index f38ce93edc82..7a49a5f19778 100644
--- a/eclass/freedict.eclass
+++ b/eclass/freedict.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: freedict.eclass
@@ -12,6 +12,11 @@
 # This eclass exists to ease the installation of freedict translation
 # dictionaries.
 
+case ${EAPI} in
+	7) ;;
+	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
+esac
+
 if [[ -z ${_FREEDICT_ECLASS} ]]; then
 _FREEDICT_ECLASS=1
 
@@ -20,11 +25,6 @@ _FREEDICT_ECLASS=1
 # Strips PN of 'freedict' prefix, to be used in SRC_URI and doins
 FREEDICT_P=${PN/freedict-/}
 
-case ${EAPI:-0} in
-	7) ;;
-	*) die "${ECLASS}.eclass is banned in EAPI=${EAPI}" ;;
-esac
-
 [[ ${FORLANG} ]] && die "FORLANG is banned, set DESCRIPTION instead"
 [[ ${TOLANG} ]] && die "TOLANG is banned, set DESCRIPTION instead"
 
@@ -47,6 +47,6 @@ freedict_src_install() {
 	doins ${FREEDICT_P}.index
 }
 
-EXPORT_FUNCTIONS src_install
-
 fi
+
+EXPORT_FUNCTIONS src_install

diff --git a/eclass/gear.kde.org.eclass b/eclass/gear.kde.org.eclass
index 66c86b59fa32..5977c0f72e3c 100644
--- a/eclass/gear.kde.org.eclass
+++ b/eclass/gear.kde.org.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: gear.kde.org.eclass
@@ -19,7 +19,7 @@
 
 case ${EAPI} in
 	8) ;;
-	*) die "EAPI=${EAPI:-0} is not supported" ;;
+	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
 if [[ -z ${_GEAR_KDE_ORG_ECLASS} ]]; then

diff --git a/eclass/gnustep-2.eclass b/eclass/gnustep-2.eclass
index e1d7f00da080..9750efa8d5c8 100644
--- a/eclass/gnustep-2.eclass
+++ b/eclass/gnustep-2.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: gnustep-2.eclass
@@ -33,7 +33,7 @@ esac
 DEPEND+=" virtual/gnustep-back"
 RDEPEND="${DEPEND}"
 
-# The following gnustep-based EXPORT_FUNCTIONS are available:
+# The following gnustep-based exported functions are available:
 # * gnustep-base_pkg_setup
 # * gnustep-base_src_prepare
 # * gnustep-base_src_configure

diff --git a/eclass/go-module.eclass b/eclass/go-module.eclass
index 6bba9542cfc8..5cffbb1084d9 100644
--- a/eclass/go-module.eclass
+++ b/eclass/go-module.eclass
@@ -65,11 +65,10 @@ case ${EAPI} in
 	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
-inherit multiprocessing toolchain-funcs
-
-if [[ -z ${_GO_MODULE} ]]; then
+if [[ -z ${_GO_MODULE_ECLASS} ]]; then
+_GO_MODULE_ECLASS=1
 
-_GO_MODULE=1
+inherit multiprocessing toolchain-funcs
 
 if [[ ! ${GO_OPTIONAL} ]]; then
 	BDEPEND=">=dev-lang/go-1.18"
@@ -79,8 +78,6 @@ if [[ ! ${GO_OPTIONAL} ]]; then
 	# Added here rather than to each affected package, so it can be cleaned up just
 	# once when pkgcheck is improved.
 	BDEPEND+=" app-arch/unzip"
-
-	EXPORT_FUNCTIONS src_unpack
 fi
 
 # Force go to build in module mode.
@@ -526,3 +523,7 @@ _go-module_gomod_encode() {
 }
 
 fi
+
+if [[ ! ${GO_OPTIONAL} ]]; then
+	EXPORT_FUNCTIONS src_unpack
+fi

diff --git a/eclass/haskell-cabal.eclass b/eclass/haskell-cabal.eclass
index 086e05426cda..12251a268b45 100644
--- a/eclass/haskell-cabal.eclass
+++ b/eclass/haskell-cabal.eclass
@@ -41,15 +41,16 @@
 #                  is fixed.
 
 case ${EAPI} in
-	# eutils is for eqawarn
-	6|7) inherit eutils ;;
-	8) ;;
+	6|7|8) ;;
 	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
-inherit ghc-package multilib toolchain-funcs
+if [[ -z ${_HASKELL_CABAL_ECLASS} ]]; then
+_HASKELL_CABAL_ECLASS=1
 
-EXPORT_FUNCTIONS pkg_setup src_prepare src_configure src_compile src_test src_install pkg_postinst pkg_postrm
+[[ ${EAPI} == 6 ]] && inherit eqawarn
+
+inherit ghc-package multilib toolchain-funcs
 
 # @ECLASS_VARIABLE: CABAL_EXTRA_CONFIGURE_FLAGS
 # @USER_VARIABLE
@@ -910,3 +911,7 @@ replace-hcflags() {
 
 	return 0
 }
+
+fi
+
+EXPORT_FUNCTIONS pkg_setup src_prepare src_configure src_compile src_test src_install pkg_postinst pkg_postrm

diff --git a/eclass/java-ant-2.eclass b/eclass/java-ant-2.eclass
index c0c94f15e338..61a90f3f3196 100644
--- a/eclass/java-ant-2.eclass
+++ b/eclass/java-ant-2.eclass
@@ -15,18 +15,16 @@
 # manual manipulation of build.xml files. Should be inherited after java-pkg-2
 # or java-pkg-opt-2 eclass.
 
-inherit java-utils-2 multilib
-
-case ${EAPI:-0} in
-	[678]) ;;
+case ${EAPI} in
+	6|7|8) ;;
 	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
-EXPORT_FUNCTIONS src_configure
-
 if [[ -z ${_JAVA_ANT_2_ECLASS} ]] ; then
 _JAVA_ANT_2_ECLASS=1
 
+inherit java-utils-2 multilib
+
 # This eclass provides functionality for Java packages which use
 # ant to build. In particular, it will attempt to fix build.xml files, so that
 # they use the appropriate 'target' and 'source' attributes.
@@ -439,3 +437,5 @@ java-ant_rewrite-bootclasspath() {
 }
 
 fi
+
+EXPORT_FUNCTIONS src_configure

diff --git a/eclass/java-vm-2.eclass b/eclass/java-vm-2.eclass
index ad814d7efd1a..01bbcf697fb4 100644
--- a/eclass/java-vm-2.eclass
+++ b/eclass/java-vm-2.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: java-vm-2.eclass
@@ -10,14 +10,15 @@
 # This eclass provides functionality which assists with installing
 # virtual machines, and ensures that they are recognized by java-config.
 
-case ${EAPI:-0} in
-	[678]) ;;
-	*) die "EAPI=${EAPI} is not supported" ;;
+case ${EAPI} in
+	6|7|8) ;;
+	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
-inherit multilib pax-utils prefix xdg-utils
+if [[ -z ${_JAVA_VM_2_ECLASS} ]]; then
+_JAVA_VM_2_ECLASS=1
 
-EXPORT_FUNCTIONS pkg_setup pkg_postinst pkg_prerm pkg_postrm
+inherit multilib pax-utils prefix xdg-utils
 
 RDEPEND="
 	dev-java/java-config
@@ -350,3 +351,7 @@ java-vm_sandbox-predict() {
 	echo "SANDBOX_PREDICT=\"${path}\"" > "${ED}/etc/sandbox.d/20${VMHANDLE}" \
 		|| die "Failed to write sandbox control file"
 }
+
+fi
+
+EXPORT_FUNCTIONS pkg_setup pkg_postinst pkg_prerm pkg_postrm

diff --git a/eclass/kde.org.eclass b/eclass/kde.org.eclass
index efe3186f286c..629c57d9a082 100644
--- a/eclass/kde.org.eclass
+++ b/eclass/kde.org.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: kde.org.eclass
@@ -17,7 +17,7 @@
 
 case ${EAPI} in
 	8) ;;
-	*) die "EAPI=${EAPI:-0} is not supported" ;;
+	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
 if [[ -z ${_KDE_ORG_ECLASS} ]]; then

diff --git a/eclass/kodi-addon.eclass b/eclass/kodi-addon.eclass
index 6e7fa26f3c8a..b7678485795e 100644
--- a/eclass/kodi-addon.eclass
+++ b/eclass/kodi-addon.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: kodi-addon.eclass
@@ -17,8 +17,6 @@ esac
 
 inherit cmake
 
-EXPORT_FUNCTIONS src_configure
-
 # @FUNCTION: kodi-addon_src_configure
 # @DESCRIPTION:
 # Configure handling for Kodi addons
@@ -30,3 +28,5 @@ kodi-addon_src_configure() {
 
 	cmake_src_configure
 }
+
+EXPORT_FUNCTIONS src_configure

diff --git a/eclass/llvm.org.eclass b/eclass/llvm.org.eclass
index c97eaae1fc63..b182f08c5468 100644
--- a/eclass/llvm.org.eclass
+++ b/eclass/llvm.org.eclass
@@ -30,12 +30,9 @@
 # llvm.org_set_globals
 # @CODE
 
-case "${EAPI:-0}" in
-	7|8)
-		;;
-	*)
-		die "Unsupported EAPI=${EAPI} for ${ECLASS}"
-		;;
+case ${EAPI} in
+	7|8) ;;
+	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
 # == version substrings ==
@@ -325,8 +322,6 @@ llvm.org_set_globals() {
 
 # == phase functions ==
 
-EXPORT_FUNCTIONS src_unpack src_prepare
-
 # @FUNCTION: llvm.org_src_unpack
 # @DESCRIPTION:
 # Unpack or checkout requested LLVM components.
@@ -472,3 +467,5 @@ llvm_install_manpages() {
 		doins "${WORKDIR}/llvm-${PV}-manpages/${LLVM_COMPONENTS[0]}"/*.1
 	fi
 }
+
+EXPORT_FUNCTIONS src_unpack src_prepare

diff --git a/eclass/lua-single.eclass b/eclass/lua-single.eclass
index aadd3b4ea675..8432df0583bb 100644
--- a/eclass/lua-single.eclass
+++ b/eclass/lua-single.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: lua-single.eclass
@@ -64,23 +64,19 @@
 # @CODE
 
 case ${EAPI} in
-	7|8)
-		;;
+	7|8) ;;
 	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
-if [[ ! ${_LUA_SINGLE_R0} ]]; then
+if [[ -z ${_LUA_SINGLE_ECLASS} ]]; then
+_LUA_SINGLE_ECLASS=1
 
-if [[ ${_LUA_R0} ]]; then
+if [[ ${_LUA_ECLASS} ]]; then
 	die 'lua-single.eclass cannot be used with lua.eclass.'
 fi
 
 inherit lua-utils
 
-fi
-
-EXPORT_FUNCTIONS pkg_setup
-
 # @ECLASS_VARIABLE: LUA_COMPAT
 # @REQUIRED
 # @PRE_INHERIT
@@ -276,8 +272,6 @@ _lua_single_set_globals() {
 _lua_single_set_globals
 unset -f _lua_single_set_globals
 
-if [[ ! ${_LUA_SINGLE_R0} ]]; then
-
 # @FUNCTION: _lua_gen_usedep
 # @USAGE: [<pattern>...]
 # @INTERNAL
@@ -532,5 +526,6 @@ lua-single_pkg_setup() {
 	[[ ${MERGE_TYPE} != binary ]] && lua_setup
 }
 
-_LUA_SINGLE_R0=1
 fi
+
+EXPORT_FUNCTIONS pkg_setup

diff --git a/eclass/lua-utils.eclass b/eclass/lua-utils.eclass
index 475bd993894b..0ff36734dc8f 100644
--- a/eclass/lua-utils.eclass
+++ b/eclass/lua-utils.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: lua-utils.eclass
@@ -18,12 +18,12 @@
 # functions. It can be inherited safely.
 
 case ${EAPI} in
-	7|8)
-		;;
+	7|8) ;;
 	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
-if [[ ! ${_LUA_UTILS_R0} ]]; then
+if [[ -z ${_LUA_UTILS_ECLASS} ]]; then
+_LUA_UTILS_ECLASS=1
 
 inherit toolchain-funcs
 
@@ -384,7 +384,7 @@ lua_enable_tests() {
 		busted)
 			test_directory="${2:-spec}"
 			test_pkg="dev-lua/busted"
-			if [[ ! ${_LUA_SINGLE_R0} ]]; then
+			if [[ ! ${_LUA_SINGLE_ECLASS} ]]; then
 				eval "lua_src_test() {
 					busted --lua=\"\${ELUA}\" --output=\"plainTerminal\" \"${test_directory}\" || die \"Tests fail with \${ELUA}\"
 				}"
@@ -403,7 +403,7 @@ lua_enable_tests() {
 
 	local test_deps=${RDEPEND}
 	if [[ -n ${test_pkg} ]]; then
-		if [[ ! ${_LUA_SINGLE_R0} ]]; then
+		if [[ ! ${_LUA_SINGLE_ECLASS} ]]; then
 			test_deps+=" ${test_pkg}[${LUA_USEDEP}]"
 		else
 			test_deps+=" $(lua_gen_cond_dep "
@@ -536,5 +536,4 @@ lua_get_version() {
 	echo "${LUA_VERSION}"
 }
 
-_LUA_UTILS_R0=1
 fi

diff --git a/eclass/lua.eclass b/eclass/lua.eclass
index 29b8b6ec6348..bb2e41ef1061 100644
--- a/eclass/lua.eclass
+++ b/eclass/lua.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: lua.eclass
@@ -52,21 +52,19 @@
 # @CODE
 
 case ${EAPI} in
-	7|8)
-		;;
+	7|8) ;;
 	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
-if [[ ! ${_LUA_R0} ]]; then
+if [[ -z ${_LUA_ECLASS} ]]; then
+_LUA_ECLASS=1
 
-if [[ ${_LUA_SINGLE_R0} ]]; then
+if [[ ${_LUA_SINGLE_ECLASS} ]]; then
 	die 'lua.eclass cannot be used with lua-single.eclass.'
 fi
 
 inherit multibuild lua-utils
 
-fi
-
 # @ECLASS_VARIABLE: LUA_COMPAT
 # @REQUIRED
 # @PRE_INHERIT
@@ -197,8 +195,6 @@ fi
 # lua_targets_lua5-1(-)?,lua_targets_lua5-3(-)?
 # @CODE
 
-if [[ ! ${_LUA_R0} ]]; then
-
 # @FUNCTION: _lua_validate_useflags
 # @INTERNAL
 # @DESCRIPTION:
@@ -314,9 +310,6 @@ lua_foreach_impl() {
 	multibuild_foreach_variant _lua_multibuild_wrapper "${@}"
 }
 
-_LUA_R0=1
-fi
-
 # @FUNCTION: _lua_set_globals
 # @INTERNAL
 # @DESCRIPTION:
@@ -375,3 +368,5 @@ _lua_set_globals() {
 
 _lua_set_globals
 unset -f _lua_set_globals
+
+fi

diff --git a/eclass/mate-desktop.org.eclass b/eclass/mate-desktop.org.eclass
index 2e45d864dd74..875e4615773c 100644
--- a/eclass/mate-desktop.org.eclass
+++ b/eclass/mate-desktop.org.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: mate-desktop.org.eclass
@@ -12,12 +12,14 @@
 # Provide a default SRC_URI and EGIT_REPO_URI for MATE packages as well as
 # exporting some useful values like the MATE_BRANCH
 
-# EAPIs < 7 are banned.
-case "${EAPI:-0}" in
+case ${EAPI} in
 	7) ;;
-	*) die "EAPI=${EAPI:-0} is not supported" ;;
+	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
+if [[ -z ${_MATE_DESKTOP_ORG_ECLASS} ]]; then
+_MATE_DESKTOP_ORG_ECLASS=1
+
 if [[ ${PV} == 9999 ]]; then
 	inherit git-r3
 fi
@@ -57,3 +59,5 @@ fi
 
 # Set HOMEPAGE for all ebuilds
 HOMEPAGE="https://mate-desktop.org"
+
+fi

diff --git a/eclass/mate.eclass b/eclass/mate.eclass
index c1886648140e..388cdf2f827d 100644
--- a/eclass/mate.eclass
+++ b/eclass/mate.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: mate.eclass
@@ -15,12 +15,14 @@
 # MATE framework. Occassionally acts as a wrapper to gnome2 due to the
 # fact that MATE is a GNOME fork. For additional functions, see gnome2-utils.eclass.
 
-# Check EAPI only
-case "${EAPI:-0}" in
+case ${EAPI} in
 	7) ;;
-	*) die "EAPI=${EAPI:-0} is not supported" ;;
+	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
+if [[ -z ${_MATE_ECLASS} ]]; then
+_MATE_ECLASS=1
+
 # Inherit happens below after declaration of GNOME2_LA_PUNT
 
 # @ECLASS_VARIABLE: MATE_LA_PUNT
@@ -157,4 +159,6 @@ mate_pkg_postrm() {
 	gnome2_pkg_postrm "$@"
 }
 
+fi
+
 EXPORT_FUNCTIONS src_prepare src_configure src_install pkg_preinst pkg_postinst pkg_postrm

diff --git a/eclass/meson-multilib.eclass b/eclass/meson-multilib.eclass
index 49c64418727e..0c069af11930 100644
--- a/eclass/meson-multilib.eclass
+++ b/eclass/meson-multilib.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: meson-multilib.eclass
@@ -31,8 +31,6 @@ _MESON_MULTILIB_ECLASS=1
 
 inherit meson multilib-minimal
 
-EXPORT_FUNCTIONS src_configure src_compile src_test src_install
-
 # @FUNCTION: meson_native_use_bool
 # @USAGE: <USE flag> [option name]
 # @DESCRIPTION:
@@ -130,3 +128,5 @@ multilib_src_install() {
 }
 
 fi
+
+EXPORT_FUNCTIONS src_configure src_compile src_test src_install

diff --git a/eclass/meson.eclass b/eclass/meson.eclass
index a79019ccfd35..881e24700053 100644
--- a/eclass/meson.eclass
+++ b/eclass/meson.eclass
@@ -1,4 +1,4 @@
-# Copyright 2017-2022 Gentoo Authors
+# Copyright 2017-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: meson.eclass
@@ -44,8 +44,6 @@ _MESON_ECLASS=1
 
 inherit multiprocessing ninja-utils python-utils-r1 toolchain-funcs
 
-EXPORT_FUNCTIONS src_configure src_compile src_test src_install
-
 BDEPEND=">=dev-util/meson-0.62.2
 	${NINJA_DEPEND}
 	dev-util/meson-format-array
@@ -449,3 +447,5 @@ meson_src_install() {
 }
 
 fi
+
+EXPORT_FUNCTIONS src_configure src_compile src_test src_install

diff --git a/eclass/mount-boot.eclass b/eclass/mount-boot.eclass
index 3111d9dcb9b5..73beb9adea67 100644
--- a/eclass/mount-boot.eclass
+++ b/eclass/mount-boot.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: mount-boot.eclass
@@ -13,13 +13,11 @@
 # function tries to ensure that it's mounted in rw mode, exiting with an
 # error if it can't.  It does nothing if /boot isn't a separate partition.
 
-case ${EAPI:-0} in
+case ${EAPI} in
 	6|7|8) ;;
 	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
-EXPORT_FUNCTIONS pkg_pretend pkg_preinst pkg_postinst pkg_prerm pkg_postrm
-
 # @FUNCTION: mount-boot_is_disabled
 # @INTERNAL
 # @DESCRIPTION:
@@ -111,3 +109,5 @@ mount-boot_pkg_prerm() {
 mount-boot_pkg_postinst() { :; }
 
 mount-boot_pkg_postrm() { :; }
+
+EXPORT_FUNCTIONS pkg_pretend pkg_preinst pkg_postinst pkg_prerm pkg_postrm

diff --git a/eclass/myspell-r2.eclass b/eclass/myspell-r2.eclass
index 965327ac1b58..05d48dc97dee 100644
--- a/eclass/myspell-r2.eclass
+++ b/eclass/myspell-r2.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: myspell-r2.eclass
@@ -37,15 +37,10 @@
 # @CODE
 
 case ${EAPI} in
-	7|8)
-		;;
-	*)
-		die "${ECLASS}: EAPI ${EAPI:-0} not supported"
-		;;
+	7|8) ;;
+	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
-EXPORT_FUNCTIONS src_unpack src_install
-
 # Basically no extra deps needed.
 # Unzip is required for .oxt libreoffice extensions
 # which are just fancy zip files.
@@ -133,3 +128,5 @@ myspell-r2_src_install() {
 		fi
 	done
 }
+
+EXPORT_FUNCTIONS src_unpack src_install

diff --git a/eclass/netsurf.eclass b/eclass/netsurf.eclass
index 07b5ab3b5284..293f439e9715 100644
--- a/eclass/netsurf.eclass
+++ b/eclass/netsurf.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: netsurf.eclass
@@ -9,9 +9,9 @@
 # @DESCRIPTION:
 # Handle settings build environment for netsurf build system
 
-case "${EAPI:-0}" in
+case ${EAPI} in
     7) ;;
-    *) die "EAPI=${EAPI} is not supported" ;;
+    *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
 inherit toolchain-funcs

diff --git a/eclass/optfeature.eclass b/eclass/optfeature.eclass
index b44fc1b85251..c8b4911320d3 100644
--- a/eclass/optfeature.eclass
+++ b/eclass/optfeature.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: optfeature.eclass
@@ -9,7 +9,7 @@
 
 case ${EAPI} in
 	7|8) ;;
-	*) die "${ECLASS}: EAPI=${EAPI:-0} is not supported" ;;
+	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
 if [[ -z ${_OPTFEATURE_ECLASS} ]]; then

diff --git a/eclass/out-of-source.eclass b/eclass/out-of-source.eclass
index 06de39e6fc60..dd54c8933d4e 100644
--- a/eclass/out-of-source.eclass
+++ b/eclass/out-of-source.eclass
@@ -34,10 +34,10 @@
 
 case ${EAPI} in
 	7|8);;
-	*) die "EAPI ${EAPI:-0} unsupported (too old)";;
+	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
-if [[ ! ${_OUT_OF_SOURCE_ECLASS} ]]; then
+if [[ -z ${_OUT_OF_SOURCE_ECLASS} ]]; then
 _OUT_OF_SOURCE_ECLASS=1
 
 # @ECLASS_VARIABLE: BUILD_DIR

diff --git a/eclass/php-pear-r2.eclass b/eclass/php-pear-r2.eclass
index 2d204ed24c3c..29bcf1e6fce8 100644
--- a/eclass/php-pear-r2.eclass
+++ b/eclass/php-pear-r2.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: php-pear-r2.eclass
@@ -14,20 +14,16 @@
 # Note that this eclass doesn't handle dependencies of PEAR packages
 # on purpose; please use (R)DEPEND to define them correctly!
 
-EXPORT_FUNCTIONS src_install pkg_postinst pkg_postrm
-
-case "${EAPI:-0}" in
-	6|7)
-		;;
-	8)
-		IDEPEND=">=dev-php/pear-1.8.1"
-		;;
-	*)
-		die "Unsupported EAPI=${EAPI} for ${ECLASS}"
-		;;
+case ${EAPI} in
+	6|7|8) ;;
+	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
+if [[ -z ${_PHP_PEAR_R2_ECLASS} ]]; then
+_PHP_PEAR_R2_ECLASS=1
+
 RDEPEND=">=dev-php/pear-1.8.1"
+[[ ${EAPI} != [67] ]] && IDEPEND=">=dev-php/pear-1.8.1"
 
 # @ECLASS_VARIABLE: PHP_PEAR_PKG_NAME
 # @DESCRIPTION:
@@ -129,3 +125,7 @@ php-pear-r2_pkg_postrm() {
 	# Uninstall known dependency
 	"${EROOT%/}/usr/bin/peardev" uninstall -nrO "${PHP_PEAR_DOMAIN}/${PHP_PEAR_PKG_NAME}"
 }
+
+fi
+
+EXPORT_FUNCTIONS src_install pkg_postinst pkg_postrm

diff --git a/eclass/plasma-mobile.kde.org.eclass b/eclass/plasma-mobile.kde.org.eclass
index 73cb98a3c153..1e2c5b6eb4fe 100644
--- a/eclass/plasma-mobile.kde.org.eclass
+++ b/eclass/plasma-mobile.kde.org.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: plasma-mobile.kde.org.eclass
@@ -19,7 +19,7 @@
 
 case ${EAPI} in
 	8) ;;
-	*) die "EAPI=${EAPI:-0} is not supported" ;;
+	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
 if [[ -z ${_PLASMA_MOBILE_KDE_ORG_ECLASS} ]]; then

diff --git a/eclass/plasma.kde.org.eclass b/eclass/plasma.kde.org.eclass
index b0aad867ec1d..8fcf087896f1 100644
--- a/eclass/plasma.kde.org.eclass
+++ b/eclass/plasma.kde.org.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: plasma.kde.org.eclass
@@ -19,7 +19,7 @@
 
 case ${EAPI} in
 	8) ;;
-	*) die "EAPI=${EAPI:-0} is not supported" ;;
+	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
 if [[ -z ${_PLASMA_KDE_ORG_ECLASS} ]]; then

diff --git a/eclass/python-r1.eclass b/eclass/python-r1.eclass
index 657922fe646d..4758defe6493 100644
--- a/eclass/python-r1.eclass
+++ b/eclass/python-r1.eclass
@@ -35,7 +35,7 @@ case ${EAPI} in
 	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
-if [[ ! ${_PYTHON_R1_ECLASS} ]]; then
+if [[ -z ${_PYTHON_R1_ECLASS} ]]; then
 _PYTHON_R1_ECLASS=1
 
 if [[ ${_PYTHON_SINGLE_R1_ECLASS} ]]; then
@@ -616,7 +616,7 @@ _python_multibuild_wrapper() {
 python_foreach_impl() {
 	debug-print-function ${FUNCNAME} "${@}"
 
-	if [[ ${_DISTUTILS_R1} ]]; then
+	if [[ ${_DISTUTILS_R1_ECLASS} ]]; then
 		if has "${EBUILD_PHASE}" prepare configure compile test install &&
 			[[ ! ${_DISTUTILS_CALLING_FOREACH_IMPL} &&
 				! ${_DISTUTILS_FOREACH_IMPL_WARNED} ]]

diff --git a/eclass/qt5-build.eclass b/eclass/qt5-build.eclass
index a3a7c88142b9..ae74c2e0540b 100644
--- a/eclass/qt5-build.eclass
+++ b/eclass/qt5-build.eclass
@@ -11,15 +11,17 @@
 # @DESCRIPTION:
 # This eclass contains various functions that are used when building Qt5.
 
-if [[ ${CATEGORY} != dev-qt ]]; then
-	die "${ECLASS} is only to be used for building Qt 5"
-fi
-
 case ${EAPI} in
 	8) ;;
 	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
+if [[ -z ${_QT5_BUILD_ECLASS} ]]; then
+_QT5_BUILD_ECLASS=1
+
+[[ ${CATEGORY} != dev-qt ]] &&
+	die "${ECLASS} is only to be used for building Qt 5"
+
 # @ECLASS_VARIABLE: QT5_BUILD_TYPE
 # @DESCRIPTION:
 # Default value is "release".
@@ -171,8 +173,6 @@ fi
 
 ######  Phase functions  ######
 
-EXPORT_FUNCTIONS src_prepare src_configure src_compile src_install src_test pkg_postinst pkg_postrm
-
 # @FUNCTION: qt5-build_src_prepare
 # @DESCRIPTION:
 # Prepares the environment and patches the sources if necessary.
@@ -971,3 +971,7 @@ qt5_regenerate_global_configs() {
 		ewarn "${qmodule_pri} or ${qmodule_pri_orig} does not exist or is not a regular file"
 	fi
 }
+
+fi
+
+EXPORT_FUNCTIONS src_prepare src_configure src_compile src_install src_test pkg_postinst pkg_postrm

diff --git a/eclass/qt6-build.eclass b/eclass/qt6-build.eclass
index b7e062e6ef54..f92d37eba2f3 100644
--- a/eclass/qt6-build.eclass
+++ b/eclass/qt6-build.eclass
@@ -1,4 +1,4 @@
-# Copyright 2021-2022 Gentoo Authors
+# Copyright 2021-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: qt6-build.eclass
@@ -10,15 +10,17 @@
 # This eclass contains various functions that are used when building Qt6.
 # Requires EAPI 8.
 
-if [[ ${CATEGORY} != dev-qt ]]; then
-	die "qt6-build.eclass is only to be used for building Qt 6"
-fi
-
 case ${EAPI} in
-	8)	: ;;
-	*)	die "qt6-build.eclass: unsupported EAPI=${EAPI:-0}" ;;
+	8) ;;
+	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
+if [[ -z ${_QT6_BUILD_ECLASS} ]]; then
+_QT6_BUILD_ECLASS=1
+
+[[ ${CATEGORY} != dev-qt ]] &&
+	die "${ECLASS} is only to be used for building Qt 6"
+
 # @ECLASS_VARIABLE: QT6_MODULE
 # @PRE_INHERIT
 # @DESCRIPTION:
@@ -99,8 +101,6 @@ BDEPEND="
 #	DEPEND+=" test? ( ~dev-qt/qttest-${PV} )"
 #fi
 
-EXPORT_FUNCTIONS src_prepare src_configure
-
 ######  Phase functions  ######
 
 # @FUNCTION: qt6-build_src_prepare
@@ -166,3 +166,7 @@ qt6_prepare_env() {
 		QT6_QMLDIR QT6_DATADIR QT6_DOCDIR QT6_TRANSLATIONDIR \
 		QT6_EXAMPLESDIR QT6_TESTSDIR QT6_SYSCONFDIR
 }
+
+fi
+
+EXPORT_FUNCTIONS src_prepare src_configure

diff --git a/eclass/rebar.eclass b/eclass/rebar.eclass
index 1c7bc20def14..4c4c90fbcc11 100644
--- a/eclass/rebar.eclass
+++ b/eclass/rebar.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: rebar.eclass
@@ -24,7 +24,8 @@ case ${EAPI} in
 	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
-EXPORT_FUNCTIONS src_prepare src_compile src_test src_install
+if [[ -z ${_REBAR_ECLASS} ]]; then
+_REBAR_ECLASS=1
 
 RDEPEND="dev-lang/erlang:="
 DEPEND="${RDEPEND}"
@@ -256,3 +257,7 @@ rebar_src_install() {
 
 	einstalldocs
 }
+
+fi
+
+EXPORT_FUNCTIONS src_prepare src_compile src_test src_install

diff --git a/eclass/ruby-ng.eclass b/eclass/ruby-ng.eclass
index d6b3d2a0669a..67c22d518a31 100644
--- a/eclass/ruby-ng.eclass
+++ b/eclass/ruby-ng.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: ruby-ng.eclass
@@ -67,26 +67,19 @@
 # passed to "grep -E" to remove reporting of these shared objects.
 
 case ${EAPI} in
-	6)
-		inherit eqawarn estack toolchain-funcs
-		;;
-	*)
-		inherit estack
-		;;
+	6|7|8) ;;
+	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
-inherit multilib ruby-utils
+if [[ -z ${_RUBY_NG_ECLASS} ]]; then
+_RUBY_NG_ECLASS=1
 
-EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_test src_install pkg_setup
+[[ ${EAPI} == 6 ]] && inherit eqawarn toolchain-funcs
+inherit estack multilib ruby-utils
 
 # S is no longer automatically assigned when it doesn't exist.
 S="${WORKDIR}"
 
-case ${EAPI} in
-	6|7|8) ;;
-	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
-esac
-
 # @FUNCTION: ruby_implementation_depend
 # @USAGE: target [comparator [version]]
 # @RETURN: Package atom of a Ruby implementation to be used in dependencies.
@@ -799,3 +792,7 @@ ruby-ng_testrb-2() {
 
 	${RUBY} -S testrb-2 ${testrb_params} "$@" || die "testrb-2 failed"
 }
+
+fi
+
+EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_test src_install pkg_setup

diff --git a/eclass/savedconfig.eclass b/eclass/savedconfig.eclass
index 4681fd25328b..cc5748543078 100644
--- a/eclass/savedconfig.eclass
+++ b/eclass/savedconfig.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: savedconfig.eclass
@@ -30,15 +30,18 @@
 # 4. Emerge the package with just USE=savedconfig to get the custom
 # build.
 
-inherit portability
-
-IUSE="savedconfig"
-
 case ${EAPI} in
 	6|7|8) ;;
-	*) die "EAPI=${EAPI:-0} is not supported" ;;
+	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
+if [[ -z ${_SAVEDCONFIG_ECLASS} ]]; then
+_SAVEDCONFIG_ECLASS=1
+
+inherit portability
+
+IUSE="savedconfig"
+
 # @FUNCTION: save_config
 # @USAGE: <config files to save>
 # @DESCRIPTION:
@@ -152,4 +155,6 @@ savedconfig_pkg_postinst() {
 	fi
 }
 
+fi
+
 EXPORT_FUNCTIONS pkg_postinst

diff --git a/eclass/sgml-catalog-r1.eclass b/eclass/sgml-catalog-r1.eclass
index 9f8bb13d6095..2258b3e2bf0f 100644
--- a/eclass/sgml-catalog-r1.eclass
+++ b/eclass/sgml-catalog-r1.eclass
@@ -1,4 +1,4 @@
-# Copyright 2019-2021 Gentoo Authors
+# Copyright 2019-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: sgml-catalog-r1.eclass
@@ -12,14 +12,13 @@
 # This eclass regenerates /etc/sgml/catalog as necessary for the DocBook
 # tooling. This is done via exported pkg_postinst and pkg_postrm phases.
 
-case ${EAPI:-0} in
+case ${EAPI} in
 	7) ;;
-	*) die "Unsupported EAPI=${EAPI} for ${ECLASS}";;
+	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
-EXPORT_FUNCTIONS pkg_postinst pkg_postrm
-
-if [[ ! ${_SGML_CATALOG_R1} ]]; then
+if [[ -z ${_SGML_CATALOG_R1_ECLASS} ]]; then
+_SGML_CATALOG_R1_ECLASS=1
 
 if [[ ${CATEGORY}/${PN} != app-text/sgml-common ]]; then
 	RDEPEND=">=app-text/sgml-common-0.6.3-r7"
@@ -64,5 +63,6 @@ sgml-catalog-r1_pkg_postrm() {
 	sgml-catalog-r1_update_env
 }
 
-_SGML_CATALOG_R1=1
 fi
+
+EXPORT_FUNCTIONS pkg_postinst pkg_postrm

diff --git a/eclass/ssl-cert.eclass b/eclass/ssl-cert.eclass
index 4b016ea82c87..83fbcf6143d1 100644
--- a/eclass/ssl-cert.eclass
+++ b/eclass/ssl-cert.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: ssl-cert.eclass
@@ -14,12 +14,12 @@
 # @EXAMPLE:
 # "install_cert /foo/bar" installs ${ROOT}/foo/bar.{key,csr,crt,pem}
 
-case "${EAPI}" in
+case ${EAPI} in
 	6|7|8) ;;
-	*) die "EAPI=${EAPI:-0} is not supported" ;;
+	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
-if [[ ! ${_SSL_CERT_ECLASS} ]]; then
+if [[ -z ${_SSL_CERT_ECLASS} ]]; then
 _SSL_CERT_ECLASS=1
 
 # @ECLASS_VARIABLE: SSL_CERT_MANDATORY

diff --git a/eclass/tests/distutils-r1.sh b/eclass/tests/distutils-r1.sh
index a42d4cc4641a..c895af3fc9a0 100755
--- a/eclass/tests/distutils-r1.sh
+++ b/eclass/tests/distutils-r1.sh
@@ -59,7 +59,7 @@ test-DISTUTILS_USE_SETUPTOOLS() {
 
 	local BDEPEND=
 	local RDEPEND=
-	unset _DISTUTILS_R1
+	unset _DISTUTILS_R1_ECLASS
 	inherit distutils-r1
 
 	local ret var val

diff --git a/eclass/tests/distutils-r1_single.sh b/eclass/tests/distutils-r1_single.sh
index 0a671e2b739b..2035f1454c60 100755
--- a/eclass/tests/distutils-r1_single.sh
+++ b/eclass/tests/distutils-r1_single.sh
@@ -48,7 +48,7 @@ test-DISTUTILS_USE_SETUPTOOLS() {
 
 	local BDEPEND=
 	local RDEPEND=
-	unset _DISTUTILS_R1
+	unset _DISTUTILS_R1_ECLASS
 	inherit distutils-r1
 
 	local ret var val

diff --git a/eclass/texlive-common.eclass b/eclass/texlive-common.eclass
index 40e2c3530510..f43d10926857 100644
--- a/eclass/texlive-common.eclass
+++ b/eclass/texlive-common.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: texlive-common.eclass
@@ -14,15 +14,14 @@
 #
 # Note that this eclass *must* not assume the presence of any standard tex too
 
+case ${EAPI} in
+	7) inherit eapi8-dosym ;;
+	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
+esac
+
 if [[ -z ${_TEXLIVE_COMMON_ECLASS} ]]; then
 _TEXLIVE_COMMON_ECLASS=1
 
-case ${EAPI:-0} in
-	[0-6]) die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}" ;;
-	7)     inherit eapi8-dosym ;;
-	*)     die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}" ;;
-esac
-
 TEXMF_PATH=/usr/share/texmf
 TEXMF_DIST_PATH=/usr/share/texmf-dist
 TEXMF_VAR_PATH=/var/lib/texmf

diff --git a/eclass/texlive-module.eclass b/eclass/texlive-module.eclass
index 68276714a4bc..a53c22dde205 100644
--- a/eclass/texlive-module.eclass
+++ b/eclass/texlive-module.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: texlive-module.eclass
@@ -71,14 +71,15 @@
 # Information to display about the package.
 # e.g. for enabling/disabling a feature
 
+case ${EAPI} in
+	7) ;;
+	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
+esac
+
 if [[ -z ${_TEXLIVE_MODULE_ECLASS} ]]; then
 _TEXLIVE_MODULE_ECLASS=1
 
-case ${EAPI:-0} in
-	[0-6])	die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}" ;;
-	7)	inherit texlive-common ;;
-	*)	die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}" ;;
-esac
+inherit texlive-common
 
 HOMEPAGE="http://www.tug.org/texlive/"
 
@@ -447,6 +448,6 @@ texlive-module_pkg_postrm() {
 	etexmf-update
 }
 
-EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_postinst pkg_postrm
-
 fi
+
+EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_postinst pkg_postrm

diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 06c044fd1d38..2d7801259019 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -12,17 +12,17 @@
 # instead.
 
 case ${EAPI} in
-	7) inherit eutils ;;
-	8) ;;
+	7|8) ;;
 	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
-if [[ ! ${_TOOLCHAIN_ECLASS} ]]; then
+if [[ -z ${_TOOLCHAIN_ECLASS} ]]; then
 _TOOLCHAIN_ECLASS=1
 
 DESCRIPTION="The GNU Compiler Collection"
 HOMEPAGE="https://gcc.gnu.org/"
 
+[[ ${EAPI} == 7 ]] && inherit eutils
 inherit edo flag-o-matic gnuconfig libtool multilib pax-utils toolchain-funcs prefix
 
 tc_is_live() {
@@ -2828,9 +2828,6 @@ toolchain_death_notice() {
 
 fi
 
-EXPORT_FUNCTIONS pkg_pretend pkg_setup src_unpack src_prepare src_configure \
-	src_compile src_test src_install pkg_postinst pkg_postrm
-
 # Note [implicitly enabled flags]
 # -------------------------------
 # Usually configure-based packages handle explicit feature requests
@@ -2848,3 +2845,5 @@ EXPORT_FUNCTIONS pkg_pretend pkg_setup src_unpack src_prepare src_configure \
 # Thus safer way to enable/disable the feature is to rely on implicit
 # enabled-by-default state:
 #    econf $(usex foo '' --disable-foo)
+
+EXPORT_FUNCTIONS pkg_pretend pkg_setup src_unpack src_prepare src_configure src_compile src_test src_install pkg_postinst pkg_postrm

diff --git a/eclass/tree-sitter-grammar.eclass b/eclass/tree-sitter-grammar.eclass
index c607ea9ddfb7..e74d18653b8a 100644
--- a/eclass/tree-sitter-grammar.eclass
+++ b/eclass/tree-sitter-grammar.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: tree-sitter-grammar.eclass
@@ -10,17 +10,15 @@
 # @SUPPORTED_EAPIS: 8
 # @BLURB: Common functions and variables for Tree Sitter grammars
 
-inherit edo
-
-if [[ -z ${_TREE_SITTER_GRAMMAR_ECLASS} ]]; then
-_TREE_SITTER_GRAMMAR_ECLASS=1
-
 case ${EAPI} in
 	8) ;;
-	*) die "EAPI=${EAPI:-0} is not supported" ;;
+	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
-inherit multilib toolchain-funcs
+if [[ -z ${_TREE_SITTER_GRAMMAR_ECLASS} ]]; then
+_TREE_SITTER_GRAMMAR_ECLASS=1
+
+inherit edo multilib toolchain-funcs
 
 SRC_URI="https://github.com/tree-sitter/${PN}/archive/${TS_PV:-v${PV}}.tar.gz
 	-> ${P}.tar.gz"
@@ -33,8 +31,6 @@ BDEPEND+=" test? ( dev-util/tree-sitter-cli )"
 IUSE+=" test"
 RESTRICT+=" !test? ( test )"
 
-EXPORT_FUNCTIONS src_compile src_test src_install
-
 # @ECLASS_VARIABLE: TS_PV
 # @PRE_INHERIT
 # @DEFAULT_UNSET
@@ -115,4 +111,7 @@ tree-sitter-grammar_src_install() {
 	dosym "${soname}" \
 		  /usr/$(get_libdir)/lib${PN}$(get_libname)
 }
+
 fi
+
+EXPORT_FUNCTIONS src_compile src_test src_install

diff --git a/eclass/unpacker.eclass b/eclass/unpacker.eclass
index 44ff2af5acf3..2a0dcf45d76a 100644
--- a/eclass/unpacker.eclass
+++ b/eclass/unpacker.eclass
@@ -15,8 +15,8 @@
 #  - merge rpm unpacking
 #  - support partial unpacks?
 
-case ${EAPI:-0} in
-	[678]) ;;
+case ${EAPI} in
+	6|7|8) ;;
 	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
@@ -642,6 +642,6 @@ unpacker_src_uri_depends() {
 	echo "${deps[*]}"
 }
 
-EXPORT_FUNCTIONS src_unpack
-
 fi
+
+EXPORT_FUNCTIONS src_unpack

diff --git a/eclass/verify-sig.eclass b/eclass/verify-sig.eclass
index f67a3b10a0bf..5e757cdd6038 100644
--- a/eclass/verify-sig.eclass
+++ b/eclass/verify-sig.eclass
@@ -45,9 +45,8 @@ case ${EAPI} in
 	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
-EXPORT_FUNCTIONS src_unpack
-
-if [[ ! ${_VERIFY_SIG_ECLASS} ]]; then
+if [[ -z ${_VERIFY_SIG_ECLASS} ]]; then
+_VERIFY_SIG_ECLASS=1
 
 IUSE="verify-sig"
 
@@ -390,5 +389,6 @@ verify-sig_src_unpack() {
 	default_src_unpack
 }
 
-_VERIFY_SIG_ECLASS=1
 fi
+
+EXPORT_FUNCTIONS src_unpack

diff --git a/eclass/vim-plugin.eclass b/eclass/vim-plugin.eclass
index edf1c94d31b1..81e1e54f638d 100644
--- a/eclass/vim-plugin.eclass
+++ b/eclass/vim-plugin.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: vim-plugin.eclass
@@ -13,15 +13,17 @@
 # documentation, for which we make a special case via vim-doc.eclass.
 
 case ${EAPI} in
-	6|7) ;;
-	8) _DEFINE_VIM_PLUGIN_SRC_PREPARE=true ;;
+	6|7|8) ;;
 	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
-if [[ ! ${_VIM_PLUGIN_ECLASS} ]]; then
+if [[ -z ${_VIM_PLUGIN_ECLASS} ]]; then
+_VIM_PLUGIN_ECLASS=1
 
 inherit vim-doc
 
+[[ ${EAPI} != [67] ]] && _DEFINE_VIM_PLUGIN_SRC_PREPARE=true
+
 # @ECLASS_VARIABLE: VIM_PLUGIN_VIM_VERSION
 # @DESCRIPTION:
 # Minimum Vim version the plugin supports.
@@ -230,13 +232,9 @@ display_vim_plugin_help() {
 	fi
 }
 
-_VIM_PLUGIN_ECLASS=1
 fi
 
-EXPORT_FUNCTIONS src_install pkg_postinst pkg_postrm
-
 # src_prepare is only exported in EAPI >= 8
-case ${EAPI} in
-	6|7) ;;
-	*) EXPORT_FUNCTIONS src_prepare ;;
-esac
+[[ ${_DEFINE_VIM_PLUGIN_SRC_PREPARE} ]] && EXPORT_FUNCTIONS src_prepare
+
+EXPORT_FUNCTIONS src_install pkg_postinst pkg_postrm

diff --git a/eclass/vim-spell.eclass b/eclass/vim-spell.eclass
index 8acf29a5580d..38db4ccda13f 100644
--- a/eclass/vim-spell.eclass
+++ b/eclass/vim-spell.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: vim-spell.eclass
@@ -63,13 +63,11 @@
 # spell files. It's best to let upstream know if you've generated spell files
 # for another language rather than keeping them Gentoo-specific.
 
-case ${EAPI:-0} in
-	[67]) ;;
+case ${EAPI} in
+	6|7) ;;
 	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
-EXPORT_FUNCTIONS src_install pkg_postinst
-
 if [[ -z ${_VIM_SPELL_ECLASS} ]] ; then
 _VIM_SPELL_ECLASS=1
 
@@ -157,3 +155,5 @@ vim-spell_pkg_postinst() {
 }
 
 fi
+
+EXPORT_FUNCTIONS src_install pkg_postinst

diff --git a/eclass/virtualx.eclass b/eclass/virtualx.eclass
index e04834d39bd1..2513f4e16256 100644
--- a/eclass/virtualx.eclass
+++ b/eclass/virtualx.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: virtualx.eclass
@@ -11,10 +11,10 @@
 
 case ${EAPI} in
 	6|7|8) ;;
-	*) die "${ECLASS}: EAPI ${EAPI:-0} is not supported." ;;
+	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
-if [[ ! ${_VIRTUALX_ECLASS} ]]; then
+if [[ -z ${_VIRTUALX_ECLASS} ]]; then
 _VIRTUALX_ECLASS=1
 
 # @ECLASS_VARIABLE: VIRTUALX_REQUIRED

diff --git a/eclass/xorg-3.eclass b/eclass/xorg-3.eclass
index a63655e10ece..a68341591edd 100644
--- a/eclass/xorg-3.eclass
+++ b/eclass/xorg-3.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: xorg-3.eclass
@@ -22,6 +22,14 @@
 # with the other X packages, you don't need to set SRC_URI. Pretty much
 # everything else should be automatic.
 
+case ${EAPI} in
+	7|8) ;;
+	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
+esac
+
+if [[ -z ${_XORG_3_ECLASS} ]]; then
+_XORG_3_ECLASS=1
+
 GIT_ECLASS=""
 if [[ ${PV} == *9999* ]]; then
 	GIT_ECLASS="git-r3"
@@ -54,19 +62,7 @@ inherit autotools libtool multilib toolchain-funcs flag-o-matic \
 	${FONT_ECLASS} ${GIT_ECLASS}
 unset FONT_ECLASS GIT_ECLASS
 
-if [[ ${XORG_MULTILIB} == yes ]]; then
-	inherit multilib-minimal
-fi
-
-case "${EAPI:-0}" in
-	[7-8]) ;;
-	*) die "EAPI=${EAPI} is not supported" ;;
-esac
-
-# exports must be ALWAYS after inherit
-EXPORT_FUNCTIONS src_prepare src_configure src_unpack src_compile src_install pkg_postinst pkg_postrm
-
-IUSE=""
+[[ ${XORG_MULTILIB} == yes ]] && inherit multilib-minimal
 
 # @ECLASS_VARIABLE: XORG_EAUTORECONF
 # @PRE_INHERIT
@@ -546,3 +542,7 @@ create_fonts_dir() {
 				-- "${EROOT}/usr/share/fonts/${FONT_DIR}"
 	eend $?
 }
+
+fi
+
+EXPORT_FUNCTIONS src_prepare src_configure src_unpack src_compile src_install pkg_postinst pkg_postrm


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: eclass/, eclass/tests/
@ 2023-03-21  5:43 Michał Górny
  0 siblings, 0 replies; 40+ messages in thread
From: Michał Górny @ 2023-03-21  5:43 UTC (permalink / raw
  To: gentoo-commits

commit:     f36f134cbeb012ce50449f8089e9a46fa9e03c64
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 18 15:19:15 2023 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Mar 21 05:33:50 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f36f134c

pypi.eclass: Introduce PYPI_PN to override the default project name

Introduce a convenience PYPI_PN variable that can be used to override
the default project name.  This is meant to be used primarily when
upstream project name does not conform to Gentoo package naming rules,
e.g. contains dots or uppercase letters.

For example, instead of:

    SRC_URI="$(pypi_sdist_url --no-normalize "${PN/-/.}")"
    S=${WORKDIR}/${P/-/.}

one can now specify:

    PYPI_NO_NORMALIZE=1
    PYPI_PN=${PN/-/.}

For PEP 625-conformant packages, instead of:

    SRC_URI="$(pypi_sdist_url "${PN/-/.}")"

one can use:

    PYPI_PN=${PN/-/.}

There's not much gain space-wise but it avoids having to specify
the name twice.  This can particularly be helpful for package names
using PascalCase.

Closes: https://github.com/gentoo/gentoo/pull/30210
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 eclass/pypi.eclass   | 35 ++++++++++++++++++++++++-----------
 eclass/tests/pypi.sh |  3 ++-
 2 files changed, 26 insertions(+), 12 deletions(-)

diff --git a/eclass/pypi.eclass b/eclass/pypi.eclass
index 79007a2ad0ed..ca3b6f67803d 100644
--- a/eclass/pypi.eclass
+++ b/eclass/pypi.eclass
@@ -50,6 +50,19 @@ _PYPI_ECLASS=1
 # When set to a non-empty value, disables project name normalization
 # for the default SRC_URI and S values.
 
+# @ECLASS_VARIABLE: PYPI_PN
+# @PRE_INHERIT
+# @DESCRIPTION:
+# The PyPI project name.  This should be overriden scarcely, generally
+# when upstream project name does not conform to Gentoo naming rules,
+# e.g. when it contains dots or uppercase letters.
+#
+# Example use:
+# @CODE
+# PYPI_PN=${PN/-/.}
+# @CODE
+: ${PYPI_PN:=${PN}}
+
 # @FUNCTION: pypi_normalize_name
 # @USAGE: <name>
 # @DESCRIPTION:
@@ -99,9 +112,9 @@ pypi_translate_version() {
 # generated using build systems that did not follow PEP 625
 # (i.e. the sdist name contains uppercase letters, hyphens or dots).
 #
-# If <package> is unspecified, it defaults to ${PN}.  The package name
-# is normalized according to the specification unless `--no-normalize`
-# is passed.
+# If <package> is unspecified, it defaults to ${PYPI_PN}.  The package
+# name is normalized according to the specification unless
+# `--no-normalize` is passed.
 #
 # If <version> is unspecified, it defaults to ${PV} translated
 # via pypi_translate_version.  If it is specified, then it is used
@@ -121,7 +134,7 @@ pypi_sdist_url() {
 		die "Usage: ${FUNCNAME} [--no-normalize] <project> [<version> [<suffix>]]"
 	fi
 
-	local project=${1-"${PN}"}
+	local project=${1-"${PYPI_PN}"}
 	local version=${2-"$(pypi_translate_version "${PV}")"}
 	local suffix=${3-.tar.gz}
 	local fn_project=${project}
@@ -135,8 +148,8 @@ pypi_sdist_url() {
 # @DESCRIPTION:
 # Output the wheel filename for the specified project/version tuple.
 #
-# If <package> is unspecified, it defaults to ${PN}.  The package name
-# is normalized according to the wheel specification.
+# If <package> is unspecified, it defaults to ${PYPI_PN}.  The package
+# name is normalized according to the wheel specification.
 #
 # If <version> is unspecified, it defaults to ${PV} translated
 # via pypi_translate_version.  If it is specified, then it is used
@@ -154,7 +167,7 @@ pypi_wheel_name() {
 		die "Usage: ${FUNCNAME} <project> [<version> [<python-tag> [<abi-platform-tag>]]]"
 	fi
 
-	local project=$(pypi_normalize_name "${1-"${PN}"}")
+	local project=$(pypi_normalize_name "${1-"${PYPI_PN}"}")
 	local version=${2-"$(pypi_translate_version "${PV}")"}
 	local pytag=${3-py3}
 	local abitag=${4-none-any}
@@ -172,7 +185,7 @@ pypi_wheel_name() {
 # the wheel contents will be unpacked straight into ${WORKDIR}.
 # You need to add a BDEPEND on app-arch/unzip.
 #
-# If <package> is unspecified, it defaults to ${PN}.
+# If <package> is unspecified, it defaults to ${PYPI_PN}.
 #
 # If <version> is unspecified, it defaults to ${PV} translated
 # via pypi_translate_version.  If it is specified, then it is used
@@ -197,7 +210,7 @@ pypi_wheel_url() {
 	fi
 
 	local filename=$(pypi_wheel_name "${@}")
-	local project=${1-"${PN}"}
+	local project=${1-"${PYPI_PN}"}
 	local version=${2-"$(pypi_translate_version "${PV}")"}
 	local pytag=${3-py3}
 	printf "https://files.pythonhosted.org/packages/%s" \
@@ -210,10 +223,10 @@ pypi_wheel_url() {
 
 if [[ ${PYPI_NO_NORMALIZE} ]]; then
 	SRC_URI="$(pypi_sdist_url --no-normalize)"
-	S="${WORKDIR}/${PN}-$(pypi_translate_version "${PV}")"
+	S="${WORKDIR}/${PYPI_PN}-$(pypi_translate_version "${PV}")"
 else
 	SRC_URI="$(pypi_sdist_url)"
-	S="${WORKDIR}/$(pypi_normalize_name "${PN}")-$(pypi_translate_version "${PV}")"
+	S="${WORKDIR}/$(pypi_normalize_name "${PYPI_PN}")-$(pypi_translate_version "${PV}")"
 fi
 
 fi

diff --git a/eclass/tests/pypi.sh b/eclass/tests/pypi.sh
index ebfcdb630856..471ac048b18a 100755
--- a/eclass/tests/pypi.sh
+++ b/eclass/tests/pypi.sh
@@ -5,7 +5,8 @@
 EAPI=8
 source tests-common.sh || exit
 
-PN=Foo.Bar
+PN=foo-bar
+PYPI_PN=Foo.Bar
 PV=1.2.3_beta2
 WORKDIR='<WORKDIR>'
 


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: eclass/, eclass/tests/
@ 2023-05-23  4:36 Michał Górny
  0 siblings, 0 replies; 40+ messages in thread
From: Michał Górny @ 2023-05-23  4:36 UTC (permalink / raw
  To: gentoo-commits

commit:     a118f0e456077da2052c8b3cde8f7b6f55bb78fb
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue May 23 04:00:58 2023 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue May 23 04:36:32 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a118f0e4

python-utils-r1.eclass: Add python3_12 target

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 eclass/python-utils-r1.eclass   | 10 ++++++----
 eclass/tests/python-utils-r1.sh |  8 +++++++-
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 040d374bbfe0..d21e54c6ecc9 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -40,7 +40,7 @@ inherit multiprocessing toolchain-funcs
 # All supported Python implementations, most preferred last.
 _PYTHON_ALL_IMPLS=(
 	pypy3
-	python3_{10..11}
+	python3_{10..12}
 )
 readonly _PYTHON_ALL_IMPLS
 
@@ -80,7 +80,7 @@ _python_verify_patterns() {
 	local impl pattern
 	for pattern; do
 		case ${pattern} in
-			-[23]|3.[89]|3.1[01])
+			-[23]|3.[89]|3.1[012])
 				continue
 				;;
 		esac
@@ -129,7 +129,7 @@ _python_set_impls() {
 			# please keep them in sync with _PYTHON_ALL_IMPLS
 			# and _PYTHON_HISTORICAL_IMPLS
 			case ${i} in
-				pypy3|python3_9|python3_1[01])
+				pypy3|python3_9|python3_1[0-2])
 					;;
 				jython2_7|pypy|pypy1_[89]|pypy2_0|python2_[5-7]|python3_[1-9])
 					obsolete+=( "${i}" )
@@ -236,7 +236,7 @@ _python_impl_matches() {
 				[[ ${impl} == python${pattern/./_} || ${impl} == pypy3 ]] &&
 					return 0
 				;;
-			3.8|3.1[01])
+			3.8|3.1[0-2])
 				[[ ${impl} == python${pattern/./_} ]] && return 0
 				;;
 			*)
@@ -444,6 +444,8 @@ _python_export() {
 						PYTHON_PKG_DEP=">=dev-lang/python-3.10.9-r1:3.10";;
 					python3.11)
 						PYTHON_PKG_DEP=">=dev-lang/python-3.11.1-r1:3.11";;
+					python3.12)
+						PYTHON_PKG_DEP=">=dev-lang/python-3.12.0_beta1:3.12";;
 					pypy3)
 						PYTHON_PKG_DEP='>=dev-python/pypy3-7.3.11-r1:0=';;
 					*)

diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh
index d8b414219704..ee09ae2c877c 100755
--- a/eclass/tests/python-utils-r1.sh
+++ b/eclass/tests/python-utils-r1.sh
@@ -64,7 +64,7 @@ tmpfile=$(mktemp)
 
 inherit python-utils-r1
 
-for minor in 10 11; do
+for minor in {10..12}; do
 	ebegin "Testing python3.${minor}"
 	eindent
 	test_var EPYTHON "python3_${minor}" "python3.${minor}"
@@ -201,10 +201,16 @@ test_is "_python_impl_matches pypy3 python*" 1
 set +f
 test_is "_python_impl_matches python3_10 3.10" 0
 test_is "_python_impl_matches python3_10 3.11" 1
+test_is "_python_impl_matches python3_10 3.12" 1
 test_is "_python_impl_matches python3_11 3.10" 1
 test_is "_python_impl_matches python3_11 3.11" 0
+test_is "_python_impl_matches python3_11 3.12" 1
+test_is "_python_impl_matches python3_12 3.10" 1
+test_is "_python_impl_matches python3_12 3.11" 1
+test_is "_python_impl_matches python3_12 3.12" 0
 test_is "_python_impl_matches pypy3 3.10" 1
 test_is "_python_impl_matches pypy3 3.11" 1
+test_is "_python_impl_matches pypy3 3.12" 1
 eoutdent
 
 rm "${tmpfile}"


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: eclass/, eclass/tests/
@ 2023-06-07  7:00 Ulrich Müller
  0 siblings, 0 replies; 40+ messages in thread
From: Ulrich Müller @ 2023-06-07  7:00 UTC (permalink / raw
  To: gentoo-commits

commit:     6010e062fbaf504c3f3d4c78f6e7fa506af8a49d
Author:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Wed Jun  7 06:52:46 2023 +0000
Commit:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Wed Jun  7 06:58:58 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6010e062

eapi8-dosym.eclass: Don't add a spurious newline to the path

Bash's <<< operator will append a newline to the string, therefore use
echo -n instead.

Add a couple of test cases that would have caught this.

Fixes: d5638e49ee79c0f7e4672d5537e97a4ccc7f2eb2
Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>

 eclass/eapi8-dosym.eclass   | 2 +-
 eclass/tests/eapi8-dosym.sh | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/eclass/eapi8-dosym.eclass b/eclass/eapi8-dosym.eclass
index 93b11dda7fd6..e139b74cfea0 100644
--- a/eclass/eapi8-dosym.eclass
+++ b/eclass/eapi8-dosym.eclass
@@ -31,7 +31,7 @@ esac
 _dosym8_canonicalize() {
 	local path slash i prev out IFS=/
 
-	read -r -d '' -a path <<< "$1"
+	read -r -d '' -a path < <(echo -n "$1")
 	[[ $1 == /* ]] && slash=/
 
 	while true; do

diff --git a/eclass/tests/eapi8-dosym.sh b/eclass/tests/eapi8-dosym.sh
index 9290026a26de..cae66e3bb2ee 100755
--- a/eclass/tests/eapi8-dosym.sh
+++ b/eclass/tests/eapi8-dosym.sh
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 2020 Gentoo Authors
+# Copyright 2020-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7
@@ -50,8 +50,10 @@ done
 teq . _dosym8_canonicalize .
 teq foo _dosym8_canonicalize foo
 teq foo _dosym8_canonicalize ./foo
+teq foo _dosym8_canonicalize foo/.
 teq ../foo _dosym8_canonicalize ../foo
 teq ../baz _dosym8_canonicalize foo/bar/../../../baz
+teq '*' _dosym8_canonicalize '*'
 
 for f in ref_dosym_r "dosym8 -r"; do
 	teq ../../bin/foo ${f} /bin/foo /usr/bin/foo


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: eclass/, eclass/tests/
@ 2023-09-14  5:30 Michał Górny
  0 siblings, 0 replies; 40+ messages in thread
From: Michał Górny @ 2023-09-14  5:30 UTC (permalink / raw
  To: gentoo-commits

commit:     89076704440410a8f87d8278363051856a91f88e
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Sep  3 15:02:22 2023 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Sep 14 05:30:11 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=89076704

verify-sig.eclass: Fix handling multiple/duplicate signatures

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 eclass/tests/verify-sig.sh | 11 +++++++++++
 eclass/verify-sig.eclass   |  5 +++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/eclass/tests/verify-sig.sh b/eclass/tests/verify-sig.sh
index fb7f2cdb2a5d..a87e2c7703d7 100755
--- a/eclass/tests/verify-sig.sh
+++ b/eclass/tests/verify-sig.sh
@@ -57,6 +57,9 @@ cat > checksums.txt <<-EOF || die
 	cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e empty
 	020da0f4d8a4c8bfbc98274027740061d7df52ee07091ed6595a083e0f45327bbe59424312d86f218b74ed2e25507abaf5c7a5fcf4cafcf9538b705808fd55ec	text
 	020da0f4d8a4c8bfbc98274027740061d7df52ee07091ed6595a083e0f45327bbe59424312d86f218b74ed2e25507abaf5c7a5fcf4cafcf9538b705808fd55ec fail
+
+	# duplicate checksum
+	e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 empty
 EOF
 
 test_verify_unsigned_checksums sha256
@@ -70,11 +73,19 @@ eindent
 cat > checksums.txt <<-EOF || die
 	junk text that ought to be ignored
 
+	SHA1(empty)=da39a3ee5e6b4b0d3255bfef95601890afd80709
+	SHA1(text)= 9c04cd6372077e9b11f70ca111c9807dc7137e4b
+	SHA1(fail)=9c04cd6372077e9b11f70ca111c9807dc7137e4b
+
 	SHA256(empty)=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
 	SHA256(text)= b47cc0f104b62d4c7c30bcd68fd8e67613e287dc4ad8c310ef10cbadea9c4380
 	SHA256(fail)=b47cc0f104b62d4c7c30bcd68fd8e67613e287dc4ad8c310ef10cbadea9c4380
 
 	SHA256(annoying ( filename )= yes )= e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
+
+	SHA512(empty)=cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e
+	SHA512(text)= 020da0f4d8a4c8bfbc98274027740061d7df52ee07091ed6595a083e0f45327bbe59424312d86f218b74ed2e25507abaf5c7a5fcf4cafcf9538b705808fd55ec
+	SHA512(fail)=020da0f4d8a4c8bfbc98274027740061d7df52ee07091ed6595a083e0f45327bbe59424312d86f218b74ed2e25507abaf5c7a5fcf4cafcf9538b705808fd55ec
 EOF
 
 test_verify_unsigned_checksums openssl-dgst

diff --git a/eclass/verify-sig.eclass b/eclass/verify-sig.eclass
index 815299b419ed..010361bfbc98 100644
--- a/eclass/verify-sig.eclass
+++ b/eclass/verify-sig.eclass
@@ -252,6 +252,7 @@ verify-sig_verify_unsigned_checksums() {
 
 	[[ ${checksum_file} == - ]] && checksum_file=/dev/stdin
 	local line checksum filename junk ret=0 count=0
+	local -A verified
 	while read -r line; do
 		if [[ ${line} == "-----BEGIN"* ]]; then
 			die "${FUNCNAME}: PGP armor found, use verify-sig_verify_signed_checksums instead"
@@ -278,7 +279,7 @@ verify-sig_verify_unsigned_checksums() {
 		fi
 
 		if "${algo,,}sum" -c --strict - <<<"${checksum} ${filename}"; then
-			(( count++ ))
+			verified["${filename}"]=1
 		else
 			ret=1
 		fi
@@ -286,7 +287,7 @@ verify-sig_verify_unsigned_checksums() {
 
 	[[ ${ret} -eq 0 ]] ||
 		die "${FUNCNAME}: at least one file did not verify successfully"
-	[[ ${count} -eq ${#files[@]} ]] ||
+	[[ ${#verified[@]} -eq ${#files[@]} ]] ||
 		die "${FUNCNAME}: checksums for some of the specified files were missing"
 }
 


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: eclass/, eclass/tests/
@ 2023-10-09 10:54 Florian Schmaus
  0 siblings, 0 replies; 40+ messages in thread
From: Florian Schmaus @ 2023-10-09 10:54 UTC (permalink / raw
  To: gentoo-commits

commit:     844eece34638a7b93a55d610d32254504bd2be63
Author:     Florian Schmaus <flow <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 24 18:54:46 2023 +0000
Commit:     Florian Schmaus <flow <AT> gentoo <DOT> org>
CommitDate: Mon Oct  9 10:54:06 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=844eece3

multiprocessing.eclass: consider (GNU)MAKEFLAGS, add get_makeopts_{jobs,loadavg}

Since --load-average may not be found in other Make implementations
besides GNU Make, it is potentially found in GNUMAKEFLAGS and not in
MAKEOPTS.

Also, Portage is probably soon setting --load-average in GNUMAKEFLAGS as
default.

Thanks to floppym and mgorny for feedback.

Signed-off-by: Florian Schmaus <flow <AT> gentoo.org>

 eclass/multiprocessing.eclass                 | 38 +++++++++++++++++++++++----
 eclass/tests/multiprocessing_makeopts_jobs.sh | 24 +++++++++++++++--
 2 files changed, 55 insertions(+), 7 deletions(-)

diff --git a/eclass/multiprocessing.eclass b/eclass/multiprocessing.eclass
index e55be636a02c..13d6a92f2f2e 100644
--- a/eclass/multiprocessing.eclass
+++ b/eclass/multiprocessing.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: multiprocessing.eclass
@@ -64,17 +64,35 @@ get_nproc() {
 	fi
 }
 
+# @FUNCTION: _get_all_makeopts
+# @INTERNAL
+# @DESCRIPTION:
+# Returns ${MAKEOPTS} ${GNUMAKEFLAGS} ${MAKEFLAGS}.
+_get_all_makeopts() {
+	echo "${MAKEOPTS} ${GNUMAKEFLAGS} ${MAKEFLAGS}"
+}
+
+# @FUNCTION: get_makeopts_jobs
+# @USAGE: [default-jobs]
+# @DESCRIPTION:
+# Return the number of jobs extracted from the make options (MAKEOPTS,
+# GNUMAKEFLAGS, MAKEFLAGS). If the make options do not specify a number,
+# then either the provided default is returned, or 1.
+get_makeopts_jobs() {
+	makeopts_jobs "$(_get_all_makeopts)" "${1:-1}"
+}
+
 # @FUNCTION: makeopts_jobs
 # @USAGE: [${MAKEOPTS}] [${inf:-$(( $(get_nproc) + 1 ))}]
 # @DESCRIPTION:
-# Searches the arguments (defaults to ${MAKEOPTS}) and extracts the jobs number
+# Searches the arguments (or sensible defaults) and extracts the jobs number
 # specified therein.  Useful for running non-make tools in parallel too.
 # i.e. if the user has MAKEOPTS=-j9, this will echo "9" -- we can't return the
 # number as bash normalizes it to [0, 255].  If the flags haven't specified a
 # -j flag, then "1" is shown as that is the default `make` uses.  If the flags
 # specify -j without a number, ${inf} is returned (defaults to nproc).
 makeopts_jobs() {
-	[[ $# -eq 0 ]] && set -- "${MAKEOPTS}"
+	[[ $# -eq 0 ]] && set -- "$(_get_all_makeopts)"
 	# This assumes the first .* will be more greedy than the second .*
 	# since POSIX doesn't specify a non-greedy match (i.e. ".*?").
 	local jobs=$(echo " $* " | sed -r -n \
@@ -83,10 +101,20 @@ makeopts_jobs() {
 	echo ${jobs:-1}
 }
 
+# @FUNCTION: get_makeopts_loadavg
+# @USAGE: [default-loadavg]
+# @DESCRIPTION:
+# Return the value for the load-average extracted from the make options (MAKEOPTS,
+# GNUMAKEFLAGS, MAKEFLAGS).  If the make options do not specify a value, then
+# either the optional provided default is returned, or 999.
+get_makeopts_loadavg() {
+	makeopts_loadavg "$(_get_all_makeopts)" "${1:-999}"
+}
+
 # @FUNCTION: makeopts_loadavg
 # @USAGE: [${MAKEOPTS}] [${inf:-999}]
 # @DESCRIPTION:
-# Searches the arguments (defaults to ${MAKEOPTS}) and extracts the value set
+# Searches the arguments (or sensible defaults) and extracts the value set
 # for load-average. For make and ninja based builds this will mean new jobs are
 # not only limited by the jobs-value, but also by the current load - which might
 # get excessive due to I/O and not just due to CPU load.
@@ -95,7 +123,7 @@ makeopts_jobs() {
 # If no limit is specified or --load-average is used without a number, ${inf}
 # (defaults to 999) is returned.
 makeopts_loadavg() {
-	[[ $# -eq 0 ]] && set -- "${MAKEOPTS}"
+	[[ $# -eq 0 ]] && set -- "$(_get_all_makeopts)"
 	# This assumes the first .* will be more greedy than the second .*
 	# since POSIX doesn't specify a non-greedy match (i.e. ".*?").
 	local lavg=$(echo " $* " | sed -r -n \

diff --git a/eclass/tests/multiprocessing_makeopts_jobs.sh b/eclass/tests/multiprocessing_makeopts_jobs.sh
index 37d5a7257775..56d73ef48b3c 100755
--- a/eclass/tests/multiprocessing_makeopts_jobs.sh
+++ b/eclass/tests/multiprocessing_makeopts_jobs.sh
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7
@@ -9,7 +9,13 @@ inherit multiprocessing
 
 test-makeopts_jobs() {
 	local exp=$1; shift
-	tbegin "makeopts_jobs($1${2+; inf=${2}}) == ${exp}"
+	local targs
+	if [[ -v 1 ]]; then
+		targs="$1${2+; inf=${2}}"
+	else
+		targs="MAKEOPTS=\"${MAKEOPTS}\" GNUMAKEFLAGS=\"${GNUMAKEFLAGS}\" MAKEFLAGS=\"${MAKEFLAGS}\""
+	fi
+	tbegin "makeopts_jobs(${targs}) == ${exp}"
 	local indirect=$(MAKEOPTS="$*" makeopts_jobs)
 	local direct=$(makeopts_jobs "$@")
 	if [[ "${direct}" != "${indirect}" ]] ; then
@@ -50,6 +56,20 @@ for (( i = 0; i < ${#tests[@]}; i += 2 )) ; do
 	test-makeopts_jobs "${tests[i]}" "${tests[i+1]}"
 done
 
+tests=(
+	7 "" "--jobs 7" ""
+	# MAKEFLAGS override GNUMAKEFLAGS
+	8 "" "--jobs 7" "--jobs 8"
+)
+
+for (( i = 0; i < ${#tests[@]}; i += 4 )) ; do
+	MAKEOPTS="${tests[i+1]}"
+	GNUMAKEFLAGS="${tests[i+2]}"
+	MAKEFLAGS="${tests[i+3]}"
+	test-makeopts_jobs "${tests[i]}"
+	unset MAKEOPTS GNUMAKEFLAGS MAKEFLAGS
+done
+
 # test custom inf value
 test-makeopts_jobs 645 "-j" 645
 


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: eclass/, eclass/tests/
@ 2024-02-10 10:47 Michał Górny
  0 siblings, 0 replies; 40+ messages in thread
From: Michał Górny @ 2024-02-10 10:47 UTC (permalink / raw
  To: gentoo-commits

commit:     118145de3992a8249131bd0eb30ea89ad0bd0bdf
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Feb  7 16:38:19 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Feb 10 10:47:21 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=118145de

llvm-utils.eclass: Split out PATH prepending logic

Split the logic prepending PATH from pkg_setup() into a dedicated
llvm_prepend_path() function.

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 eclass/llvm-utils.eclass   | 36 ++++++++++++++++++++++++++++++++++++
 eclass/llvm.eclass         | 25 +------------------------
 eclass/tests/llvm-utils.sh | 24 ++++++++++++++++++++++++
 3 files changed, 61 insertions(+), 24 deletions(-)

diff --git a/eclass/llvm-utils.eclass b/eclass/llvm-utils.eclass
index 43988f6f88c7..f308667e3dc2 100644
--- a/eclass/llvm-utils.eclass
+++ b/eclass/llvm-utils.eclass
@@ -112,4 +112,40 @@ llvm_fix_tool_path() {
 	${shopt_save}
 }
 
+# @FUNCTION: llvm_prepend_path
+# @USAGE: <slot>
+# @DESCRIPTION:
+# Prepend the path to the specified LLVM slot to PATH variable,
+# and reexport it.
+llvm_prepend_path() {
+	debug-print-function ${FUNCNAME} "${@}"
+
+	[[ ${#} -ne 1 ]] && die "Usage: ${FUNCNAME} <slot>"
+	local slot=${1}
+
+	local llvm_path=${ESYSROOT}/usr/lib/llvm/${slot}/bin
+	local IFS=:
+	local split_path=( ${PATH} )
+	local new_path=()
+	local x added=
+
+	# prepend new path in front of the first LLVM version found
+	for x in "${split_path[@]}"; do
+		if [[ ${x} == */usr/lib/llvm/*/bin ]]; then
+			if [[ ${x} != ${llvm_path} ]]; then
+				new_path+=( "${llvm_path}" )
+			elif [[ ${added} && ${x} == ${llvm_path} ]]; then
+				# deduplicate
+				continue
+			fi
+			added=1
+		fi
+		new_path+=( "${x}" )
+	done
+	# ...or to the end of PATH
+	[[ ${added} ]] || new_path+=( "${llvm_path}" )
+
+	export PATH=${new_path[*]}
+}
+
 fi

diff --git a/eclass/llvm.eclass b/eclass/llvm.eclass
index 05ffcfd7cc6d..e297fe992c9f 100644
--- a/eclass/llvm.eclass
+++ b/eclass/llvm.eclass
@@ -212,30 +212,7 @@ llvm_pkg_setup() {
 			llvm_fix_tool_path LLVM_CONFIG
 		fi
 
-		local prefix=${ESYSROOT}
-		local llvm_path=${prefix}/usr/lib/llvm/${LLVM_SLOT}/bin
-		local IFS=:
-		local split_path=( ${PATH} )
-		local new_path=()
-		local x added=
-
-		# prepend new path before first LLVM version found
-		for x in "${split_path[@]}"; do
-			if [[ ${x} == */usr/lib/llvm/*/bin ]]; then
-				if [[ ${x} != ${llvm_path} ]]; then
-					new_path+=( "${llvm_path}" )
-				elif [[ ${added} && ${x} == ${llvm_path} ]]; then
-					# deduplicate
-					continue
-				fi
-				added=1
-			fi
-			new_path+=( "${x}" )
-		done
-		# ...or to the end of PATH
-		[[ ${added} ]] || new_path+=( "${llvm_path}" )
-
-		export PATH=${new_path[*]}
+		llvm_prepend_path "${LLVM_SLOT}"
 	fi
 }
 

diff --git a/eclass/tests/llvm-utils.sh b/eclass/tests/llvm-utils.sh
index 44ad1b4adc84..5a46b25b7ad6 100755
--- a/eclass/tests/llvm-utils.sh
+++ b/eclass/tests/llvm-utils.sh
@@ -66,6 +66,21 @@ test_fix_tool_path() {
 	tend ${?}
 }
 
+test_prepend_path() {
+	local slot=${1}
+	local -x PATH=${2}
+	local expected=${3}
+
+	tbegin "llvm_prepend_path ${slot} to PATH=${PATH}"
+	llvm_prepend_path "${slot}"
+	if [[ ${PATH} != ${expected} ]]; then
+		eerror "llvm_prepend_path ${var}"
+		eerror "    gave: ${PATH}"
+		eerror "expected: ${expected}"
+	fi
+	tend ${?}
+}
+
 test_fix_clang_version CC clang 19.0.0git78b4e7c5 clang-19
 test_fix_clang_version CC clang 17.0.6 clang-17
 test_fix_clang_version CXX clang++ 17.0.6 clang++-17
@@ -79,4 +94,13 @@ test_fix_tool_path RANLIB llvm-ranlib 1
 test_fix_tool_path AR ar 1
 test_fix_tool_path AR ar 0
 
+ESYSROOT=
+test_prepend_path 17 /usr/bin /usr/bin:/usr/lib/llvm/17/bin
+test_prepend_path 17 /usr/lib/llvm/17/bin:/usr/bin /usr/lib/llvm/17/bin:/usr/bin
+test_prepend_path 17 /usr/bin:/usr/lib/llvm/17/bin /usr/bin:/usr/lib/llvm/17/bin
+test_prepend_path 18 /usr/lib/llvm/17/bin:/usr/bin \
+	/usr/lib/llvm/18/bin:/usr/lib/llvm/17/bin:/usr/bin
+test_prepend_path 18 /usr/bin:/usr/lib/llvm/17/bin \
+	/usr/bin:/usr/lib/llvm/18/bin:/usr/lib/llvm/17/bin
+
 texit


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: eclass/, eclass/tests/
@ 2024-02-10 10:47 Michał Górny
  0 siblings, 0 replies; 40+ messages in thread
From: Michał Górny @ 2024-02-10 10:47 UTC (permalink / raw
  To: gentoo-commits

commit:     5fcce58386dfb317020d7c88478480592b98b4e4
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Feb  7 16:39:18 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Feb 10 10:47:21 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5fcce583

llvm-utils.eclass: Fix llvm_prepend_path to avoid duplicates

Fix llvm_prepend_path() not to append the new path multiple times,
if the original PATH variable contained multiple LLVM directories.

Thanks to Alexander Miller who spotted it in:
https://github.com/gentoo/gentoo/pull/35196#discussion_r1480330001

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 eclass/llvm-utils.eclass   | 10 ++++++----
 eclass/tests/llvm-utils.sh | 12 ++++++++++++
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/eclass/llvm-utils.eclass b/eclass/llvm-utils.eclass
index f308667e3dc2..532e609679b8 100644
--- a/eclass/llvm-utils.eclass
+++ b/eclass/llvm-utils.eclass
@@ -129,16 +129,18 @@ llvm_prepend_path() {
 	local new_path=()
 	local x added=
 
-	# prepend new path in front of the first LLVM version found
 	for x in "${split_path[@]}"; do
 		if [[ ${x} == */usr/lib/llvm/*/bin ]]; then
-			if [[ ${x} != ${llvm_path} ]]; then
+			# prepend new path in front of the first LLVM version found
+			if [[ ! ${added} ]]; then
 				new_path+=( "${llvm_path}" )
-			elif [[ ${added} && ${x} == ${llvm_path} ]]; then
+				added=1
+			fi
+			# remove duplicate copies of the same path
+			if [[ ${x} == ${llvm_path} ]]; then
 				# deduplicate
 				continue
 			fi
-			added=1
 		fi
 		new_path+=( "${x}" )
 	done

diff --git a/eclass/tests/llvm-utils.sh b/eclass/tests/llvm-utils.sh
index 5a46b25b7ad6..6fe3da3eda13 100755
--- a/eclass/tests/llvm-utils.sh
+++ b/eclass/tests/llvm-utils.sh
@@ -98,9 +98,21 @@ ESYSROOT=
 test_prepend_path 17 /usr/bin /usr/bin:/usr/lib/llvm/17/bin
 test_prepend_path 17 /usr/lib/llvm/17/bin:/usr/bin /usr/lib/llvm/17/bin:/usr/bin
 test_prepend_path 17 /usr/bin:/usr/lib/llvm/17/bin /usr/bin:/usr/lib/llvm/17/bin
+test_prepend_path 17 /usr/lib/llvm/17/bin:/usr/bin:/usr/lib/llvm/17/bin \
+	/usr/lib/llvm/17/bin:/usr/bin
+test_prepend_path 17 /usr/lib/llvm/17/bin:/usr/lib/llvm/17/bin:/usr/bin \
+	/usr/lib/llvm/17/bin:/usr/bin
+test_prepend_path 17 /usr/bin:/usr/lib/llvm/17/bin:/usr/lib/llvm/17/bin \
+	/usr/bin:/usr/lib/llvm/17/bin
 test_prepend_path 18 /usr/lib/llvm/17/bin:/usr/bin \
 	/usr/lib/llvm/18/bin:/usr/lib/llvm/17/bin:/usr/bin
 test_prepend_path 18 /usr/bin:/usr/lib/llvm/17/bin \
 	/usr/bin:/usr/lib/llvm/18/bin:/usr/lib/llvm/17/bin
+test_prepend_path 18 /usr/lib/llvm/17/bin:/usr/lib/llvm/16/bin:/usr/bin \
+	/usr/lib/llvm/18/bin:/usr/lib/llvm/17/bin:/usr/lib/llvm/16/bin:/usr/bin
+test_prepend_path 18 /usr/bin:/usr/lib/llvm/17/bin:/usr/lib/llvm/16/bin \
+	/usr/bin:/usr/lib/llvm/18/bin:/usr/lib/llvm/17/bin:/usr/lib/llvm/16/bin
+test_prepend_path 18 /usr/lib/llvm/17/bin:/usr/bin:/usr/lib/llvm/16/bin \
+	/usr/lib/llvm/18/bin:/usr/lib/llvm/17/bin:/usr/bin:/usr/lib/llvm/16/bin
 
 texit


^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: eclass/, eclass/tests/
@ 2024-05-14  8:20 Florian Schmaus
  0 siblings, 0 replies; 40+ messages in thread
From: Florian Schmaus @ 2024-05-14  8:20 UTC (permalink / raw
  To: gentoo-commits

commit:     fa90907e9d23cbbaa15567eb9924b604740aacd6
Author:     Florian Schmaus <flow <AT> gentoo <DOT> org>
AuthorDate: Thu Apr  4 15:22:25 2024 +0000
Commit:     Florian Schmaus <flow <AT> gentoo <DOT> org>
CommitDate: Tue May 14 07:58:12 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fa90907e

edo.eclass: enhance edob for usage with noisy commands

Normally, edob can, or rather should, not be used with noisy commands,
i.e., commands that produce an output. This is because the output
destroys the concept of ebegin and eend, where the eend marker is shown
on the same line that is produced by ebegin.

However, it sometimes would be nice to use edob with noisy commands, but
this means to redirect stdout and stderr of those commands. Instead of
redirecting the output to /dev/null, we save the output in a log file
under T. This allows us to present the output to the user in case the
command fails, making it furthermore part of the build.log, which we
expect users to attach to bug reports.

Closes: https://github.com/gentoo/gentoo/pull/36117
Signed-off-by: Florian Schmaus <flow <AT> gentoo.org>

 eclass/edo.eclass   |  68 ++++++++++++++++++++++++++-----
 eclass/tests/edo.sh | 113 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 171 insertions(+), 10 deletions(-)

diff --git a/eclass/edo.eclass b/eclass/edo.eclass
index c2e7ed60083f..ed8ec8d3201e 100644
--- a/eclass/edo.eclass
+++ b/eclass/edo.eclass
@@ -1,4 +1,4 @@
-# Copyright 2022 Gentoo Authors
+# Copyright 2022-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: edo.eclass
@@ -12,10 +12,16 @@
 # This eclass provides the 'edo' command, and an 'edob' variant for ebegin/eend,
 # which logs the command used verbosely and dies (exits) on failure.
 #
-# This eclass should be used only where needed to give a more verbose log, e.g.
-# for invoking non-standard ./configure scripts, or building objects/binaries
-# directly within ebuilds via compiler invocations. It is NOT to be used
-# in place of generic 'command || die' where verbosity is unnecessary.
+# The 'edo' command should be used only where needed to give a more verbose log,
+# e.g. for invoking non-standard ./configure scripts, or building
+# objects/binaries directly within ebuilds via compiler invocations.  It is NOT
+# to be used in place of generic 'command || die' where verbosity is
+# unnecessary.
+#
+# The 'edob' command can be used for long running commands, even if
+# those commands produce output.  The 'edob' command will suppress the
+# command's output and only present it if the command returned with a
+# non-zero exit status.
 case ${EAPI} in
 	7|8) ;;
 	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
@@ -35,14 +41,56 @@ edo() {
 }
 
 # @FUNCTION: edob
-# @USAGE: <command> [<args>...]
+# @USAGE: [-l <log-name>] [-m <message>] <command> [<args>...]
 # @DESCRIPTION:
 # Executes 'command' with ebegin & eend with any given arguments and exits
-# on failure unless called under 'nonfatal'.
+# on failure unless called under 'nonfatal'.  This function redirects
+# stdout and stderr to a log file.  The content of the log file is shown
+# if the command returns with a non-zero exit status.
+#
+# If -m <message> is provided, then invokes ebegin with <message>, otherwise
+# a default message is used.  If -l <log-name> is provided, then <log-name> is
+# used to construct the name of the log file where stdout and stderr of the
+# command is redirected to.
 edob() {
-	ebegin "Running $@"
-	"$@"
-	eend $? || die -n "Failed to run command: $@"
+	local message
+	local log_name
+
+	while true; do
+		case "${1}" in
+			-l|-m)
+				[[ $# -lt 2 ]] && die "Must provide an argument to ${1}"
+				case "${1}" in
+					-l)
+						log_name="${2}"
+						;;
+					-m)
+						message="${2}"
+						;;
+				esac
+				shift 2
+				;;
+			*)
+				break
+				;;
+		esac
+	done
+
+	[[ -z ${message} ]] && message="Running $@"
+	[[ -z ${log_name} ]] && log_name="$(basename ${1})"
+
+	local log_file="${T}/${log_name}.log"
+	[[ -f ${log_file} ]] && die "Log file ${log_file} exists. Consider using \"edob -l\""
+
+	ebegin "${message}"
+
+	"$@" &> "${log_file}"
+	local ret=$?
+
+	if ! eend $ret; then
+		cat "${log_file}"
+		die -n "Command \"$@\" failed with exit status $ret"
+	fi
 }
 
 fi

diff --git a/eclass/tests/edo.sh b/eclass/tests/edo.sh
new file mode 100755
index 000000000000..cac03e0401ba
--- /dev/null
+++ b/eclass/tests/edo.sh
@@ -0,0 +1,113 @@
+#!/bin/bash
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+source tests-common.sh || exit
+
+inherit edo
+
+make_some_noise() {
+	echo "Here is some noise:"
+	echo "${1:?Must provide some noise}"
+	echo "EoN"
+}
+
+test_edob_simple() {
+	tbegin "edob with output test"
+	(
+		edob make_some_noise foo
+		eend $?
+	) &> "${T}/edob.out"
+	local res=$?
+	if [[ $res -ne 0 ]]; then
+		tend $res
+		return 0
+	fi
+
+	local log_file="${T}/make_some_noise.log"
+	local second_line="$(sed -n '2p' "${log_file}")"
+    [[ "${second_line}" == "foo" ]];
+	tend $? "Unexpected output, found \"${second_line}\", expected \"foo\""
+
+	rm "${log_file}" || die
+}
+
+test_edob_explicit_log_name() {
+	tbegin "edob with explicit logfile name"
+	(
+		edob -l mylog make_some_noise bar
+		eend $?
+	) &> "${T}/edob.out"
+	local res=$?
+	if [[ $res -ne 0 ]]; then
+		cat "${T}/edob.out"
+		tend $res
+		return 0
+	fi
+
+	local log_file="${T}/mylog.log"
+	local second_line="$(sed -n '2p' "${log_file}")"
+    [[ "${second_line}" == "bar" ]];
+	tend $? "Unexpected output, found \"${second_line}\", expected \"foo\""
+
+	rm "${log_file}" || die
+}
+
+test_edob_explicit_message() {
+	tbegin "edob with explicit message"
+	(
+		edob -m "Making some noise" make_some_noise baz
+		eend $?
+	) &> "${T}/edob.out"
+	local res=$?
+	if [[ $res -ne 0 ]]; then
+		cat "${T}/edob.out"
+		tend $res
+		return 0
+	fi
+
+	local log_file="${T}/make_some_noise.log"
+	local second_line="$(sed -n '2p' "${log_file}")"
+    [[ "${second_line}" == "baz" ]];
+	tend $? "Unexpected output, found \"${second_line}\", expected \"baz\""
+
+	rm "${log_file}" || die
+}
+
+test_edob_failure() {
+	make_some_noise_and_fail() {
+		make_some_noise "$@"
+		return 1
+	}
+
+	tbegin "edob with failing command"
+	(
+		edob -m "Making some noise" make_some_noise_and_fail quz
+		eend $?
+	) &> "${T}/edob.out"
+	local res=$?
+	# Now, this time we expect res to be exactly '1'.
+	if [[ $res -ne 1 ]]; then
+		tend 1
+		return 1
+	fi
+
+	local log_file="${T}/make_some_noise_and_fail.log"
+	local second_line="$(sed -n '2p' "${log_file}")"
+    [[ "${second_line}" == "quz" ]];
+	tend $? "Unexpected output, found \"${second_line}\", expected \"quz\""
+
+	rm "${log_file}" || die
+
+	local fourth_line_of_edob_out="$(sed -n '4p' "${T}/edob.out")"
+	[[ "${fourth_line_of_edob_out}" == "quz" ]];
+	tend $? "Unexpected output, found \"${fourth_line_of_edob_out}\", expected \"quz\""
+}
+
+test_edob_simple
+test_edob_explicit_log_name
+test_edob_explicit_message
+test_edob_failure
+
+texit


^ permalink raw reply related	[flat|nested] 40+ messages in thread

end of thread, other threads:[~2024-05-14  8:20 UTC | newest]

Thread overview: 40+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-23  4:36 [gentoo-commits] repo/gentoo:master commit in: eclass/, eclass/tests/ Michał Górny
  -- strict thread matches above, loose matches on Subject: below --
2024-05-14  8:20 Florian Schmaus
2024-02-10 10:47 Michał Górny
2024-02-10 10:47 Michał Górny
2023-10-09 10:54 Florian Schmaus
2023-09-14  5:30 Michał Górny
2023-06-07  7:00 Ulrich Müller
2023-03-21  5:43 Michał Górny
2023-03-17 22:04 David Seifert
2023-02-12 19:05 Michał Górny
2022-12-24 20:16 Michał Górny
2022-10-19 11:53 Michał Górny
2022-10-10 20:52 Michał Górny
2022-09-27 20:28 Michał Górny
2022-09-27 20:28 Michał Górny
2022-09-27 20:28 Michał Górny
2022-05-09 20:33 Michał Górny
2022-04-02 16:29 Michał Górny
2022-01-09  8:09 Michał Górny
2021-08-17  1:41 Sam James
2021-06-01 17:27 Sergei Trofimovich
2020-05-28 11:41 Michał Górny
2020-03-27 23:54 Sergei Trofimovich
2020-03-20 22:33 Sergei Trofimovich
2020-01-26 22:47 Sergei Trofimovich
2019-12-30 12:59 Michał Górny
2019-12-30 12:59 Michał Górny
2019-10-19 21:20 Sergei Trofimovich
2019-06-23  8:53 Sergei Trofimovich
2018-08-15  7:31 Michał Górny
2017-09-26 18:46 Ulrich Müller
2017-08-25 13:53 Michał Górny
2016-12-18 13:47 Michał Górny
2016-06-26 15:36 Michał Górny
2016-05-29  9:23 Amadeusz Piotr Żołnowski
2016-05-22 22:06 Amadeusz Piotr Żołnowski
2016-01-08  5:14 Michał Górny
2015-11-11 10:27 Michał Górny
2015-11-11 10:27 Michał Górny
2015-11-11 10:27 Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox