QA warnings for calling the obsolete check_reqs function and for
missing size units were in place for more than two years, and usage
in the Gentoo repository has been fixed.

Error out on all obsolete usage. This will also allow dropping the
eutils inherit which was only needed for eqawarn().
---
 eclass/check-reqs.eclass | 33 ++++++---------------------------
 1 file changed, 6 insertions(+), 27 deletions(-)

diff --git a/eclass/check-reqs.eclass b/eclass/check-reqs.eclass
index fe1852213441..781991da84ba 100644
--- a/eclass/check-reqs.eclass
+++ b/eclass/check-reqs.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: check-reqs.eclass
@@ -39,8 +39,6 @@
 
 if [[ ! ${_CHECK_REQS_ECLASS_} ]]; then
 
-inherit eutils
-
 # @ECLASS-VARIABLE: CHECKREQS_MEMORY
 # @DEFAULT_UNSET
 # @DESCRIPTION:
@@ -68,22 +66,13 @@ case "${EAPI:-0}" in
        *) die "EAPI=${EAPI} is not supported" ;;
 esac
 
-# @FUNCTION: check_reqs
-# @DESCRIPTION:
 # Obsolete function executing all the checks and printing out results
 check_reqs() {
        debug-print-function ${FUNCNAME} "$@"
 
-       [[ ${EAPI:-0} == [012345] ]] || die "${FUNCNAME} is banned in EAPI > 5"
-
-       echo
-       eqawarn "Package calling old ${FUNCNAME} function."
-       eqawarn "Please file a bug against the package."
-       eqawarn "It should call check-reqs_pkg_pretend and check-reqs_pkg_setup"
-       eqawarn "and possibly use EAPI=4 or later."
-       echo
-
-       check-reqs_pkg_setup "$@"
+       eerror "Package calling old ${FUNCNAME} function."
+       eerror "It should call check-reqs_pkg_pretend and check-reqs_pkg_setup."
+       die "${FUNCNAME} is banned"
 }
 
 # @FUNCTION: check-reqs_pkg_setup
@@ -179,7 +168,6 @@ check-reqs_get_kibibytes() {
                G) echo $((1024 * 1024 * size)) ;;
                M) echo $((1024 * size)) ;;
                T) echo $((1024 * 1024 * 1024 * size)) ;;
-               [0-9]) echo $((1024 * size)) ;;
                *)
                        die "${FUNCNAME}: Unknown unit: ${unit}"
                ;;
@@ -196,17 +184,8 @@ check-reqs_get_number() {
 
        [[ -z ${1} ]] && die "Usage: ${FUNCNAME} [size]"
 
-       local unit=${1:(-1)}
        local size=${1%[GMT]}
-       local msg=eerror
-       [[ ${EAPI:-0} == [012345] ]] && msg=eqawarn
-
-       # Check for unset units and warn about them.
-       # Backcompat.
-       if [[ ${size} == ${1} ]]; then
-               ${msg} "Package does not specify unit for the size check"
-               ${msg} "File bug against the package. It should specify the 
unit."
-       fi
+       [[ ${size} == ${1} ]] && die "${FUNCNAME}: Missing unit: ${1}"
 
        echo ${size}
 }
@@ -225,7 +204,7 @@ check-reqs_get_unit() {
 
        case ${unit} in
                G) echo "GiB" ;;
-               [M0-9]) echo "MiB" ;;
+               M) echo "MiB" ;;
                T) echo "TiB" ;;
                *)
                        die "${FUNCNAME}: Unknown unit: ${unit}"
-- 
2.15.1

Attachment: pgpnMV_ZOroTR.pgp
Description: PGP signature

Reply via email to