aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Harring <ferringb@gmail.com>2010-12-31 08:32:44 -0800
committerJeremy Olexa <darkside@gentoo.org>2011-02-03 16:47:12 +0000
commit4ada72fc43918e1d8d652deb9e5f0d1e060a36ef (patch)
treeceaa73e13be43b9f85d261369d53db9609aa1545 /eclass-writing
parentWrite page about profiles/updates/ (diff)
downloaddevmanual-4ada72fc43918e1d8d652deb9e5f0d1e060a36ef.tar.gz
devmanual-4ada72fc43918e1d8d652deb9e5f0d1e060a36ef.tar.bz2
devmanual-4ada72fc43918e1d8d652deb9e5f0d1e060a36ef.zip
bug 341961; add text about die in global scope
Diffstat (limited to 'eclass-writing')
-rw-r--r--eclass-writing/text.xml29
1 files changed, 29 insertions, 0 deletions
diff --git a/eclass-writing/text.xml b/eclass-writing/text.xml
index d1dd78c..b895696 100644
--- a/eclass-writing/text.xml
+++ b/eclass-writing/text.xml
@@ -285,6 +285,35 @@ jmake_src_compile() {
</body>
</section>
+<section>
+<title>Handling incorrect usage of an eclass</title>
+<body>
+
+<p>
+Sometimes an eclass is used incorrectly by an ebuild and the eclass
+knows it is being used incorrectly- the common example is an
+eclass that only works with a specific set of EAPIs, but is being
+accessed inherited by an ebuild with a different EAPI.
+In those cases, used sparingly as a last resort, it is allowed
+for an eclass to invoke die from the global scope. For example:
+</p>
+
+<codesample lang="ebuild">
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+# Original Author: Captain Tight Pant
+# Purpose: Demonstration of die upon invalid EAPI usage.
+
+case ${EAPI:-0} in
+ 0) die "this eclass doesn't support EAPI 0" ;;
+ *) ;;
+esac
+</codesample>
+</body>
+</section>
+
</body>
</chapter>