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

vcs-clean.eclass: [QA] add EAPI guard

* Declare suppported EAPIs.
* Add EAPI guard to prevent newer/older unsupported EAPIs from using this
  eclass when they've not been tested/eclass isn't adapted for it.
* Add inherit guard as is convention.

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

 eclass/vcs-clean.eclass | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/eclass/vcs-clean.eclass b/eclass/vcs-clean.eclass
index 649a9e3039b..89f6b732187 100644
--- a/eclass/vcs-clean.eclass
+++ b/eclass/vcs-clean.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: vcs-clean.eclass
@@ -6,8 +6,17 @@
 # base-sys...@gentoo.org
 # @AUTHOR:
 # Benedikt Böhm <hol...@gentoo.org>
+# @SUPPORTED_EAPIS: 5 6 7
 # @BLURB: helper functions to remove VCS directories
 
+case ${EAPI:-0} in
+       [567]) ;;
+       *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
+esac
+
+if [[ -z ${_VCS_CLEAN_ECLASS} ]] ; then
+_VCS_CLEAN_ECLASS=1
+
 # @FUNCTION: ecvs_clean
 # @USAGE: [list of dirs]
 # @DESCRIPTION:
@@ -38,3 +47,5 @@ egit_clean() {
        [[ $# -eq 0 ]] && set -- .
        find "$@" -type d -name '.git*' -prune -exec rm -rf '{}' +
 }
+
+fi

Reply via email to