mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-29 17:41:05 +02:00
eclass/check-reqs: Sync with Gentoo
It's from Gentoo commit b99e8947cf255d9b135234911a49629e6bdcc184.
This commit is contained in:
parent
c3c6b6a7a0
commit
24e7126fd9
@ -7,7 +7,7 @@
|
||||
# @AUTHOR:
|
||||
# Bo Ørsted Andresen <zlin@gentoo.org>
|
||||
# Original Author: Ciaran McCreesh <ciaranm@gentoo.org>
|
||||
# @SUPPORTED_EAPIS: 6 7 8
|
||||
# @SUPPORTED_EAPIS: 7 8
|
||||
# @BLURB: Provides a uniform way of handling ebuilds with very high build requirements
|
||||
# @DESCRIPTION:
|
||||
# This eclass provides a uniform way of handling ebuilds which have very high
|
||||
@ -42,10 +42,6 @@ if [[ -z ${_CHECK_REQS_ECLASS} ]]; then
|
||||
_CHECK_REQS_ECLASS=1
|
||||
|
||||
case ${EAPI} in
|
||||
6)
|
||||
ewarn "${CATEGORY}/${PF}: ebuild uses ${ECLASS} with deprecated EAPI ${EAPI}!"
|
||||
ewarn "${CATEGORY}/${PF}: Support will be removed on 2024-10-08. Please port to newer EAPI."
|
||||
;;
|
||||
7|8) ;;
|
||||
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
|
||||
esac
|
||||
@ -111,7 +107,7 @@ check-reqs_pkg_pretend() {
|
||||
# @DESCRIPTION:
|
||||
# Internal function that checks the variables that should be defined.
|
||||
check-reqs_prepare() {
|
||||
[[ ${EAPI} == [67] ]] ||
|
||||
[[ ${EAPI} == 7 ]] ||
|
||||
die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}."
|
||||
_check-reqs_prepare "$@"
|
||||
}
|
||||
@ -138,7 +134,7 @@ _check-reqs_prepare() {
|
||||
# @DESCRIPTION:
|
||||
# Internal function that runs the check based on variable settings.
|
||||
check-reqs_run() {
|
||||
[[ ${EAPI} == [67] ]] ||
|
||||
[[ ${EAPI} == 7 ]] ||
|
||||
die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}."
|
||||
_check-reqs_run "$@"
|
||||
}
|
||||
@ -167,12 +163,12 @@ _check-reqs_run() {
|
||||
if [[ ${MERGE_TYPE} != buildonly ]]; then
|
||||
[[ -n ${CHECKREQS_DISK_USR} ]] && \
|
||||
_check-reqs_disk \
|
||||
"${EROOT%/}/usr" \
|
||||
"${EROOT}/usr" \
|
||||
"${CHECKREQS_DISK_USR}"
|
||||
|
||||
[[ -n ${CHECKREQS_DISK_VAR} ]] && \
|
||||
_check-reqs_disk \
|
||||
"${EROOT%/}/var" \
|
||||
"${EROOT}/var" \
|
||||
"${CHECKREQS_DISK_VAR}"
|
||||
fi
|
||||
}
|
||||
@ -183,7 +179,7 @@ _check-reqs_run() {
|
||||
# Internal function that returns number in KiB.
|
||||
# Returns 1024**2 for 1G or 1024**3 for 1T.
|
||||
check-reqs_get_kibibytes() {
|
||||
[[ ${EAPI} == [67] ]] ||
|
||||
[[ ${EAPI} == 7 ]] ||
|
||||
die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}."
|
||||
_check-reqs_get_kibibytes "$@"
|
||||
}
|
||||
@ -217,7 +213,7 @@ _check-reqs_get_kibibytes() {
|
||||
# Internal function that returns the numerical value without the unit.
|
||||
# Returns "1" for "1G" or "150" for "150T".
|
||||
check-reqs_get_number() {
|
||||
[[ ${EAPI} == [67] ]] ||
|
||||
[[ ${EAPI} == 7 ]] ||
|
||||
die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}."
|
||||
_check-reqs_get_number "$@"
|
||||
}
|
||||
@ -244,7 +240,7 @@ _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] ]] ||
|
||||
[[ ${EAPI} == 7 ]] ||
|
||||
die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}."
|
||||
_check-reqs_get_unit "$@"
|
||||
}
|
||||
@ -277,7 +273,7 @@ _check-reqs_get_unit() {
|
||||
# Internal function that prints the warning and dies if required based on
|
||||
# the test results.
|
||||
check-reqs_output() {
|
||||
[[ ${EAPI} == [67] ]] ||
|
||||
[[ ${EAPI} == 7 ]] ||
|
||||
die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}."
|
||||
_check-reqs_get_unit "$@"
|
||||
}
|
||||
@ -312,7 +308,7 @@ _check-reqs_output() {
|
||||
# @DESCRIPTION:
|
||||
# Internal function that checks size of RAM.
|
||||
check-reqs_memory() {
|
||||
[[ ${EAPI} == [67] ]] ||
|
||||
[[ ${EAPI} == 7 ]] ||
|
||||
die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}."
|
||||
_check-reqs_memory "$@"
|
||||
}
|
||||
@ -371,7 +367,7 @@ _check-reqs_memory() {
|
||||
# @DESCRIPTION:
|
||||
# Internal function that checks space on the harddrive.
|
||||
check-reqs_disk() {
|
||||
[[ ${EAPI} == [67] ]] ||
|
||||
[[ ${EAPI} == 7 ]] ||
|
||||
die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}."
|
||||
_check-reqs_disk "$@"
|
||||
}
|
||||
@ -415,7 +411,7 @@ _check-reqs_disk() {
|
||||
# @DESCRIPTION:
|
||||
# Internal function that inform about started check
|
||||
check-reqs_start_phase() {
|
||||
[[ ${EAPI} == [67] ]] ||
|
||||
[[ ${EAPI} == 7 ]] ||
|
||||
die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}."
|
||||
_check-reqs_start_phase "$@"
|
||||
}
|
||||
@ -443,7 +439,7 @@ _check-reqs_start_phase() {
|
||||
# It has different output between pretend and setup phase,
|
||||
# where in pretend phase it is fatal.
|
||||
check-reqs_unsatisfied() {
|
||||
[[ ${EAPI} == [67] ]] ||
|
||||
[[ ${EAPI} == 7 ]] ||
|
||||
die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}."
|
||||
_check-reqs_unsatisfied "$@"
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user