public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH v2 1/5] check-reqs.eclass: Support EAPI-8
@ 2021-07-23  6:55 Andreas Sturmlechner
  2021-07-23  6:56 ` [gentoo-dev] [PATCH v2 2/5] check-reqs.eclass: Drop EAPI-4 and EAPI-5 support Andreas Sturmlechner
  0 siblings, 1 reply; 8+ messages in thread
From: Andreas Sturmlechner @ 2021-07-23  6:55 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 2313 bytes --]

Move EAPI check and EXPORT_FUNCTIONS on top, before include guard.
Standardise include guard.

Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
---
 eclass/check-reqs.eclass | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/eclass/check-reqs.eclass b/eclass/check-reqs.eclass
index 5c4a420ee06..27ab1513aab 100644
--- a/eclass/check-reqs.eclass
+++ b/eclass/check-reqs.eclass
@@ -7,8 +7,8 @@
 # @AUTHOR:
 # Bo Ørsted Andresen <zlin@gentoo.org>
 # Original Author: Ciaran McCreesh <ciaranm@gentoo.org>
-# @SUPPORTED_EAPIS: 4 5 6 7
-# @BLURB: Provides a uniform way of handling ebuild which have very high build requirements
+# @SUPPORTED_EAPIS: 4 5 6 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
 # build requirements in terms of memory or disk space. It provides a function
@@ -38,14 +38,22 @@
 # These checks should probably mostly work on non-Linux, and they should
 # probably degrade gracefully if they don't. Probably.
 
-if [[ ! ${_CHECK_REQS_ECLASS_} ]]; then
+case ${EAPI} in
+	4|5|6|7|8) ;;
+	*) die "${ECLASS}: EAPI=${EAPI:-0} is not supported" ;;
+esac
+
+EXPORT_FUNCTIONS pkg_pretend pkg_setup
+
+if [[ ! ${_CHECK_REQS_ECLASS} ]]; then
+_CHECK_REQS_ECLASS=1
 
 # @ECLASS-VARIABLE: CHECKREQS_MEMORY
 # @DEFAULT_UNSET
 # @DESCRIPTION:
 # How much RAM is needed? Eg.: CHECKREQS_MEMORY=15M
 
-# @ECLASS-VARIABLE:  CHECKREQS_DISK_BUILD
+# @ECLASS-VARIABLE: CHECKREQS_DISK_BUILD
 # @DEFAULT_UNSET
 # @DESCRIPTION:
 # How much diskspace is needed to build the package? Eg.: CHECKREQS_DISK_BUILD=2T
@@ -60,13 +68,6 @@ if [[ ! ${_CHECK_REQS_ECLASS_} ]]; then
 # @DESCRIPTION:
 # How much space is needed in /var? Eg.: CHECKREQS_DISK_VAR=3000M
 
-case ${EAPI:-0} in
-	4|5|6|7) ;;
-	*) die "${ECLASS}: EAPI=${EAPI:-0} is not supported" ;;
-esac
-
-EXPORT_FUNCTIONS pkg_pretend pkg_setup
-
 # Obsolete function executing all the checks and printing out results
 check_reqs() {
 	eerror "Package calling old ${FUNCNAME} function."
@@ -357,5 +358,4 @@ check-reqs_unsatisfied() {
 	CHECKREQS_FAILED="true"
 }
 
-_CHECK_REQS_ECLASS_=1
 fi
-- 
2.32.0


[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 618 bytes --]

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-dev] [PATCH v2 2/5] check-reqs.eclass: Drop EAPI-4 and EAPI-5 support
  2021-07-23  6:55 [gentoo-dev] [PATCH v2 1/5] check-reqs.eclass: Support EAPI-8 Andreas Sturmlechner
@ 2021-07-23  6:56 ` Andreas Sturmlechner
  2021-07-23  6:57   ` [gentoo-dev] [PATCH v2 3/5] check-reqs.eclass: Drop obsolete check_reqs(), errored out for >3yrs Andreas Sturmlechner
  0 siblings, 1 reply; 8+ messages in thread
From: Andreas Sturmlechner @ 2021-07-23  6:56 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 908 bytes --]

Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
---
 eclass/check-reqs.eclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/eclass/check-reqs.eclass b/eclass/check-reqs.eclass
index 27ab1513aab..c95ee0192c5 100644
--- a/eclass/check-reqs.eclass
+++ b/eclass/check-reqs.eclass
@@ -7,7 +7,7 @@
 # @AUTHOR:
 # Bo Ørsted Andresen <zlin@gentoo.org>
 # Original Author: Ciaran McCreesh <ciaranm@gentoo.org>
-# @SUPPORTED_EAPIS: 4 5 6 7 8
+# @SUPPORTED_EAPIS: 6 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
@@ -39,7 +39,7 @@
 # probably degrade gracefully if they don't. Probably.
 
 case ${EAPI} in
-	4|5|6|7|8) ;;
+	6|7|8) ;;
 	*) die "${ECLASS}: EAPI=${EAPI:-0} is not supported" ;;
 esac
 
-- 
2.32.0


[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 618 bytes --]

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-dev] [PATCH v2 3/5] check-reqs.eclass: Drop obsolete check_reqs(), errored  out for >3yrs
  2021-07-23  6:56 ` [gentoo-dev] [PATCH v2 2/5] check-reqs.eclass: Drop EAPI-4 and EAPI-5 support Andreas Sturmlechner
