[PATCH 1/2] Revert "Revert "Generate a QA Notice when EXPORT_FUNCTIONS is called before inherit""

Ulrich Müller <[email protected]> Sun, 29 Aug 2021 22:06:38 +0200
Newsgroups gmane.linux.gentoo.portage.devel
Message-ID <[email protected]>
Reinstate the QA notice, because Portage behavior deviates from PMS,
and breakage of eclasses with Pkgcore has been observed recently.

This reverts commit f44d32550861cb25c209ef61dcd7ae1aa230da1f.

Bug: https://bugs.gentoo.org/399039
Signed-off-by: Ulrich Müller <[email protected]>
---
 bin/ebuild.sh | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index 5916bedfc..1bca2c965 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -243,6 +243,14 @@ inherit() {
 	ECLASS_DEPTH=$(($ECLASS_DEPTH + 1))
 	if [[ ${ECLASS_DEPTH} -gt 1 ]]; then
 		debug-print "*** Multiple Inheritence (Level: ${ECLASS_DEPTH})"
+
+		# Since ECLASS_DEPTH > 1, the following variables are locals from the
+		# previous inherit call in the call stack.
+		if [[ -n ${ECLASS} && -n ${!__export_funcs_var} ]] ; then
+			eqawarn "QA Notice: EXPORT_FUNCTIONS is called before inherit in ${ECLASS}.eclass."
+			eqawarn "For compatibility with <=portage-2.1.6.7, only call EXPORT_FUNCTIONS"
+			eqawarn "after inherit(s)."
+		fi
 	fi
 
 	local -x ECLASS
-- 
2.33.0