public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: David Seifert <soap@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: David Seifert <soap@gentoo.org>
Subject: [gentoo-dev] [PATCH 22/22] eclass: standardize prologue/epilogue
Date: Tue, 14 Mar 2023 20:58:26 +0100	[thread overview]
Message-ID: <20230314195826.35239-22-soap@gentoo.org> (raw)
In-Reply-To: <20230314195826.35239-1-soap@gentoo.org>

Signed-off-by: David Seifert <soap@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                  | 11 ++++++++---
 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(+), 373 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 bcdd521619ac..d4e62b9283a4 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
-
-if [[ -z ${_GO_MODULE} ]]; then
+if [[ -z ${_GO_MODULE_ECLASS} ]]; then
+_GO_MODULE_ECLASS=1
 
-_GO_MODULE=1
+inherit multiprocessing
 
 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 94302ea1b4af..c6084673d5dc 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 ==
@@ -334,8 +331,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.
@@ -481,3 +476,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..21c94dd478d7 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
@@ -16,11 +16,14 @@
 # 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 +160,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
-- 
2.40.0



      parent reply	other threads:[~2023-03-14 20:05 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-14 19:58 [gentoo-dev] [PATCH 01/22] apache-module.eclass: remove EAPI 5 David Seifert
2023-03-14 19:58 ` [gentoo-dev] [PATCH 02/22] cron.eclass: add EAPI 8 David Seifert
2023-03-15 11:01   ` Emily
2023-03-15 11:12     ` Ulrich Mueller
2023-03-14 19:58 ` [gentoo-dev] [PATCH 03/22] cron.eclass: remove EAPI 6 David Seifert
2023-03-14 19:58 ` [gentoo-dev] [PATCH 04/22] db.eclass: add EAPI allowlist David Seifert
2023-03-14 19:58 ` [gentoo-dev] [PATCH 05/22] eapi8-dosym.eclass: remove EAPI 5, 6 David Seifert
2023-03-14 19:58 ` [gentoo-dev] [PATCH 06/22] findlib.eclass: remove EAPI 6 David Seifert
2023-03-14 19:58 ` [gentoo-dev] [PATCH 07/22] git-r3.eclass: remove EAPI 5 David Seifert
2023-03-14 19:58 ` [gentoo-dev] [PATCH 08/22] gnome2.eclass: " David Seifert
2023-03-14 19:58 ` [gentoo-dev] [PATCH 09/22] golang-build.eclass: " David Seifert
2023-03-14 19:58 ` [gentoo-dev] [PATCH 10/22] golang-vcs-snapshot.eclass: " David Seifert
2023-03-14 19:58 ` [gentoo-dev] [PATCH 11/22] golang-vcs.eclass: " David Seifert
2023-03-14 19:58 ` [gentoo-dev] [PATCH 12/22] libtool.eclass: " David Seifert
2023-03-14 19:58 ` [gentoo-dev] [PATCH 13/22] linux-info.eclass: remove EAPI 0-5 David Seifert
2023-03-14 19:58 ` [gentoo-dev] [PATCH 14/22] mono-env.eclass: remove EAPI 5 David Seifert
2023-03-14 19:58 ` [gentoo-dev] [PATCH 15/22] office-ext-r1.eclass: " David Seifert
2023-03-14 19:58 ` [gentoo-dev] [PATCH 16/22] qmail.eclass: remove EAPI 6 David Seifert
2023-03-14 19:58 ` [gentoo-dev] [PATCH 17/22] subversion.eclass: " David Seifert
2023-03-14 19:58 ` [gentoo-dev] [PATCH 18/22] sword-module.eclass: last-rite David Seifert
2023-03-14 19:58 ` [gentoo-dev] [PATCH 19/22] vdr-plugin-2.eclass: remove EAPI 5 David Seifert
2023-03-14 19:58 ` [gentoo-dev] [PATCH 20/22] webapp.eclass: " David Seifert
2023-03-14 19:58 ` [gentoo-dev] [PATCH 21/22] xdg.eclass: " David Seifert
2023-03-14 19:58 ` David Seifert [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230314195826.35239-22-soap@gentoo.org \
    --to=soap@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox