Gentoo Archives: gentoo-dev

From: "Ulrich Müller" <ulm@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] [PATCH] check-reqs.eclass: Make obsolete usage fatal.
Date: Fri, 12 Jan 2018 09:35:34
Message-Id: 23128.33114.231817.891589@a1i15.kph.uni-mainz.de
1 QA warnings for calling the obsolete check_reqs function and for
2 missing size units were in place for more than two years, and usage
3 in the Gentoo repository has been fixed.
4
5 Error out on all obsolete usage. This will also allow dropping the
6 eutils inherit which was only needed for eqawarn().
7 ---
8 eclass/check-reqs.eclass | 33 ++++++---------------------------
9 1 file changed, 6 insertions(+), 27 deletions(-)
10
11 diff --git a/eclass/check-reqs.eclass b/eclass/check-reqs.eclass
12 index fe1852213441..781991da84ba 100644
13 --- a/eclass/check-reqs.eclass
14 +++ b/eclass/check-reqs.eclass
15 @@ -1,4 +1,4 @@
16 -# Copyright 1999-2017 Gentoo Foundation
17 +# Copyright 1999-2018 Gentoo Foundation
18 # Distributed under the terms of the GNU General Public License v2
19
20 # @ECLASS: check-reqs.eclass
21 @@ -39,8 +39,6 @@
22
23 if [[ ! ${_CHECK_REQS_ECLASS_} ]]; then
24
25 -inherit eutils
26 -
27 # @ECLASS-VARIABLE: CHECKREQS_MEMORY
28 # @DEFAULT_UNSET
29 # @DESCRIPTION:
30 @@ -68,22 +66,13 @@ case "${EAPI:-0}" in
31 *) die "EAPI=${EAPI} is not supported" ;;
32 esac
33
34 -# @FUNCTION: check_reqs
35 -# @DESCRIPTION:
36 # Obsolete function executing all the checks and printing out results
37 check_reqs() {
38 debug-print-function ${FUNCNAME} "$@"
39
40 - [[ ${EAPI:-0} == [012345] ]] || die "${FUNCNAME} is banned in EAPI > 5"
41 -
42 - echo
43 - eqawarn "Package calling old ${FUNCNAME} function."
44 - eqawarn "Please file a bug against the package."
45 - eqawarn "It should call check-reqs_pkg_pretend and check-reqs_pkg_setup"
46 - eqawarn "and possibly use EAPI=4 or later."
47 - echo
48 -
49 - check-reqs_pkg_setup "$@"
50 + eerror "Package calling old ${FUNCNAME} function."
51 + eerror "It should call check-reqs_pkg_pretend and check-reqs_pkg_setup."
52 + die "${FUNCNAME} is banned"
53 }
54
55 # @FUNCTION: check-reqs_pkg_setup
56 @@ -179,7 +168,6 @@ check-reqs_get_kibibytes() {
57 G) echo $((1024 * 1024 * size)) ;;
58 M) echo $((1024 * size)) ;;
59 T) echo $((1024 * 1024 * 1024 * size)) ;;
60 - [0-9]) echo $((1024 * size)) ;;
61 *)
62 die "${FUNCNAME}: Unknown unit: ${unit}"
63 ;;
64 @@ -196,17 +184,8 @@ check-reqs_get_number() {
65
66 [[ -z ${1} ]] && die "Usage: ${FUNCNAME} [size]"
67
68 - local unit=${1:(-1)}
69 local size=${1%[GMT]}
70 - local msg=eerror
71 - [[ ${EAPI:-0} == [012345] ]] && msg=eqawarn
72 -
73 - # Check for unset units and warn about them.
74 - # Backcompat.
75 - if [[ ${size} == ${1} ]]; then
76 - ${msg} "Package does not specify unit for the size check"
77 - ${msg} "File bug against the package. It should specify the unit."
78 - fi
79 + [[ ${size} == ${1} ]] && die "${FUNCNAME}: Missing unit: ${1}"
80
81 echo ${size}
82 }
83 @@ -225,7 +204,7 @@ check-reqs_get_unit() {
84
85 case ${unit} in
86 G) echo "GiB" ;;
87 - [M0-9]) echo "MiB" ;;
88 + M) echo "MiB" ;;
89 T) echo "TiB" ;;
90 *)
91 die "${FUNCNAME}: Unknown unit: ${unit}"
92 --
93 2.15.1