@ 2021-07-23  6:57   ` Andreas Sturmlechner
  2021-07-23  6:57     ` [gentoo-dev] [PATCH v2 4/5] check-reqs.eclass: Prefix internal functions w/ underscore Andreas Sturmlechner
  0 siblings, 1 reply; 8+ messages in thread
From: Andreas Sturmlechner @ 2021-07-23  6:57 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 806 bytes --]

Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
---
 eclass/check-reqs.eclass | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/eclass/check-reqs.eclass b/eclass/check-reqs.eclass
index c95ee0192c5..6b11794fbb2 100644
--- a/eclass/check-reqs.eclass
+++ b/eclass/check-reqs.eclass
@@ -68,13 +68,6 @@ _CHECK_REQS_ECLASS=1
 # @DESCRIPTION:
 # How much space is needed in /var? Eg.: CHECKREQS_DISK_VAR=3000M
 
-# Obsolete function executing all the checks and printing out results
-check_reqs() {
-	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
 # @DESCRIPTION:
 # Exported function running the resources checks in pkg_setup phase.
-- 
2.32.0


[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 618 bytes --]

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-dev] [PATCH v2 4/5] check-reqs.eclass: Prefix internal functions w/ underscore
  2021-07-23  6:57   ` [gentoo-dev] [PATCH v2 3/5] check-reqs.eclass: Drop obsolete check_reqs(), errored out for >3yrs Andreas Sturmlechner
@ 2021-07-23  6:57     ` Andreas Sturmlechner
  2021-07-23  6:58       ` [gentoo-dev] [PATCH v2 5/5] check-reqs.eclass: Repl. I_KNOW_WHAT_I_AM_DOING w/ CHECKREQS_DONOTHING Andreas Sturmlechner
  0 siblings, 1 reply; 8+ messages in thread
From: Andreas Sturmlechner @ 2021-07-23  6:57 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 9359 bytes --]

Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
---
 eclass/check-reqs.eclass | 140 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------
 1 file changed, 123 insertions(+), 17 deletions(-)

diff --git a/eclass/check-reqs.eclass b/eclass/check-reqs.eclass
index 6b11794fbb2..39e4bad1363 100644
--- a/eclass/check-reqs.eclass
+++ b/eclass/check-reqs.eclass
@@ -76,9 +76,9 @@ _CHECK_REQS_ECLASS=1
 check-reqs_pkg_setup() {
 	debug-print-function ${FUNCNAME} "$@"
 
-	check-reqs_prepare
-	check-reqs_run
-	check-reqs_output
+	_check-reqs_prepare
+	_check-reqs_run
+	_check-reqs_output
 }
 
 # @FUNCTION: check-reqs_pkg_pretend
@@ -95,6 +95,16 @@ check-reqs_pkg_pretend() {
 # @DESCRIPTION:
 # Internal function that checks the variables that should be defined.
 check-reqs_prepare() {
+	[[ ${EAPI} == [67] ]] ||
+		die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}."
+	_check-reqs_prepare "$@"
+}
+
+# @FUNCTION: _check-reqs_prepare
+# @INTERNAL
+# @DESCRIPTION:
+# Internal function that checks the variables that should be defined.
+_check-reqs_prepare() {
 	debug-print-function ${FUNCNAME} "$@"
 
 	if [[ -z ${CHECKREQS_MEMORY} &&
@@ -112,6 +122,16 @@ check-reqs_prepare() {
 # @DESCRIPTION:
 # Internal function that runs the check based on variable settings.
 check-reqs_run() {
+	[[ ${EAPI} == [67] ]] ||
+		die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}."
+	_check-reqs_run "$@"
+}
+
+# @FUNCTION: _check-reqs_run
+# @INTERNAL
+# @DESCRIPTION:
+# Internal function that runs the check based on variable settings.
+_check-reqs_run() {
 	debug-print-function ${FUNCNAME} "$@"
 
 	# some people are *censored*
@@ -119,23 +139,23 @@ check-reqs_run() {
 
 	if [[ ${MERGE_TYPE} != binary ]]; then
 		[[ -n ${CHECKREQS_MEMORY} ]] && \
-			check-reqs_memory \
+			_check-reqs_memory \
 				${CHECKREQS_MEMORY}
 
 		[[ -n ${CHECKREQS_DISK_BUILD} ]] && \
-			check-reqs_disk \
+			_check-reqs_disk \
 				"${T}" \
 				"${CHECKREQS_DISK_BUILD}"
 	fi
 
 	if [[ ${MERGE_TYPE} != buildonly ]]; then
 		[[ -n ${CHECKREQS_DISK_USR} ]] && \
-			check-reqs_disk \
+			_check-reqs_disk \
 				"${EROOT%/}/usr" \
 				"${CHECKREQS_DISK_USR}"
 
 		[[ -n ${CHECKREQS_DISK_VAR} ]] && \
-			check-reqs_disk \
+			_check-reqs_disk \
 				"${EROOT%/}/var" \
 				"${CHECKREQS_DISK_VAR}"
 	fi
@@ -147,6 +167,17 @@ 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] ]] ||
+		die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}."
+	_check-reqs_get_kibibytes "$@"
+}
+
+# @FUNCTION: _check-reqs_get_kibibytes
+# @INTERNAL
+# @DESCRIPTION:
+# Internal function that returns number in KiB.
+# Returns 1024**2 for 1G or 1024**3 for 1T.
+_check-reqs_get_kibibytes() {
 	debug-print-function ${FUNCNAME} "$@"
 
 	[[ -z ${1} ]] && die "Usage: ${FUNCNAME} [size]"
@@ -170,6 +201,17 @@ 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] ]] ||
+		die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}."
+	_check-reqs_get_number "$@"
+}
+
+# @FUNCTION: _check-reqs_get_number
+# @INTERNAL
+# @DESCRIPTION:
+# Internal function that returns the numerical value without the unit.
+# Returns "1" for "1G" or "150" for "150T".
+_check-reqs_get_number() {
 	debug-print-function ${FUNCNAME} "$@"
 
 	[[ -z ${1} ]] && die "Usage: ${FUNCNAME} [size]"
@@ -186,6 +228,17 @@ 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] ]] ||
+		die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}."
+	_check-reqs_get_unit "$@"
+}
+
+# @FUNCTION: _check-reqs_get_unit
+# @INTERNAL
+# @DESCRIPTION:
+# Internal function that returns the unit without the numerical value.
+# Returns "GiB" for "1G" or "TiB" for "150T".
+_check-reqs_get_unit() {
 	debug-print-function ${FUNCNAME} "$@"
 
 	[[ -z ${1} ]] && die "Usage: ${FUNCNAME} [size]"
@@ -208,6 +261,17 @@ check-reqs_get_unit() {
 # Internal function that prints the warning and dies if required based on
 # the test results.
 check-reqs_output() {
+	[[ ${EAPI} == [67] ]] ||
+		die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}."
+	_check-reqs_get_unit "$@"
+}
+
+# @FUNCTION: _check-reqs_output
+# @INTERNAL
+# @DESCRIPTION:
+# Internal function that prints the warning and dies if required based on
+# the test results.
+_check-reqs_output() {
 	debug-print-function ${FUNCNAME} "$@"
 
 	local msg="ewarn"
@@ -230,6 +294,16 @@ check-reqs_output() {
 # @DESCRIPTION:
 # Internal function that checks size of RAM.
 check-reqs_memory() {
+	[[ ${EAPI} == [67] ]] ||
+		die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}."
+	_check-reqs_memory "$@"
+}
+
+# @FUNCTION: _check-reqs_memory
+# @INTERNAL
+# @DESCRIPTION:
+# Internal function that checks size of RAM.
+_check-reqs_memory() {
 	debug-print-function ${FUNCNAME} "$@"
 
 	[[ -z ${1} ]] && die "Usage: ${FUNCNAME} [size]"
@@ -238,7 +312,7 @@ check-reqs_memory() {
 	local actual_memory
 	local actual_swap
 
-	check-reqs_start_phase \
+	_check-reqs_start_phase \
 		${size} \
 		"RAM"
 
@@ -254,17 +328,17 @@ check-reqs_memory() {
 			| sed -e 's/^[^:=]*[:=][[:space:]]*//')
 	fi
 	if [[ -n ${actual_memory} ]] ; then
-		if [[ ${actual_memory} -ge $(check-reqs_get_kibibytes ${size}) ]] ; then
+		if [[ ${actual_memory} -ge $(_check-reqs_get_kibibytes ${size}) ]] ; then
 			eend 0
 		elif [[ -n ${actual_swap} && $((${actual_memory} + ${actual_swap})) \
-				-ge $(check-reqs_get_kibibytes ${size}) ]] ; then
+				-ge $(_check-reqs_get_kibibytes ${size}) ]] ; then
 			ewarn "Amount of main memory is insufficient, but amount"
 			ewarn "of main memory combined with swap is sufficient."
 			ewarn "Build process may make computer very slow!"
 			eend 0
 		else
 			eend 1
-			check-reqs_unsatisfied \
+			_check-reqs_unsatisfied \
 				${size} \
 				"RAM"
 		fi
@@ -279,6 +353,16 @@ check-reqs_memory() {
 # @DESCRIPTION:
 # Internal function that checks space on the harddrive.
 check-reqs_disk() {
+	[[ ${EAPI} == [67] ]] ||
+		die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}."
+	_check-reqs_disk "$@"
+}
+
+# @FUNCTION: _check-reqs_disk
+# @INTERNAL
+# @DESCRIPTION:
+# Internal function that checks space on the harddrive.
+_check-reqs_disk() {
 	debug-print-function ${FUNCNAME} "$@"
 
 	[[ -z ${2} ]] && die "Usage: ${FUNCNAME} [path] [size]"
@@ -287,16 +371,16 @@ check-reqs_disk() {
 	local size=${2}
 	local space_kbi
 
-	check-reqs_start_phase \
+	_check-reqs_start_phase \
 		${size} \
 		"disk space at \"${path}\""
 
 	space_kbi=$(df -Pk "${1}" 2>/dev/null | awk 'FNR == 2 {print $4}')
 
 	if [[ $? == 0 && -n ${space_kbi} ]] ; then
-		if [[ ${space_kbi} -lt $(check-reqs_get_kibibytes ${size}) ]] ; then
+		if [[ ${space_kbi} -lt $(_check-reqs_get_kibibytes ${size}) ]] ; then
 			eend 1
-			check-reqs_unsatisfied \
+			_check-reqs_unsatisfied \
 				${size} \
 				"disk space at \"${path}\""
 		else
@@ -313,13 +397,23 @@ check-reqs_disk() {
 # @DESCRIPTION:
 # Internal function that inform about started check
 check-reqs_start_phase() {
+	[[ ${EAPI} == [67] ]] ||
+		die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}."
+	_check-reqs_start_phase "$@"
+}
+
+# @FUNCTION: _check-reqs_start_phase
+# @INTERNAL
+# @DESCRIPTION:
+# Internal function that inform about started check
+_check-reqs_start_phase() {
 	debug-print-function ${FUNCNAME} "$@"
 
 	[[ -z ${2} ]] && die "Usage: ${FUNCNAME} [size] [location]"
 
 	local size=${1}
 	local location=${2}
-	local sizeunit="$(check-reqs_get_number ${size}) $(check-reqs_get_unit ${size})"
+	local sizeunit="$(_check-reqs_get_number ${size}) $(_check-reqs_get_unit ${size})"
 
 	ebegin "Checking for at least ${sizeunit} ${location}"
 }
@@ -327,10 +421,22 @@ check-reqs_start_phase() {
 # @FUNCTION: check-reqs_unsatisfied
 # @INTERNAL
 # @DESCRIPTION:
-# Internal function that inform about check result.
+# Internal function that informs about check result.
 # It has different output between pretend and setup phase,
 # where in pretend phase it is fatal.
 check-reqs_unsatisfied() {
+	[[ ${EAPI} == [67] ]] ||
+		die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}."
+	_check-reqs_unsatisfied "$@"
+}
+
+# @FUNCTION: _check-reqs_unsatisfied
+# @INTERNAL
+# @DESCRIPTION:
+# Internal function that informs about check result.
+# It has different output between pretend and setup phase,
+# where in pretend phase it is fatal.
+_check-reqs_unsatisfied() {
 	debug-print-function ${FUNCNAME} "$@"
 
 	[[ -z ${2} ]] && die "Usage: ${FUNCNAME} [size] [location]"
@@ -338,7 +444,7 @@ check-reqs_unsatisfied() {
 	local msg="ewarn"
 	local size=${1}
 	local location=${2}
-	local sizeunit="$(check-reqs_get_number ${size}) $(check-reqs_get_unit ${size})"
+	local sizeunit="$(_check-reqs_get_number ${size}) $(_check-reqs_get_unit ${size})"
 
 	[[ ${EBUILD_PHASE} == "pretend" && -z ${I_KNOW_WHAT_I_AM_DOING} ]] && msg="eerror"
 	${msg} "There is NOT at least ${sizeunit} ${location}"

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 618 bytes --]

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-dev] [PATCH v2 5/5] check-reqs.eclass: Repl. I_KNOW_WHAT_I_AM_DOING w/  CHECKREQS_DONOTHING
  2021-07-23  6:57     ` [gentoo-dev] [PATCH v2 4/5] check-reqs.eclass: Prefix internal functions w/ underscore Andreas Sturmlechner
