1 |
scarabeus 11/09/05 08:22:32 |
2 |
|
3 |
Modified: check-reqs.eclass |
4 |
Log: |
5 |
Add the updated check-reqs eclass as per gentoo-dev discussion. |
6 |
|
7 |
Revision Changes Path |
8 |
1.9 eclass/check-reqs.eclass |
9 |
|
10 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/check-reqs.eclass?rev=1.9&view=markup |
11 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/check-reqs.eclass?rev=1.9&content-type=text/plain |
12 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/check-reqs.eclass?r1=1.8&r2=1.9 |
13 |
|
14 |
Index: check-reqs.eclass |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo-x86/eclass/check-reqs.eclass,v |
17 |
retrieving revision 1.8 |
18 |
retrieving revision 1.9 |
19 |
diff -u -r1.8 -r1.9 |
20 |
--- check-reqs.eclass 22 Aug 2011 04:46:31 -0000 1.8 |
21 |
+++ check-reqs.eclass 5 Sep 2011 08:22:31 -0000 1.9 |
22 |
@@ -1,11 +1,12 @@ |
23 |
# Copyright 1999-2011 Gentoo Foundation |
24 |
# Distributed under the terms of the GNU General Public License v2 |
25 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/check-reqs.eclass,v 1.8 2011/08/22 04:46:31 vapier Exp $ |
26 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/check-reqs.eclass,v 1.9 2011/09/05 08:22:31 scarabeus Exp $ |
27 |
|
28 |
# @ECLASS: check-reqs.eclass |
29 |
# @MAINTAINER: |
30 |
-# Bo Ørsted Andresen <zlin@g.o> |
31 |
+# QA Team <qa@g.o> |
32 |
# @AUTHOR: |
33 |
+# Bo Ørsted Andresen <zlin@g.o> |
34 |
# Original Author: Ciaran McCreesh <ciaranm@g.o> |
35 |
# @BLURB: Provides a uniform way of handling ebuild which have very high build requirements |
36 |
# @DESCRIPTION: |
37 |
@@ -13,49 +14,24 @@ |
38 |
# build requirements in terms of memory or disk space. It provides a function |
39 |
# which should usually be called during pkg_setup(). |
40 |
# |
41 |
-# From a user perspective, the variable CHECKREQS_ACTION can be set to: |
42 |
-# * "warn" (default), which will display a warning and wait for 15s |
43 |
-# * "error", which will make the ebuild error out |
44 |
-# * "ignore", which will not take any action |
45 |
-# |
46 |
# The chosen action only happens when the system's resources are detected |
47 |
# correctly and only if they are below the threshold specified by the package. |
48 |
# |
49 |
-# For ebuild authors: only use this eclass if you reaaalllllly have stupidly |
50 |
-# high build requirements. At an absolute minimum, you shouldn't be using this |
51 |
-# unless the ebuild needs >256MBytes RAM or >1GByte temporary or install space. |
52 |
-# The code should look something like: |
53 |
-# |
54 |
# @CODE |
55 |
-# pkg_setup() { |
56 |
-# # values in MBytes |
57 |
-# |
58 |
-# # need this much memory (does *not* check swap) |
59 |
-# CHECKREQS_MEMORY="256" |
60 |
+# # need this much memory (does *not* check swap) |
61 |
+# CHECKREQS_MEMORY="256M" |
62 |
# |
63 |
-# # need this much temporary build space |
64 |
-# CHECKREQS_DISK_BUILD="2048" |
65 |
+# # need this much temporary build space |
66 |
+# CHECKREQS_DISK_BUILD="2G" |
67 |
# |
68 |
-# # install will need this much space in /usr |
69 |
-# CHECKREQS_DISK_USR="1024" |
70 |
+# # install will need this much space in /usr |
71 |
+# CHECKREQS_DISK_USR="1G" |
72 |
# |
73 |
-# # install will need this much space in /var |
74 |
-# CHECKREQS_DISK_VAR="1024" |
75 |
+# # install will need this much space in /var |
76 |
+# CHECKREQS_DISK_VAR="1024M" |
77 |
# |
78 |
-# # go! |
79 |
-# check_reqs |
80 |
-# } |
81 |
# @CODE |
82 |
# |
83 |
-# Alternatively, the check_reqs_conditional function can be used to carry out |
84 |
-# alternate actions (e.g. using a much slower but far less memory intensive |
85 |
-# build option that gives the same end result). |
86 |
-# |
87 |
-# You should *not* override the user's CHECKREQS_ACTION setting, nor should you |
88 |
-# attempt to provide a value if it is unset. Note that the environment variables |
89 |
-# are used rather than parameters for a few reasons: |
90 |
-# * easier to do if use blah ; then things |
91 |
-# * we might add in additional requirements things later |
92 |
# If you don't specify a value for, say, CHECKREQS_MEMORY, then the test is not |
93 |
# carried out. |
94 |
# |
95 |
@@ -65,143 +41,311 @@ |
96 |
inherit eutils |
97 |
|
98 |
# @ECLASS-VARIABLE: CHECKREQS_MEMORY |
99 |
+# @DEFAULT_UNSET |
100 |
# @DESCRIPTION: |
101 |
-# How much RAM is needed in MB? |
102 |
+# How much RAM is needed? Eg.: CHECKREQS_MEMORY=15M |
103 |
|
104 |
# @ECLASS-VARIABLE: CHECKREQS_DISK_BUILD |
105 |
+# @DEFAULT_UNSET |
106 |
# @DESCRIPTION: |
107 |
-# How much diskspace is needed to build the package? In MB |
108 |
+# How much diskspace is needed to build the package? Eg.: CHECKREQS_DISK_BUILD=2T |
109 |
|
110 |
# @ECLASS-VARIABLE: CHECKREQS_DISK_USR |
111 |
+# @DEFAULT_UNSET |
112 |
# @DESCRIPTION: |
113 |
-# How much space in /usr is needed to install the package? In MB |
114 |
+# How much space in /usr is needed to install the package? Eg.: CHECKREQS_DISK_USR=15G |
115 |
|
116 |
# @ECLASS-VARIABLE: CHECKREQS_DISK_VAR |
117 |
+# @DEFAULT_UNSET |
118 |
# @DESCRIPTION: |
119 |
-# How much space is needed in /var? In MB |
120 |
+# How much space is needed in /var? Eg.: CHECKREQS_DISK_VAR=3000M |
121 |
+ |
122 |
+EXPORT_FUNCTIONS pkg_setup |
123 |
+case "${EAPI:-0}" in |
124 |
+ 0|1|2|3) ;; |
125 |
+ 4) EXPORT_FUNCTIONS pkg_pretend ;; |
126 |
+ *) die "EAPI=${EAPI} is not supported" ;; |
127 |
+esac |
128 |
|
129 |
# @FUNCTION: check_reqs |
130 |
# @DESCRIPTION: |
131 |
-# Checks the requirements given in the specific variables. If not reached, |
132 |
-# either prints a warning or dies. |
133 |
+# Obsolete function executing all the checks and priting out results |
134 |
check_reqs() { |
135 |
- [[ -n "${1}" ]] && die "Usage: check_reqs" |
136 |
+ debug-print-function ${FUNCNAME} "$@" |
137 |
|
138 |
- export CHECKREQS_NEED_SLEEP="" CHECKREQS_NEED_DIE="" |
139 |
- if [[ "$CHECKREQS_ACTION" != "ignore" ]] ; then |
140 |
- [[ -n "$CHECKREQS_MEMORY" ]] && check_build_memory |
141 |
- [[ -n "$CHECKREQS_DISK_BUILD" ]] && check_build_disk \ |
142 |
- "${T}" "${CHECKREQS_DISK_BUILD}" |
143 |
- [[ -n "$CHECKREQS_DISK_USR" ]] && check_build_disk \ |
144 |
- "${ROOT}/usr" "${CHECKREQS_DISK_USR}" |
145 |
- [[ -n "$CHECKREQS_DISK_VAR" ]] && check_build_disk \ |
146 |
- "${ROOT}/var" "${CHECKREQS_DISK_VAR}" |
147 |
- fi |
148 |
+ echo |
149 |
+ ewarn "QA: Package calling old ${FUNCNAME} function." |
150 |
+ ewarn "QA: Please file a bug against the package." |
151 |
+ ewarn "QA: It should call check-reqs_pkg_pretend and check-reqs_pkg_setup" |
152 |
+ ewarn "QA: and possibly use EAPI=4 or later." |
153 |
+ echo |
154 |
|
155 |
- if [[ -n "${CHECKREQS_NEED_SLEEP}" ]] ; then |
156 |
- echo |
157 |
- ewarn "Bad things may happen! You may abort the build by pressing ctrl+c in" |
158 |
- ewarn "the next 15 seconds." |
159 |
- ewarn " " |
160 |
- einfo "To make this kind of warning a fatal error, add a line to /etc/make.conf" |
161 |
- einfo "setting CHECKREQS_ACTION=\"error\". To skip build requirements checking," |
162 |
- einfo "set CHECKREQS_ACTION=\"ignore\"." |
163 |
- epause 15 |
164 |
- fi |
165 |
+ check-reqs_pkg_setup "$@" |
166 |
+} |
167 |
+ |
168 |
+# @FUNCTION: check-reqs_pkg_setup |
169 |
+# @DESCRIPTION: |
170 |
+# Exported function running the resources checks in pkg_setup phase. |
171 |
+# It should be run in both phases to ensure condition changes between |
172 |
+# pkg_pretend and pkg_setup won't affect the build. |
173 |
+check-reqs_pkg_setup() { |
174 |
+ debug-print-function ${FUNCNAME} "$@" |
175 |
+ |
176 |
+ check-reqs_prepare |
177 |
+ check-reqs_run |
178 |
+ check-reqs_output |
179 |
+} |
180 |
|
181 |
- if [[ -n "${CHECKREQS_NEED_DIE}" ]] ; then |
182 |
- eerror "Bailing out as specified by CHECKREQS_ACTION" |
183 |
- die "Build requirements not met" |
184 |
+# @FUNCTION: check-reqs_pkg_pretend |
185 |
+# @DESCRIPTION: |
186 |
+# Exported function running the resources checks in pkg_pretend phase. |
187 |
+check-reqs_pkg_pretend() { |
188 |
+ debug-print-function ${FUNCNAME} "$@" |
189 |
+ |
190 |
+ check-reqs_pkg_setup "$@" |
191 |
+} |
192 |
+ |
193 |
+# @FUNCTION: check-reqs_prepare |
194 |
+# @DESCRIPTION: |
195 |
+# Internal function that checks the variables that should be defined. |
196 |
+check-reqs_prepare() { |
197 |
+ debug-print-function ${FUNCNAME} "$@" |
198 |
+ |
199 |
+ if [[ -z ${CHECKREQS_MEMORY} && |
200 |
+ -z ${CHECKREQS_DISK_BUILD} && |
201 |
+ -z ${CHECKREQS_DISK_USR} && |
202 |
+ -z ${CHECKREQS_DISK_VAR} ]]; then |
203 |
+ eerror "Set some check-reqs eclass variables if you want to use it." |
204 |
+ eerror "If you are user and see this message file a bug against the package." |
205 |
+ die "${FUNCNAME}: check-reqs eclass called but not actualy used!" |
206 |
fi |
207 |
} |
208 |
|
209 |
-# @FUNCTION: check_reqs_conditional |
210 |
-# @RETURN: True if requirements check passed, else False |
211 |
+# @FUNCTION: check-reqs_run |
212 |
# @DESCRIPTION: |
213 |
-# Checks the requirements given in the specific variables |
214 |
-check_reqs_conditional() { |
215 |
- [[ -n "${1}" ]] && die "Usage: check_reqs" |
216 |
+# Internal function that runs the check based on variable settings. |
217 |
+check-reqs_run() { |
218 |
+ debug-print-function ${FUNCNAME} "$@" |
219 |
+ |
220 |
+ # some people are *censored* |
221 |
+ unset CHECKREQS_FAILED |
222 |
+ |
223 |
+ [[ -n ${CHECKREQS_MEMORY} ]] && \ |
224 |
+ check-reqs_memory \ |
225 |
+ ${CHECKREQS_MEMORY} |
226 |
+ |
227 |
+ [[ -n ${CHECKREQS_DISK_BUILD} ]] && \ |
228 |
+ check-reqs_disk \ |
229 |
+ "${T}" \ |
230 |
+ "${CHECKREQS_DISK_BUILD}" |
231 |
+ |
232 |
+ [[ -n ${CHECKREQS_DISK_USR} ]] && \ |
233 |
+ check-reqs_disk \ |
234 |
+ "${EROOT}/usr" \ |
235 |
+ "${CHECKREQS_DISK_USR}" |
236 |
+ |
237 |
+ [[ -n ${CHECKREQS_DISK_VAR} ]] && \ |
238 |
+ check-reqs_disk \ |
239 |
+ "${EROOT}/var" \ |
240 |
+ "${CHECKREQS_DISK_VAR}" |
241 |
+} |
242 |
|
243 |
- export CHECKREQS_NEED_SLEEP="" CHECKREQS_NEED_DIE="" |
244 |
- if [[ "$CHECKREQS_ACTION" != "ignore" ]] ; then |
245 |
- [[ -n "$CHECKREQS_MEMORY" ]] && check_build_memory |
246 |
- [[ -n "$CHECKREQS_DISK_BUILD" ]] && check_build_disk \ |
247 |
- "${T}" "${CHECKREQS_DISK_BUILD}" |
248 |
- [[ -n "$CHECKREQS_DISK_USR" ]] && check_build_disk \ |
249 |
- "${ROOT}/usr" "${CHECKREQS_DISK_USR}" |
250 |
- [[ -n "$CHECKREQS_DISK_VAR" ]] && check_build_disk \ |
251 |
- "${ROOT}/var" "${CHECKREQS_DISK_VAR}" |
252 |
+# @FUNCTION: check-reqs_get_mebibytes |
253 |
+# @DESCRIPTION: |
254 |
+# Internal function that returns number in mebibytes. |
255 |
+# Converts from 1G=1024 or 1T=1048576 |
256 |
+check-reqs_get_mebibytes() { |
257 |
+ debug-print-function ${FUNCNAME} "$@" |
258 |
+ |
259 |
+ [[ -z ${1} ]] && die "Usage: ${FUNCNAME} [size]" |
260 |
+ |
261 |
+ local unit=${1:(-1)} |
262 |
+ local size=${1%[GMT]} |
263 |
+ |
264 |
+ case ${unit} in |
265 |
+ G) echo $((1024 * size)) ;; |
266 |
+ [M0-9]) echo ${size} ;; |
267 |
+ T) echo $((1024 * 1024 * size)) ;; |
268 |
+ *) |
269 |
+ die "${FUNCNAME}: Unknown unit: ${unit}" |
270 |
+ ;; |
271 |
+ esac |
272 |
+} |
273 |
+ |
274 |
+# @FUNCTION: check-reqs_get_number |
275 |
+# @DESCRIPTION: |
276 |
+# Internal function that returns number without the unit. |
277 |
+# Converts from 1G=1 or 150T=150. |
278 |
+check-reqs_get_number() { |
279 |
+ debug-print-function ${FUNCNAME} "$@" |
280 |
+ |
281 |
+ [[ -z ${1} ]] && die "Usage: ${FUNCNAME} [size]" |
282 |
+ |
283 |
+ local unit=${1:(-1)} |
284 |
+ local size=${1%[GMT]} |
285 |
+ |
286 |
+ # Check for unset units and warn about them. |
287 |
+ # Backcompat. |
288 |
+ if [[ ${size} == ${1} ]]; then |
289 |
+ ewarn "QA: Package does not specify unit for the size check" |
290 |
+ ewarn "QA: Assuming mebibytes." |
291 |
+ ewarn "QA: File bug against the package. It should specify the unit." |
292 |
fi |
293 |
|
294 |
- [[ -z "${CHECKREQS_NEED_SLEEP}" && -z "${CHECKREQS_NEED_DIE}" ]] |
295 |
+ echo ${size} |
296 |
} |
297 |
|
298 |
-# internal use only! |
299 |
-check_build_memory() { |
300 |
- [[ -n "${1}" ]] && die "Usage: check_build_memory" |
301 |
- check_build_msg_begin "${CHECKREQS_MEMORY}" "MBytes" "RAM" |
302 |
+# @FUNCTION: check-reqs_get_unit |
303 |
+# @DESCRIPTION: |
304 |
+# Internal function that returns number without the unit. |
305 |
+# Converts from 1G=1 or 150T=150. |
306 |
+check-reqs_get_unit() { |
307 |
+ debug-print-function ${FUNCNAME} "$@" |
308 |
+ |
309 |
+ [[ -z ${1} ]] && die "Usage: ${FUNCNAME} [size]" |
310 |
+ |
311 |
+ local unit=${1:(-1)} |
312 |
+ |
313 |
+ case ${unit} in |
314 |
+ G) echo "gibibytes" ;; |
315 |
+ [M0-9]) echo "mebibytes" ;; |
316 |
+ T) echo "tebibytes" ;; |
317 |
+ *) |
318 |
+ die "${FUNCNAME}: Unknown unit: ${unit}" |
319 |
+ ;; |
320 |
+ esac |
321 |
+} |
322 |
+ |
323 |
+# @FUNCTION: check-reqs_output |
324 |
+# @DESCRIPTION: |
325 |
+# Internal function that prints the warning and dies if required based on |
326 |
+# the test results. |
327 |
+check-reqs_output() { |
328 |
+ debug-print-function ${FUNCNAME} "$@" |
329 |
+ |
330 |
+ local msg="ewarn" |
331 |
+ |
332 |
+ [[ ${EBUILD_PHASE} == "pretend" && -z ${I_KNOW_WHAT_I_AM_DOING} ]] && msg="eerror" |
333 |
+ if [[ -n ${CHECKREQS_FAILED} ]]; then |
334 |
+ ${msg} |
335 |
+ ${msg} "Space constrains set in the ebuild were not met!" |
336 |
+ ${msg} "The build will most probably fail, you should enhance the space" |
337 |
+ ${msg} "as per failed tests." |
338 |
+ ${msg} |
339 |
+ |
340 |
+ [[ ${EBUILD_PHASE} == "pretend" && -z ${I_KNOW_WHAT_I_AM_DOING} ]] && \ |
341 |
+ die "Build requirements not met!" |
342 |
+ fi |
343 |
+} |
344 |
+ |
345 |
+# @FUNCTION: check-reqs_memory |
346 |
+# @DESCRIPTION: |
347 |
+# Internal function that checks size of RAM. |
348 |
+check-reqs_memory() { |
349 |
+ debug-print-function ${FUNCNAME} "$@" |
350 |
+ |
351 |
+ [[ -z ${1} ]] && die "Usage: ${FUNCNAME} [size]" |
352 |
+ |
353 |
+ local size=${1} |
354 |
+ local actual_memory |
355 |
+ |
356 |
+ check-reqs_start_phase \ |
357 |
+ ${size} \ |
358 |
+ "RAM" |
359 |
+ |
360 |
if [[ -r /proc/meminfo ]] ; then |
361 |
- actual_memory=$(sed -n -e '/MemTotal:/s/^[^:]*: *\([0-9]\+\) kB/\1/p' \ |
362 |
- /proc/meminfo) |
363 |
+ actual_memory=$(awk '/MemTotal/ { print $2 }' /proc/meminfo) |
364 |
else |
365 |
actual_memory=$(sysctl hw.physmem 2>/dev/null ) |
366 |
[[ "$?" == "0" ]] && |
367 |
actual_memory=$(echo $actual_memory | sed -e 's/^[^:=]*[:=]//' ) |
368 |
fi |
369 |
- if [[ -n "${actual_memory}" ]] ; then |
370 |
- if [[ ${actual_memory} -lt $((1024 * ${CHECKREQS_MEMORY})) ]] ; then |
371 |
+ if [[ -n ${actual_memory} ]] ; then |
372 |
+ if [[ ${actual_memory} -lt $((1024 * $(check-reqs_get_mebibytes ${size}))) ]] ; then |
373 |
eend 1 |
374 |
- check_build_msg_ick "${CHECKREQS_MEMORY}" "MBytes" "RAM" |
375 |
+ check-reqs_unsatisfied \ |
376 |
+ ${size} \ |
377 |
+ "RAM" |
378 |
else |
379 |
eend 0 |
380 |
fi |
381 |
else |
382 |
eend 1 |
383 |
- ewarn "Couldn't determine amount of memory, skipping ..." |
384 |
+ ewarn "Couldn't determine amount of memory, skipping..." |
385 |
fi |
386 |
} |
387 |
|
388 |
-# internal use only! |
389 |
-check_build_disk() { |
390 |
- [[ -z "${2}" ]] && die "Usage: check_build_disk where name needed" |
391 |
- check_build_msg_begin "${2}" "MBytes" \ |
392 |
- "disk space at ${1}" |
393 |
- actual_space=$(df -Pm ${1} 2>/dev/null | sed -n \ |
394 |
- '$s/\(\S\+\s\+\)\{3\}\([0-9]\+\).*/\2/p' 2>/dev/null ) |
395 |
- if [[ "$?" == "0" && -n "${actual_space}" ]] ; then |
396 |
- if [[ ${actual_space} -lt ${2} ]] ; then |
397 |
+# @FUNCTION: check-reqs_disk |
398 |
+# @DESCRIPTION: |
399 |
+# Internal function that checks space on the harddrive. |
400 |
+check-reqs_disk() { |
401 |
+ debug-print-function ${FUNCNAME} "$@" |
402 |
+ |
403 |
+ [[ -z ${2} ]] && die "Usage: ${FUNCNAME} [path] [size]" |
404 |
+ |
405 |
+ local path=${1} |
406 |
+ local size=${2} |
407 |
+ local space_megs |
408 |
+ |
409 |
+ check-reqs_start_phase \ |
410 |
+ ${size} \ |
411 |
+ "disk space at \"${path}\"" |
412 |
+ |
413 |
+ space_megs=$(df -Pm "${1}" 2>/dev/null | awk 'FNR == 2 {print $4}') |
414 |
+ |
415 |
+ if [[ $? == 0 && -n ${space_megs} ]] ; then |
416 |
+ if [[ ${space_megs} -lt $(check-reqs_get_mebibytes ${size}) ]] ; then |
417 |
eend 1 |
418 |
- check_build_msg_ick "${2}" "MBytes" \ |
419 |
- "disk space at ${1}" |
420 |
+ check-reqs_unsatisfied \ |
421 |
+ ${size} \ |
422 |
+ "disk space at \"${path}\"" |
423 |
else |
424 |
eend 0 |
425 |
fi |
426 |
else |
427 |
eend 1 |
428 |
- ewarn "Couldn't figure out disk space, skipping ..." |
429 |
+ ewarn "Couldn't determine disk space, skipping..." |
430 |
fi |
431 |
} |
432 |
|
433 |
-# internal use only! |
434 |
-check_build_msg_begin() { |
435 |
- ebegin "Checking for at least ${1}${2} ${3}" |
436 |
-} |
437 |
+# @FUNCTION: check-reqs_start_phase |
438 |
+# @DESCRIPTION: |
439 |
+# Internal function that inform about started check |
440 |
+check-reqs_start_phase() { |
441 |
+ debug-print-function ${FUNCNAME} "$@" |
442 |
|
443 |
-# internal use only! |
444 |
-check_build_msg_skip() { |
445 |
- ewarn "Skipping check for at least ${1}${2} ${3}" |
446 |
+ [[ -z ${2} ]] && die "Usage: ${FUNCNAME} [size] [location]" |
447 |
+ |
448 |
+ local size=${1} |
449 |
+ local location=${2} |
450 |
+ local sizeunit="$(check-reqs_get_number ${size}) $(check-reqs_get_unit ${size})" |
451 |
+ |
452 |
+ ebegin "Checking for at least ${sizeunit} ${location}" |
453 |
} |
454 |
|
455 |
-# internal use only! |
456 |
-check_build_msg_ick() { |
457 |
- if [[ "${CHECKREQS_ACTION}" == "error" ]] ; then |
458 |
- eerror "Don't have at least ${1}${2} ${3}" |
459 |
- echo |
460 |
- export CHECKREQS_NEED_DIE="yes" |
461 |
- else |
462 |
- ewarn "Don't have at least ${1}${2} ${3}" |
463 |
- echo |
464 |
- export CHECKREQS_NEED_SLEEP="yes" |
465 |
- fi |
466 |
+# @FUNCTION: check-reqs_unsatisfied |
467 |
+# @DESCRIPTION: |
468 |
+# Internal function that inform about check result. |
469 |
+# It has different output between pretend and setup phase, |
470 |
+# where in pretend phase it is fatal. |
471 |
+check-reqs_unsatisfied() { |
472 |
+ debug-print-function ${FUNCNAME} "$@" |
473 |
+ |
474 |
+ [[ -z ${2} ]] && die "Usage: ${FUNCNAME} [size] [location]" |
475 |
+ |
476 |
+ local msg="ewarn" |
477 |
+ local size=${1} |
478 |
+ local location=${2} |
479 |
+ local sizeunit="$(check-reqs_get_number ${size}) $(check-reqs_get_unit ${size})" |
480 |
+ |
481 |
+ [[ ${EBUILD_PHASE} == "pretend" && -z ${I_KNOW_WHAT_I_AM_DOING} ]] && msg="eerror" |
482 |
+ ${msg} "Don't have at least ${sizeunit} ${location}" |
483 |
+ |
484 |
+ # @ECLASS-VARIABLE: CHECKREQS_FAILED |
485 |
+ # @DESCRIPTION: |
486 |
+ # @INTERNAL |
487 |
+ # If set the checks failed and eclass should abort the build. |
488 |
+ # Internal, do not set yourself. |
489 |
+ CHECKREQS_FAILED="true" |
490 |
} |