commit:     b3a150c9d5e42fd321061b254f67547454c02a27
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 19 20:34:34 2021 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Tue Aug  3 11:13:53 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b3a150c9

check-reqs.eclass: Make check-reqs_get_unit internal

Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

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

diff --git a/eclass/check-reqs.eclass b/eclass/check-reqs.eclass
index 5ffff307f9a..17ace80d95d 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}"

Reply via email to