eclass/check-reqs: Sync with Gentoo

It's from Gentoo commit b99e8947cf255d9b135234911a49629e6bdcc184.
This commit is contained in:
Flatcar Buildbot 2024-10-21 07:06:06 +00:00
parent c3c6b6a7a0
commit 24e7126fd9

View File

@ -7,7 +7,7 @@
# @AUTHOR: # @AUTHOR:
# Bo Ørsted Andresen <zlin@gentoo.org> # Bo Ørsted Andresen <zlin@gentoo.org>
# Original Author: Ciaran McCreesh <ciaranm@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 # @BLURB: Provides a uniform way of handling ebuilds with very high build requirements
# @DESCRIPTION: # @DESCRIPTION:
# This eclass provides a uniform way of handling ebuilds which have very high # 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 _CHECK_REQS_ECLASS=1
case ${EAPI} in 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) ;; 7|8) ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac esac
@ -111,7 +107,7 @@ check-reqs_pkg_pretend() {
# @DESCRIPTION: # @DESCRIPTION:
# Internal function that checks the variables that should be defined. # Internal function that checks the variables that should be defined.
check-reqs_prepare() { check-reqs_prepare() {
[[ ${EAPI} == [67] ]] || [[ ${EAPI} == 7 ]] ||
die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}." die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}."
_check-reqs_prepare "$@" _check-reqs_prepare "$@"
} }
@ -138,7 +134,7 @@ _check-reqs_prepare() {
# @DESCRIPTION: # @DESCRIPTION:
# Internal function that runs the check based on variable settings. # Internal function that runs the check based on variable settings.
check-reqs_run() { check-reqs_run() {
[[ ${EAPI} == [67] ]] || [[ ${EAPI} == 7 ]] ||
die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}." die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}."
_check-reqs_run "$@" _check-reqs_run "$@"
} }
@ -167,12 +163,12 @@ _check-reqs_run() {
if [[ ${MERGE_TYPE} != buildonly ]]; then if [[ ${MERGE_TYPE} != buildonly ]]; then
[[ -n ${CHECKREQS_DISK_USR} ]] && \ [[ -n ${CHECKREQS_DISK_USR} ]] && \
_check-reqs_disk \ _check-reqs_disk \
"${EROOT%/}/usr" \ "${EROOT}/usr" \
"${CHECKREQS_DISK_USR}" "${CHECKREQS_DISK_USR}"
[[ -n ${CHECKREQS_DISK_VAR} ]] && \ [[ -n ${CHECKREQS_DISK_VAR} ]] && \
_check-reqs_disk \ _check-reqs_disk \
"${EROOT%/}/var" \ "${EROOT}/var" \
"${CHECKREQS_DISK_VAR}" "${CHECKREQS_DISK_VAR}"
fi fi
} }
@ -183,7 +179,7 @@ _check-reqs_run() {
# Internal function that returns number in KiB. # Internal function that returns number in KiB.
# Returns 1024**2 for 1G or 1024**3 for 1T. # Returns 1024**2 for 1G or 1024**3 for 1T.
check-reqs_get_kibibytes() { check-reqs_get_kibibytes() {
[[ ${EAPI} == [67] ]] || [[ ${EAPI} == 7 ]] ||
die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}." die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}."
_check-reqs_get_kibibytes "$@" _check-reqs_get_kibibytes "$@"
} }
@ -217,7 +213,7 @@ _check-reqs_get_kibibytes() {
# Internal function that returns the numerical value without the unit. # Internal function that returns the numerical value without the unit.
# Returns "1" for "1G" or "150" for "150T". # Returns "1" for "1G" or "150" for "150T".
check-reqs_get_number() { check-reqs_get_number() {
[[ ${EAPI} == [67] ]] || [[ ${EAPI} == 7 ]] ||
die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}." die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}."
_check-reqs_get_number "$@" _check-reqs_get_number "$@"
} }
@ -244,7 +240,7 @@ _check-reqs_get_number() {
# Internal function that returns the unit without the numerical value. # Internal function that returns the unit without the numerical value.
# Returns "GiB" for "1G" or "TiB" for "150T". # Returns "GiB" for "1G" or "TiB" for "150T".
check-reqs_get_unit() { check-reqs_get_unit() {
[[ ${EAPI} == [67] ]] || [[ ${EAPI} == 7 ]] ||
die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}." die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}."
_check-reqs_get_unit "$@" _check-reqs_get_unit "$@"
} }
@ -277,7 +273,7 @@ _check-reqs_get_unit() {
# Internal function that prints the warning and dies if required based on # Internal function that prints the warning and dies if required based on
# the test results. # the test results.
check-reqs_output() { check-reqs_output() {
[[ ${EAPI} == [67] ]] || [[ ${EAPI} == 7 ]] ||
die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}." die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}."
_check-reqs_get_unit "$@" _check-reqs_get_unit "$@"
} }
@ -312,7 +308,7 @@ _check-reqs_output() {
# @DESCRIPTION: # @DESCRIPTION:
# Internal function that checks size of RAM. # Internal function that checks size of RAM.
check-reqs_memory() { check-reqs_memory() {
[[ ${EAPI} == [67] ]] || [[ ${EAPI} == 7 ]] ||
die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}." die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}."
_check-reqs_memory "$@" _check-reqs_memory "$@"
} }
@ -371,7 +367,7 @@ _check-reqs_memory() {
# @DESCRIPTION: # @DESCRIPTION:
# Internal function that checks space on the harddrive. # Internal function that checks space on the harddrive.
check-reqs_disk() { check-reqs_disk() {
[[ ${EAPI} == [67] ]] || [[ ${EAPI} == 7 ]] ||
die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}." die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}."
_check-reqs_disk "$@" _check-reqs_disk "$@"
} }
@ -415,7 +411,7 @@ _check-reqs_disk() {
# @DESCRIPTION: # @DESCRIPTION:
# Internal function that inform about started check # Internal function that inform about started check
check-reqs_start_phase() { check-reqs_start_phase() {
[[ ${EAPI} == [67] ]] || [[ ${EAPI} == 7 ]] ||
die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}." die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}."
_check-reqs_start_phase "$@" _check-reqs_start_phase "$@"
} }
@ -443,7 +439,7 @@ _check-reqs_start_phase() {
# It has different output between pretend and setup phase, # It has different output between pretend and setup phase,
# where in pretend phase it is fatal. # where in pretend phase it is fatal.
check-reqs_unsatisfied() { check-reqs_unsatisfied() {
[[ ${EAPI} == [67] ]] || [[ ${EAPI} == 7 ]] ||
die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}." die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}."
_check-reqs_unsatisfied "$@" _check-reqs_unsatisfied "$@"
} }