summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorAndreas Sturmlechner <asturm@gentoo.org>2021-07-19 22:34:34 +0200
committerAndreas Sturmlechner <asturm@gentoo.org>2021-08-03 13:13:53 +0200
commitb3a150c9d5e42fd321061b254f67547454c02a27 (patch)
treed8a2eefebdbf3ee63934266f3b213b09943470ec /eclass
parentcheck-reqs.eclass: Make check-reqs_get_number internal (diff)
downloadgentoo-b3a150c9d5e42fd321061b254f67547454c02a27.tar.gz
gentoo-b3a150c9d5e42fd321061b254f67547454c02a27.tar.bz2
gentoo-b3a150c9d5e42fd321061b254f67547454c02a27.zip
check-reqs.eclass: Make check-reqs_get_unit internal
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r--eclass/check-reqs.eclass15
1 files changed, 13 insertions, 2 deletions
diff --git a/eclass/check-reqs.eclass b/eclass/check-reqs.eclass
index 5ffff307f9ae..17ace80d95d5 100644
--- a/eclass/check-reqs.eclass
+++ b/eclass/check-reqs.eclass
@@ -228,6 +228,17 @@ _check-reqs_get_number() {
# Internal function that returns the unit without the numerical value.
# Returns "GiB" for "1G" or "TiB" for "150T".
check-reqs_get_unit() {
+ [[ ${EAPI} == [67] ]] ||
+ die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}."
+ _check-reqs_get_unit "$@"
+}
+
+# @FUNCTION: _check-reqs_get_unit
+# @INTERNAL
+# @DESCRIPTION:
+# Internal function that returns the unit without the numerical value.
+# Returns "GiB" for "1G" or "TiB" for "150T".
+_check-reqs_get_unit() {
debug-print-function ${FUNCNAME} "$@"
[[ -z ${1} ]] && die "Usage: ${FUNCNAME} [size]"
@@ -361,7 +372,7 @@ check-reqs_start_phase() {
local size=${1}
local location=${2}
- local sizeunit="$(_check-reqs_get_number ${size}) $(check-reqs_get_unit ${size})"
+ local sizeunit="$(_check-reqs_get_number ${size}) $(_check-reqs_get_unit ${size})"
ebegin "Checking for at least ${sizeunit} ${location}"
}
@@ -380,7 +391,7 @@ check-reqs_unsatisfied() {
local msg="ewarn"
local size=${1}
local location=${2}
- local sizeunit="$(_check-reqs_get_number ${size}) $(check-reqs_get_unit ${size})"
+ local sizeunit="$(_check-reqs_get_number ${size}) $(_check-reqs_get_unit ${size})"
[[ ${EBUILD_PHASE} == "pretend" && -z ${I_KNOW_WHAT_I_AM_DOING} ]] && msg="eerror"
${msg} "There is NOT at least ${sizeunit} ${location}"