commit:     9e892293b5c2517fa7d25c07d351f192ace0d1f0
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 20 21:15:55 2021 +0000
Commit:     David Seifert <soap <AT> gentoo <DOT> org>
CommitDate: Sun Jun 20 21:15:55 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9e892293

webapp.eclass: [QA] add EAPI guard

* Declare supported EAPIs as: [QA] 5, 6, 7
* Add guards to die on unsupported/untested EAPIs
* Add inherit guards to prevent multiple sourcing

Signed-off-by: Sam James <sam <AT> gentoo.org>
Signed-off-by: David Seifert <soap <AT> gentoo.org>

 eclass/webapp.eclass | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/eclass/webapp.eclass b/eclass/webapp.eclass
index 6907ef1c321..5ef7dbce03c 100644
--- a/eclass/webapp.eclass
+++ b/eclass/webapp.eclass
@@ -4,11 +4,22 @@
 # @ECLASS: webapp.eclass
 # @MAINTAINER:
 # web-a...@gentoo.org
+# @SUPPORTED_EAPIS: 5 6 7
 # @BLURB: functions for installing applications to run under a web server
 # @DESCRIPTION:
 # The webapp eclass contains functions to handle web applications with
 # webapp-config. Part of the implementation of GLEP #11
 
+case ${EAPI:-0} in
+       [567]) ;;
+       *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
+esac
+
+EXPORT_FUNCTIONS pkg_postinst pkg_setup src_install pkg_prerm
+
+if [[ -z ${_WEBAPP_ECLASS} ]]; then
+_WEBAPP_ECLASS=1
+
 # @ECLASS-VARIABLE: WEBAPP_DEPEND
 # @DESCRIPTION:
 # An ebuild should use WEBAPP_DEPEND if a custom DEPEND needs to be built, most
@@ -35,8 +46,6 @@ if [[ "${WEBAPP_OPTIONAL}" != "yes" ]]; then
        RDEPEND="${DEPEND}"
 fi
 
-EXPORT_FUNCTIONS pkg_postinst pkg_setup src_install pkg_prerm
-
 INSTALL_DIR="/${PN}"
 IS_UPGRADE=0
 IS_REPLACE=0
@@ -577,3 +586,5 @@ webapp_pkg_prerm() {
                echo
        fi
 }
+
+fi

Reply via email to