@ 2021-07-23  6:58       ` Andreas Sturmlechner
  2021-07-23 11:44         ` Ulrich Mueller
                           ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Andreas Sturmlechner @ 2021-07-23  6:58 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 1878 bytes --]

Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
---
 eclass/check-reqs.eclass | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/eclass/check-reqs.eclass b/eclass/check-reqs.eclass
index 39e4bad1363..836dd0d4a1f 100644
--- a/eclass/check-reqs.eclass
+++ b/eclass/check-reqs.eclass
@@ -68,6 +68,13 @@ _CHECK_REQS_ECLASS=1
 # @DESCRIPTION:
 # How much space is needed in /var? Eg.: CHECKREQS_DISK_VAR=3000M
 
+# @ECLASS-VARIABLE: CHECKREQS_DONOTHING
+# @USER_VARIABLE
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Do not error out in _check-reqs_output if requirements are not met.
+# This is a user flag and should under _no circumstances_ be set in the ebuild.
+
 # @FUNCTION: check-reqs_pkg_setup
 # @DESCRIPTION:
 # Exported function running the resources checks in pkg_setup phase.
@@ -276,7 +283,7 @@ _check-reqs_output() {
 
 	local msg="ewarn"
 
-	[[ ${EBUILD_PHASE} == "pretend" && -z ${I_KNOW_WHAT_I_AM_DOING} ]] && msg="eerror"
+	[[ ${EBUILD_PHASE} == "pretend" && -z ${CHECKREQS_DONOTHING} ]] && msg="eerror"
 	if [[ -n ${CHECKREQS_FAILED} ]]; then
 		${msg}
 		${msg} "Space constraints set in the ebuild were not met!"
@@ -284,7 +291,7 @@ _check-reqs_output() {
 		${msg} "as per failed tests."
 		${msg}
 
-		[[ ${EBUILD_PHASE} == "pretend" && -z ${I_KNOW_WHAT_I_AM_DOING} ]] && \
+		[[ ${EBUILD_PHASE} == "pretend" && -z ${CHECKREQS_DONOTHING} ]] && \
 			die "Build requirements not met!"
 	fi
 }
@@ -446,7 +453,7 @@ _check-reqs_unsatisfied() {
 	local location=${2}
 	local sizeunit="$(_check-reqs_get_number ${size}) $(_check-reqs_get_unit ${size})"
 
-	[[ ${EBUILD_PHASE} == "pretend" && -z ${I_KNOW_WHAT_I_AM_DOING} ]] && msg="eerror"
+	[[ ${EBUILD_PHASE} == "pretend" && -z ${CHECKREQS_DONOTHING} ]] && msg="eerror"
 	${msg} "There is NOT at least ${sizeunit} ${location}"
 
 	# @ECLASS-VARIABLE: CHECKREQS_FAILED
-- 
2.32.0


[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 618 bytes --]

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [gentoo-dev] [PATCH v2 5/5] check-reqs.eclass: Repl. I_KNOW_WHAT_I_AM_DOING w/  CHECKREQS_DONOTHING
  2021-07-23  6:58       ` [gentoo-dev] [PATCH v2 5/5] check-reqs.eclass: Repl. I_KNOW_WHAT_I_AM_DOING w/ CHECKREQS_DONOTHING Andreas Sturmlechner
@ 2021-07-23 11:44         ` Ulrich Mueller
  2021-07-25  0:28         ` Georgy Yakovlev
  2021-07-26 18:53         ` [gentoo-dev] [PATCH v3 5/5] check-reqs.eclass: Introduce CHECKREQS_DONOTHING Andreas Sturmlechner
  2 siblings, 0 replies; 8+ messages in thread
From: Ulrich Mueller @ 2021-07-23 11:44 UTC (permalink / raw
  To: Andreas Sturmlechner; +Cc: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 243 bytes --]

This will break backwards compatibility for user configuration.

Not sure if it merits a news item (probably not, as it would be
addressed only at users who know what they're doing :) but maybe
respect both variables for some transition time?

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 507 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [gentoo-dev] [PATCH v2 5/5] check-reqs.eclass: Repl. I_KNOW_WHAT_I_AM_DOING w/  CHECKREQS_DONOTHING
  2021-07-23  6:58       ` [gentoo-dev] [PATCH v2 5/5] check-reqs.eclass: Repl. I_KNOW_WHAT_I_AM_DOING w/ CHECKREQS_DONOTHING Andreas Sturmlechner
  2021-07-23 11:44         ` Ulrich Mueller
@ 2021-07-25  0:28         ` Georgy Yakovlev
  2021-07-26 18:53         ` [gentoo-dev] [PATCH v3 5/5] check-reqs.eclass: Introduce CHECKREQS_DONOTHING Andreas Sturmlechner
  2 siblings, 0 replies; 8+ messages in thread
From: Georgy Yakovlev @ 2021-07-25  0:28 UTC (permalink / raw
  To: gentoo-dev

On 23.07.2021 08:58, Andreas Sturmlechner wrote:
> Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
> ---
>  eclass/check-reqs.eclass | 13 ++++++++++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/eclass/check-reqs.eclass b/eclass/check-reqs.eclass
> index 39e4bad1363..836dd0d4a1f 100644
> --- a/eclass/check-reqs.eclass
> +++ b/eclass/check-reqs.eclass
> @@ -68,6 +68,13 @@ _CHECK_REQS_ECLASS=1
>  # @DESCRIPTION:
>  # How much space is needed in /var? Eg.: CHECKREQS_DISK_VAR=3000M
>  
> +# @ECLASS-VARIABLE: CHECKREQS_DONOTHING
> +# @USER_VARIABLE
> +# @DEFAULT_UNSET
> +# @DESCRIPTION:
> +# Do not error out in _check-reqs_output if requirements are not met.
> +# This is a user flag and should under _no circumstances_ be set in the ebuild.
...snip...

note that developer profiles set I_KNOW_WHAT_I_AM_DOING="yes" by default

in profiles/targets/developer/make.defaults

I don't know if anyone seriously using this profile though.

-- 
Best regards,
Georgy


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [gentoo-dev] [PATCH v3 5/5] check-reqs.eclass: Introduce CHECKREQS_DONOTHING
  2021-07-23  6:58       ` [gentoo-dev] [PATCH v2 5/5] check-reqs.eclass: Repl. I_KNOW_WHAT_I_AM_DOING w/ CHECKREQS_DONOTHING Andreas Sturmlechner
  2021-07-23 11:44         ` Ulrich Mueller
  2021-07-25  0:28         ` Georgy Yakovlev
@ 2021-07-26 18:53         ` Andreas Sturmlechner
  2 siblings, 0 replies; 8+ messages in thread
From: Andreas Sturmlechner @ 2021-07-26 18:53 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 2009 bytes --]

Replacement for I_KNOW_WHAT_I_AM_DOING with backwards compatibility.

Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
---
 eclass/check-reqs.eclass | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/eclass/check-reqs.eclass b/eclass/check-reqs.eclass
index 39e4bad1363..2130e2e3491 100644
--- a/eclass/check-reqs.eclass
+++ b/eclass/check-reqs.eclass
@@ -68,6 +68,14 @@ _CHECK_REQS_ECLASS=1
 # @DESCRIPTION:
 # How much space is needed in /var? Eg.: CHECKREQS_DISK_VAR=3000M
 
+# @ECLASS-VARIABLE: CHECKREQS_DONOTHING
+# @USER_VARIABLE
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Do not error out in _check-reqs_output if requirements are not met.
+# This is a user flag and should under _no circumstances_ be set in the ebuild.
+[[ -n ${I_KNOW_WHAT_I_AM_DOING} ]] && CHECKREQS_DONOTHING=1
+
 # @FUNCTION: check-reqs_pkg_setup
 # @DESCRIPTION:
 # Exported function running the resources checks in pkg_setup phase.
@@ -276,7 +284,7 @@ _check-reqs_output() {
 
 	local msg="ewarn"
 
-	[[ ${EBUILD_PHASE} == "pretend" && -z ${I_KNOW_WHAT_I_AM_DOING} ]] && msg="eerror"
+	[[ ${EBUILD_PHASE} == "pretend" && -z ${CHECKREQS_DONOTHING} ]] && msg="eerror"
 	if [[ -n ${CHECKREQS_FAILED} ]]; then
 		${msg}
 		${msg} "Space constraints set in the ebuild were not met!"
@@ -284,7 +292,7 @@ _check-reqs_output() {
 		${msg} "as per failed tests."
 		${msg}
 
-		[[ ${EBUILD_PHASE} == "pretend" && -z ${I_KNOW_WHAT_I_AM_DOING} ]] && \
+		[[ ${EBUILD_PHASE} == "pretend" && -z ${CHECKREQS_DONOTHING} ]] && \
 			die "Build requirements not met!"
 	fi
 }
@@ -446,7 +454,7 @@ _check-reqs_unsatisfied() {
 	local location=${2}
 	local sizeunit="$(_check-reqs_get_number ${size}) $(_check-reqs_get_unit ${size})"
 
-	[[ ${EBUILD_PHASE} == "pretend" && -z ${I_KNOW_WHAT_I_AM_DOING} ]] && msg="eerror"
+	[[ ${EBUILD_PHASE} == "pretend" && -z ${CHECKREQS_DONOTHING} ]] && msg="eerror"
 	${msg} "There is NOT at least ${sizeunit} ${location}"
 
 	# @ECLASS-VARIABLE: CHECKREQS_FAILED
-- 
2.32.0

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 618 bytes --]

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-07-26 18:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-07-23  6:55 [gentoo-dev] [PATCH v2 1/5] check-reqs.eclass: Support EAPI-8 Andreas Sturmlechner
2021-07-23  6:56 ` [gentoo-dev] [PATCH v2 2/5] check-reqs.eclass: Drop EAPI-4 and EAPI-5 support Andreas Sturmlechner
2021-07-23  6:57   ` [gentoo-dev] [PATCH v2 3/5] check-reqs.eclass: Drop obsolete check_reqs(), errored out for >3yrs Andreas Sturmlechner
2021-07-23  6:57     ` [gentoo-dev] [PATCH v2 4/5] check-reqs.eclass: Prefix internal functions w/ underscore Andreas Sturmlechner
2021-07-23  6:58       ` [gentoo-dev] [PATCH v2 5/5] check-reqs.eclass: Repl. I_KNOW_WHAT_I_AM_DOING w/ CHECKREQS_DONOTHING Andreas Sturmlechner
2021-07-23 11:44         ` Ulrich Mueller
2021-07-25  0:28         ` Georgy Yakovlev
2021-07-26 18:53         ` [gentoo-dev] [PATCH v3 5/5] check-reqs.eclass: Introduce CHECKREQS_DONOTHING Andreas Sturmlechner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox