summaryrefslogtreecommitdiff
path: root/eclass/alternatives.eclass
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2021-06-21 17:32:00 +0100
committerV3n3RiX <venerix@redcorelinux.org>2021-06-21 17:32:00 +0100
commit61f10f985e19dfe20a4d9552902625edd5b6eabb (patch)
tree50db31971b38c4e0358253ef5005058a46fc773e /eclass/alternatives.eclass
parent34dea8e38f88007799629d0a56b12dec480b1d21 (diff)
gentoo resync : 21.06.2021
Diffstat (limited to 'eclass/alternatives.eclass')
-rw-r--r--eclass/alternatives.eclass22
1 files changed, 17 insertions, 5 deletions
diff --git a/eclass/alternatives.eclass b/eclass/alternatives.eclass
index e83326314261..d6bb6b19e973 100644
--- a/eclass/alternatives.eclass
+++ b/eclass/alternatives.eclass
@@ -6,6 +6,7 @@
# maintainer-needed@gentoo.org
# @AUTHOR:
# Alastair Tse <liquidx@gentoo.org> (03 Oct 2003)
+# @SUPPORTED_EAPIS: 5 6 7
# @BLURB: Creates symlink to the latest version of multiple slotted packages.
# @DESCRIPTION:
# When a package is SLOT'ed, very often we need to have a symlink to the
@@ -40,6 +41,16 @@
# link to. It is probably more robust against version upgrades. You should
# consider using this unless you are want to do something special.
+case ${EAPI} in
+ [5-7]) ;;
+ *) die "EAPI=${EAPI:-0} is not supported" ;;
+esac
+
+EXPORT_FUNCTIONS pkg_postinst pkg_postrm
+
+if [[ -z ${_ALTERNATIVES_ECLASS} ]]; then
+_ALTERNATIVES_ECLASS=1
+
# @ECLASS-VARIABLE: SOURCE
# @DEFAULT_UNSET
# @DESCRIPTION:
@@ -52,9 +63,8 @@
# @FUNCTION: alternatives_auto_makesym
# @DESCRIPTION:
-# automatic deduction based on a symlink and a regex mask
+# Automatic deduction (Bash pathname expansion) based on a symlink and a regex mask
alternatives_auto_makesym() {
- has "${EAPI:-0}" 0 1 2 && ! use prefix && EROOT="${ROOT}"
local SYMLINK REGEX ALT myregex
SYMLINK=$1
REGEX=$2
@@ -74,8 +84,10 @@ alternatives_auto_makesym() {
alternatives_makesym ${SYMLINK} ${ALT}
}
+# @FUNCTION: alternatives_makesym
+# @DESCRIPTION:
+# Creates symlink based on a symlink and regex mask literally
alternatives_makesym() {
- has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
local ALTERNATIVES=""
local SYMLINK=""
local alt pref
@@ -123,7 +135,7 @@ alternatives_makesym() {
fi
}
-# @FUNCTION: alernatives-pkg_postinst
+# @FUNCTION: alternatives_pkg_postinst
# @DESCRIPTION:
# The alternatives pkg_postinst, this function will be exported
alternatives_pkg_postinst() {
@@ -141,4 +153,4 @@ alternatives_pkg_postrm() {
fi
}
-EXPORT_FUNCTIONS pkg_postinst pkg_postrm
+fi