From 2b398c91079022385fd932ff4159692822e96402 Mon Sep 17 00:00:00 2001 From: Brian Harring Date: Fri, 31 Dec 2010 08:32:44 -0800 Subject: [PATCH] bug 341961; add text about die in global scope --- eclass-writing/text.xml | 29 +++++++++++++++++++++++++++++ 1 files changed, 29 insertions(+), 0 deletions(-) diff --git a/eclass-writing/text.xml b/eclass-writing/text.xml index 36927ac..a770a9c 100644 --- a/eclass-writing/text.xml +++ b/eclass-writing/text.xml @@ -295,6 +295,35 @@ jmake_src_compile() { +
+Handling incorrect usage of an eclass + + +

+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: +

+ + +# 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 + + +
+ -- 1.7.3.4