From be55691ed16c2ab4dd7c3d635fc2bd67ecd6b563 Mon Sep 17 00:00:00 2001
From: Thomas Bracht Laumann Jespersen
Date: Fri, 15 Apr 2022 23:42:03 +0200
Subject: eclass-writing: doc inherit guards, EXPORT_FUNCTIONS warning
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Add a section to explain what inherit guards are and their usage, and
add a "rule of thumb" to put EXPORT_FUNCTIONS at the end of eclasses for
max portability.
This turned into a larger re-ordering of the sections so the full jmake
example can showcase all the features discussed in the preceding
sections, like EAPI guard, inherit guard, and EXPORT_FUNCTIONS at the
very end.
Signed-off-by: Thomas Bracht Laumann Jespersen
Signed-off-by: Ulrich Müller
---
eclass-writing/text.xml | 156 +++++++++++++++++++++++++++++++++++++-----------
1 file changed, 122 insertions(+), 34 deletions(-)
(limited to 'eclass-writing')
diff --git a/eclass-writing/text.xml b/eclass-writing/text.xml
index f0f03c0..22b973f 100644
--- a/eclass-writing/text.xml
+++ b/eclass-writing/text.xml
@@ -638,11 +638,11 @@ eclass-defined defaults for example, say we had fnord.eclass:
-EXPORT_FUNCTIONS src_compile
-
fnord_src_compile() {
do_stuff || die
}
+
+EXPORT_FUNCTIONS src_compile
@@ -659,6 +659,115 @@ src_compile() {
}
+
+Eclasses may inherit other eclasses to make use of their functionality, and
+historically there have been instances of eclasses calling
+EXPORT_FUNCTIONS and then inheriting another eclass. As inherited
+eclasses may also execute EXPORT_FUNCTIONS, it was not fully defined
+which defaults should take effect. The general recommendation is now that
+eclasses should not inherit other eclasses after calling
+EXPORT_FUNCTIONS.
+
+
+