Files
gentoo/eclass/vcs-clean.eclass
Sam James 649d76b85a 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@gentoo.org>
Signed-off-by: David Seifert <soap@gentoo.org>
2021-06-20 23:15:43 +02:00

52 lines
1.4 KiB
Bash

# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: vcs-clean.eclass
# @MAINTAINER:
# base-system@gentoo.org
# @AUTHOR:
# Benedikt Böhm <hollow@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:
# Remove CVS directories and .cvs* files recursively. Useful when a
# source tarball contains internal CVS directories. Defaults to ${PWD}.
ecvs_clean() {
[[ $# -eq 0 ]] && set -- .
find "$@" '(' -type d -name 'CVS' -prune -o -type f -name '.cvs*' ')' \
-exec rm -rf '{}' +
}
# @FUNCTION: esvn_clean
# @USAGE: [list of dirs]
# @DESCRIPTION:
# Remove .svn directories recursively. Useful when a source tarball
# contains internal Subversion directories. Defaults to ${PWD}.
esvn_clean() {
[[ $# -eq 0 ]] && set -- .
find "$@" -type d -name '.svn' -prune -exec rm -rf '{}' +
}
# @FUNCTION: egit_clean
# @USAGE: [list of dirs]
# @DESCRIPTION:
# Remove .git* directories recursively. Useful when a source tarball
# contains internal Git directories. Defaults to ${PWD}.
egit_clean() {
[[ $# -eq 0 ]] && set -- .
find "$@" -type d -name '.git*' -prune -exec rm -rf '{}' +
}
fi