public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH] check-reqs.eclass: more disk checks
@ 2024-02-19 22:08 Robin H. Johnson
  2024-02-19 22:14 ` [gentoo-dev] " Robin H. Johnson
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Robin H. Johnson @ 2024-02-19 22:08 UTC (permalink / raw)
  To: gentoo-dev; +Cc: Robin H. Johnson

Allow checking more disk space, for users with many split volumes and
ever-larger packages.

gentoo-kernel-bin:
/     >=350MB/version (in /lib/modules)
/boot >=40MB/version

rust-bin:
/opt  >=450MB/version

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
---
 eclass/check-reqs.eclass | 44 +++++++++++++++++++++++++++++++++++++++-
 1 file changed, 43 insertions(+), 1 deletion(-)

diff --git a/eclass/check-reqs.eclass b/eclass/check-reqs.eclass
index fac2f4553d74..7b65f44e8c41 100644
--- a/eclass/check-reqs.eclass
+++ b/eclass/check-reqs.eclass
@@ -24,12 +24,21 @@
 # # need this much temporary build space
 # CHECKREQS_DISK_BUILD="2G"
 #
+# # install will need this much space in /
+# CHECKREQS_DISK_ROOT="1G"
+#
+# # install will need this much space in /boot
+# CHECKREQS_DISK_BOOT="128M"
+#
 # # install will need this much space in /usr
 # CHECKREQS_DISK_USR="1G"
 #
 # # install will need this much space in /var
 # CHECKREQS_DISK_VAR="1024M"
 #
+# # install will need this much space in /opt
+# CHECKREQS_DISK_OPT="1G"
+#
 # @CODE
 #
 # If you don't specify a value for, say, CHECKREQS_MEMORY, then the test is not
@@ -56,6 +65,16 @@ _CHECK_REQS_ECLASS=1
 # @DESCRIPTION:
 # How much diskspace is needed to build the package? Eg.: CHECKREQS_DISK_BUILD=2T
 
+# @ECLASS_VARIABLE: CHECKREQS_DISK_ROOT
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# How much space in / is needed to install the package? Eg.: CHECKREQS_DISK_ROOT=1G
+
+# @ECLASS_VARIABLE: CHECKREQS_DISK_BOOT
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# How much space in /boot is needed to install the package? Eg.: CHECKREQS_DISK_BOOT=128M
+
 # @ECLASS_VARIABLE: CHECKREQS_DISK_USR
 # @DEFAULT_UNSET
 # @DESCRIPTION:
@@ -66,6 +85,11 @@ _CHECK_REQS_ECLASS=1
 # @DESCRIPTION:
 # How much space is needed in /var? Eg.: CHECKREQS_DISK_VAR=3000M
 
+# @ECLASS_VARIABLE: CHECKREQS_DISK_OPT
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# How much space is needed in /opt? Eg.: CHECKREQS_DISK_OPT=1G
+
 # @ECLASS_VARIABLE: CHECKREQS_DONOTHING
 # @USER_VARIABLE
 # @DEFAULT_UNSET
@@ -121,8 +145,11 @@ _check-reqs_prepare() {
 
 	if [[ -z ${CHECKREQS_MEMORY} &&
 			-z ${CHECKREQS_DISK_BUILD} &&
+			-z ${CHECKREQS_DISK_ROOT} &&
+			-z ${CHECKREQS_DISK_BOOT} &&
 			-z ${CHECKREQS_DISK_USR} &&
-			-z ${CHECKREQS_DISK_VAR} ]]; then
+			-z ${CHECKREQS_DISK_VAR} &&
+			-z ${CHECKREQS_DISK_OPT} ]]; then
 		eerror "Set some check-reqs eclass variables if you want to use it."
 		eerror "If you are user and see this message file a bug against the package."
 		die "${FUNCNAME}: check-reqs eclass called but not actually used!"
@@ -161,6 +188,16 @@ _check-reqs_run() {
 	fi
 
 	if [[ ${MERGE_TYPE} != buildonly ]]; then
+		[[ -n ${CHECKREQS_DISK_ROOT} ]] && \
+			_check-reqs_disk \
+				"${EROOT%/}/" \
+				"${CHECKREQS_DISK_ROOT}"
+
+		[[ -n ${CHECKREQS_DISK_BOOT} ]] && \
+			_check-reqs_disk \
+				"${EROOT%/}/boot" \
+				"${CHECKREQS_DISK_BOOT}"
+
 		[[ -n ${CHECKREQS_DISK_USR} ]] && \
 			_check-reqs_disk \
 				"${EROOT%/}/usr" \
@@ -170,6 +207,11 @@ _check-reqs_run() {
 			_check-reqs_disk \
 				"${EROOT%/}/var" \
 				"${CHECKREQS_DISK_VAR}"
+
+		[[ -n ${CHECKREQS_DISK_OPT} ]] && \
+			_check-reqs_disk \
+				"${EROOT%/}/opt" \
+				"${CHECKREQS_DISK_OPT}"
 	fi
 }
 
-- 
2.43.0



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

* [gentoo-dev] Re: [PATCH] check-reqs.eclass: more disk checks
  2024-02-19 22:08 [gentoo-dev] [PATCH] check-reqs.eclass: more disk checks Robin H. Johnson
@ 2024-02-19 22:14 ` Robin H. Johnson
  2024-02-20  6:16   ` Michał Górny
  2024-02-20  4:38 ` [gentoo-dev] " Sam James
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Robin H. Johnson @ 2024-02-19 22:14 UTC (permalink / raw)
  To: gentoo-dev

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

On Mon, Feb 19, 2024 at 02:08:32PM -0800, Robin H. Johnson wrote:
> Allow checking more disk space, for users with many split volumes and
> ever-larger packages.
> 
> gentoo-kernel-bin:
> /     >=350MB/version (in /lib/modules)
> /boot >=40MB/version
> 
> rust-bin:
> /opt  >=450MB/version
Meta:
Is this the time where we should rethink the CHECKREQS syntax?

CHECKREQS_DISK="/:2G /opt/random:1G /usr:1G" etc?
If we need to support paths with space, newline or array here.

-- 
Robin Hugh Johnson
Gentoo Linux: Dev, Infra Lead, Foundation President & Treasurer
E-Mail   : robbat2@gentoo.org
GnuPG FP : 11ACBA4F 4778E3F6 E4EDF38E B27B944E 34884E85
GnuPG FP : 7D0B3CEB E9B85B1F 825BCECF EE05E6F6 A48F6136

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

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

* Re: [gentoo-dev] [PATCH] check-reqs.eclass: more disk checks
  2024-02-19 22:08 [gentoo-dev] [PATCH] check-reqs.eclass: more disk checks Robin H. Johnson
  2024-02-19 22:14 ` [gentoo-dev] " Robin H. Johnson
@ 2024-02-20  4:38 ` Sam James
  2024-02-20  5:53 ` Andrew Ammerlaan
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Sam James @ 2024-02-20  4:38 UTC (permalink / raw)
  To: gentoo-dev; +Cc: Robin H. Johnson

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


"Robin H. Johnson" <robbat2@gentoo.org> writes:

> Allow checking more disk space, for users with many split volumes and
> ever-larger packages.
>
> gentoo-kernel-bin:
> /     >=350MB/version (in /lib/modules)
> /boot >=40MB/version
>
> rust-bin:
> /opt  >=450MB/version
>

LGTM, but give a bit of time for other comments.

> Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
> ---
>  eclass/check-reqs.eclass | 44 +++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 43 insertions(+), 1 deletion(-)
>
> diff --git a/eclass/check-reqs.eclass b/eclass/check-reqs.eclass
> index fac2f4553d74..7b65f44e8c41 100644
> --- a/eclass/check-reqs.eclass
> +++ b/eclass/check-reqs.eclass
> @@ -24,12 +24,21 @@
>  # # need this much temporary build space
>  # CHECKREQS_DISK_BUILD="2G"
>  #
> +# # install will need this much space in /
> +# CHECKREQS_DISK_ROOT="1G"
> +#
> +# # install will need this much space in /boot
> +# CHECKREQS_DISK_BOOT="128M"
> +#
>  # # install will need this much space in /usr
>  # CHECKREQS_DISK_USR="1G"
>  #
>  # # install will need this much space in /var
>  # CHECKREQS_DISK_VAR="1024M"
>  #
> +# # install will need this much space in /opt
> +# CHECKREQS_DISK_OPT="1G"
> +#
>  # @CODE
>  #
>  # If you don't specify a value for, say, CHECKREQS_MEMORY, then the test is not
> @@ -56,6 +65,16 @@ _CHECK_REQS_ECLASS=1
>  # @DESCRIPTION:
>  # How much diskspace is needed to build the package? Eg.: CHECKREQS_DISK_BUILD=2T
>  
> +# @ECLASS_VARIABLE: CHECKREQS_DISK_ROOT
> +# @DEFAULT_UNSET
> +# @DESCRIPTION:
> +# How much space in / is needed to install the package? Eg.: CHECKREQS_DISK_ROOT=1G
> +
> +# @ECLASS_VARIABLE: CHECKREQS_DISK_BOOT
> +# @DEFAULT_UNSET
> +# @DESCRIPTION:
> +# How much space in /boot is needed to install the package? Eg.: CHECKREQS_DISK_BOOT=128M
> +
>  # @ECLASS_VARIABLE: CHECKREQS_DISK_USR
>  # @DEFAULT_UNSET
>  # @DESCRIPTION:
> @@ -66,6 +85,11 @@ _CHECK_REQS_ECLASS=1
>  # @DESCRIPTION:
>  # How much space is needed in /var? Eg.: CHECKREQS_DISK_VAR=3000M
>  
> +# @ECLASS_VARIABLE: CHECKREQS_DISK_OPT
> +# @DEFAULT_UNSET
> +# @DESCRIPTION:
> +# How much space is needed in /opt? Eg.: CHECKREQS_DISK_OPT=1G
> +
>  # @ECLASS_VARIABLE: CHECKREQS_DONOTHING
>  # @USER_VARIABLE
>  # @DEFAULT_UNSET
> @@ -121,8 +145,11 @@ _check-reqs_prepare() {
>  
>  	if [[ -z ${CHECKREQS_MEMORY} &&
>  			-z ${CHECKREQS_DISK_BUILD} &&
> +			-z ${CHECKREQS_DISK_ROOT} &&
> +			-z ${CHECKREQS_DISK_BOOT} &&
>  			-z ${CHECKREQS_DISK_USR} &&
> -			-z ${CHECKREQS_DISK_VAR} ]]; then
> +			-z ${CHECKREQS_DISK_VAR} &&
> +			-z ${CHECKREQS_DISK_OPT} ]]; then
>  		eerror "Set some check-reqs eclass variables if you want to use it."
>  		eerror "If you are user and see this message file a bug against the package."
>  		die "${FUNCNAME}: check-reqs eclass called but not actually used!"
> @@ -161,6 +188,16 @@ _check-reqs_run() {
>  	fi
>  
>  	if [[ ${MERGE_TYPE} != buildonly ]]; then
> +		[[ -n ${CHECKREQS_DISK_ROOT} ]] && \
> +			_check-reqs_disk \
> +				"${EROOT%/}/" \
> +				"${CHECKREQS_DISK_ROOT}"
> +
> +		[[ -n ${CHECKREQS_DISK_BOOT} ]] && \
> +			_check-reqs_disk \
> +				"${EROOT%/}/boot" \
> +				"${CHECKREQS_DISK_BOOT}"
> +
>  		[[ -n ${CHECKREQS_DISK_USR} ]] && \
>  			_check-reqs_disk \
>  				"${EROOT%/}/usr" \
> @@ -170,6 +207,11 @@ _check-reqs_run() {
>  			_check-reqs_disk \
>  				"${EROOT%/}/var" \
>  				"${CHECKREQS_DISK_VAR}"
> +
> +		[[ -n ${CHECKREQS_DISK_OPT} ]] && \
> +			_check-reqs_disk \
> +				"${EROOT%/}/opt" \
> +				"${CHECKREQS_DISK_OPT}"
>  	fi
>  }


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

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

* Re: [gentoo-dev] [PATCH] check-reqs.eclass: more disk checks
  2024-02-19 22:08 [gentoo-dev] [PATCH] check-reqs.eclass: more disk checks Robin H. Johnson
  2024-02-19 22:14 ` [gentoo-dev] " Robin H. Johnson
  2024-02-20  4:38 ` [gentoo-dev] " Sam James
@ 2024-02-20  5:53 ` Andrew Ammerlaan
  2024-02-26  6:31 ` [gentoo-dev] [PATCH v2 1/2] check-reqs.eclass: runtime disk checks for any path Robin H. Johnson
  2024-02-26  6:31 ` [gentoo-dev] [PATCH v2 2/2] sys-firmware/intel-microcode: check-reqs for /boot space Robin H. Johnson
  4 siblings, 0 replies; 10+ messages in thread
From: Andrew Ammerlaan @ 2024-02-20  5:53 UTC (permalink / raw)
  To: gentoo-dev, Robin H. Johnson



On 19 February 2024 23:08:32 CET, "Robin H. Johnson" <robbat2@gentoo.org> wrote:
>Allow checking more disk space, for users with many split volumes and
>ever-larger packages.
>
>gentoo-kernel-bin:
>/     >=350MB/version (in /lib/modules)
>/boot >=40MB/version
>

The problem here is that the kernel is not always installed to /boot. If systemd-boot is used they are installed to the ESP instead, and UKI's go on the ESP as well. The ESP may be mounted at /boot, /efi, /boot/efi or /boot/EFI.


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

* Re: [gentoo-dev] Re: [PATCH] check-reqs.eclass: more disk checks
  2024-02-19 22:14 ` [gentoo-dev] " Robin H. Johnson
@ 2024-02-20  6:16   ` Michał Górny
  0 siblings, 0 replies; 10+ messages in thread
From: Michał Górny @ 2024-02-20  6:16 UTC (permalink / raw)
  To: gentoo-dev

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

On Mon, 2024-02-19 at 22:14 +0000, Robin H. Johnson wrote:
> On Mon, Feb 19, 2024 at 02:08:32PM -0800, Robin H. Johnson wrote:
> > Allow checking more disk space, for users with many split volumes and
> > ever-larger packages.
> > 
> > gentoo-kernel-bin:
> > /     >=350MB/version (in /lib/modules)
> > /boot >=40MB/version
> > 
> > rust-bin:
> > /opt  >=450MB/version
> Meta:
> Is this the time where we should rethink the CHECKREQS syntax?
> 
> CHECKREQS_DISK="/:2G /opt/random:1G /usr:1G" etc?
> If we need to support paths with space, newline or array here.
> 

Precisely what I wanted to say.  Instead of adding more variables, let's
add an array and mark the existing vars as legacy.

CHECKREQ_DISK=(
  /opt:...
  /usr:...
)

However, Andrew's comment poses a bigger problem here.

-- 
Best regards,
Michał Górny


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

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

* [gentoo-dev] [PATCH v2 1/2] check-reqs.eclass: runtime disk checks for any path.
  2024-02-19 22:08 [gentoo-dev] [PATCH] check-reqs.eclass: more disk checks Robin H. Johnson
                   ` (2 preceding siblings ...)
  2024-02-20  5:53 ` Andrew Ammerlaan
@ 2024-02-26  6:31 ` Robin H. Johnson
  2024-02-26  7:01   ` zzam
  2024-02-26 13:50   ` Michał Górny
  2024-02-26  6:31 ` [gentoo-dev] [PATCH v2 2/2] sys-firmware/intel-microcode: check-reqs for /boot space Robin H. Johnson
  4 siblings, 2 replies; 10+ messages in thread
From: Robin H. Johnson @ 2024-02-26  6:31 UTC (permalink / raw)
  To: gentoo-dev; +Cc: Robin H. Johnson

Allow checking any runtime path for installing ever-larger packages.

CHECKREQS_DISK_RUNTIME=( /boot:40M /:350M /opt:500M )

Recent example of large packages:

gentoo-kernel-bin:
/     >=350MB/version (in /lib/modules)
/boot >=40MB/version

rust-bin:
/opt  >=450MB/version

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
---
 eclass/check-reqs.eclass | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/eclass/check-reqs.eclass b/eclass/check-reqs.eclass
index fac2f4553d74..1c59c69489a9 100644
--- a/eclass/check-reqs.eclass
+++ b/eclass/check-reqs.eclass
@@ -30,6 +30,13 @@
 # # install will need this much space in /var
 # CHECKREQS_DISK_VAR="1024M"
 #
+# # install will need this much space in listed paths.
+# CHECKREQS_DISK_RUNTIME=(
+#   /var:1G
+#   /boot/efi:32M
+#   /opt/giant-package-with-dedicated-disk:100G
+# )
+#
 # @CODE
 #
 # If you don't specify a value for, say, CHECKREQS_MEMORY, then the test is not
@@ -66,6 +73,11 @@ _CHECK_REQS_ECLASS=1
 # @DESCRIPTION:
 # How much space is needed in /var? Eg.: CHECKREQS_DISK_VAR=3000M
 
+# @ECLASS_VARIABLE: CHECKREQS_DISK_RUNTIME
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# How much space is needed in paths? Eg.: CHECKREQS_DISK_RUNTIME=( /:1G /var:5G )
+
 # @ECLASS_VARIABLE: CHECKREQS_DONOTHING
 # @USER_VARIABLE
 # @DEFAULT_UNSET
@@ -120,6 +132,7 @@ _check-reqs_prepare() {
 	debug-print-function ${FUNCNAME} "$@"
 
 	if [[ -z ${CHECKREQS_MEMORY} &&
+			"${#CHECKREQS_DISK_RUNTIME[@]}" -eq 0 &&
 			-z ${CHECKREQS_DISK_BUILD} &&
 			-z ${CHECKREQS_DISK_USR} &&
 			-z ${CHECKREQS_DISK_VAR} ]]; then
@@ -161,6 +174,16 @@ _check-reqs_run() {
 	fi
 
 	if [[ ${MERGE_TYPE} != buildonly ]]; then
+		if [[ "${#CHECKREQS_DISK_RUNTIME[@]}" -gt 0 ]]; then
+			for _path_size in "${CHECKREQS_DISK_RUNTIME[@]}"; do
+				_path=${_path_size/:*}
+				_size=${_path_size/*:}
+				_check-reqs_disk \
+					"${EROOT%/}${_path}" "${_size}"
+			done
+			unset _path_size _path _size
+		fi
+
 		[[ -n ${CHECKREQS_DISK_USR} ]] && \
 			_check-reqs_disk \
 				"${EROOT%/}/usr" \
-- 
2.43.0



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

* [gentoo-dev] [PATCH v2 2/2] sys-firmware/intel-microcode: check-reqs for /boot space
  2024-02-19 22:08 [gentoo-dev] [PATCH] check-reqs.eclass: more disk checks Robin H. Johnson
                   ` (3 preceding siblings ...)
  2024-02-26  6:31 ` [gentoo-dev] [PATCH v2 1/2] check-reqs.eclass: runtime disk checks for any path Robin H. Johnson
@ 2024-02-26  6:31 ` Robin H. Johnson
  4 siblings, 0 replies; 10+ messages in thread
From: Robin H. Johnson @ 2024-02-26  6:31 UTC (permalink / raw)
  To: gentoo-dev; +Cc: Robin H. Johnson

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
---
 .../intel-microcode-20231114_p20231114.ebuild       | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/sys-firmware/intel-microcode/intel-microcode-20231114_p20231114.ebuild b/sys-firmware/intel-microcode/intel-microcode-20231114_p20231114.ebuild
index 5d1ff1e7f4be..30aca9ccbecf 100644
--- a/sys-firmware/intel-microcode/intel-microcode-20231114_p20231114.ebuild
+++ b/sys-firmware/intel-microcode/intel-microcode-20231114_p20231114.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=8
 
-inherit linux-info mount-boot
+inherit linux-info mount-boot check-reqs
 
 # Find updates by searching and clicking the first link (hopefully it's the one):
 # https://www.intel.com/content/www/us/en/search.html?keyword=Processor+Microcode+Data+File
@@ -52,6 +52,9 @@ BDEPEND=">=sys-apps/iucode_tool-2.3"
 # !<sys-apps/microcode-ctl-1.17-r2 due to bug #268586
 RDEPEND="hostonly? ( sys-apps/iucode_tool )"
 
+# Plus a /boot check further down that, based on USE=initramfs.
+CHECKREQS_DISK_RUNTIME=( /lib/firmware/intel-ucode/:30M )
+
 # Blacklist bad microcode here.
 # 0x000406f1 aka 06-4f-01 aka CPUID 406F1 require newer microcode loader
 MICROCODE_BLACKLIST_DEFAULT="-s !0x000406f1"
@@ -164,7 +167,13 @@ pkg_preinst() {
 	fi
 
 	# Make sure /boot is available if needed.
-	use initramfs && mount-boot_pkg_preinst
+	if use initramfs; then
+		mount-boot_pkg_preinst
+		CHECKREQS_DISK_RUNTIME+=( /boot:20M )
+		#  check-reqs doesn't have any pkg_preinst function today.
+		check-reqs_pkg_setup || die "Not enough room in /boot to install early microcode"
+	fi
+
 
 	local _initramfs_file="${ED}/boot/intel-uc.img"
 
-- 
2.43.0



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

* Re: [gentoo-dev] [PATCH v2 1/2] check-reqs.eclass: runtime disk checks for any path.
  2024-02-26  6:31 ` [gentoo-dev] [PATCH v2 1/2] check-reqs.eclass: runtime disk checks for any path Robin H. Johnson
@ 2024-02-26  7:01   ` zzam
  2024-02-26  9:46     ` Robin H. Johnson
  2024-02-26 13:50   ` Michał Górny
  1 sibling, 1 reply; 10+ messages in thread
From: zzam @ 2024-02-26  7:01 UTC (permalink / raw)
  To: gentoo-dev, Robin H. Johnson

Am 26.02.24 um 07:31 schrieb Robin H. Johnson:
> Allow checking any runtime path for installing ever-larger packages.
> 
> CHECKREQS_DISK_RUNTIME=( /boot:40M /:350M /opt:500M )

In the example case: Shouldn't the eclass check for 850M on / if /opt is 
not a separate partition?
I am not sure how often it really happens that multiple large 
requirements for different folders exist.

> 
> Recent example of large packages:
> 
> gentoo-kernel-bin:
> /     >=350MB/version (in /lib/modules)
> /boot >=40MB/version
> 
> rust-bin:
> /opt  >=450MB/version
> 
> Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
> ---
>   eclass/check-reqs.eclass | 23 +++++++++++++++++++++++
>   1 file changed, 23 insertions(+)
> 
> diff --git a/eclass/check-reqs.eclass b/eclass/check-reqs.eclass
> index fac2f4553d74..1c59c69489a9 100644
> --- a/eclass/check-reqs.eclass
> +++ b/eclass/check-reqs.eclass
> @@ -30,6 +30,13 @@
>   # # install will need this much space in /var
>   # CHECKREQS_DISK_VAR="1024M"
>   #
> +# # install will need this much space in listed paths.
> +# CHECKREQS_DISK_RUNTIME=(
> +#   /var:1G
> +#   /boot/efi:32M
> +#   /opt/giant-package-with-dedicated-disk:100G
> +# )
> +#
>   # @CODE
>   #
>   # If you don't specify a value for, say, CHECKREQS_MEMORY, then the test is not
> @@ -66,6 +73,11 @@ _CHECK_REQS_ECLASS=1
>   # @DESCRIPTION:
>   # How much space is needed in /var? Eg.: CHECKREQS_DISK_VAR=3000M
>   
> +# @ECLASS_VARIABLE: CHECKREQS_DISK_RUNTIME
> +# @DEFAULT_UNSET
> +# @DESCRIPTION:
> +# How much space is needed in paths? Eg.: CHECKREQS_DISK_RUNTIME=( /:1G /var:5G )
> +
>   # @ECLASS_VARIABLE: CHECKREQS_DONOTHING
>   # @USER_VARIABLE
>   # @DEFAULT_UNSET
> @@ -120,6 +132,7 @@ _check-reqs_prepare() {
>   	debug-print-function ${FUNCNAME} "$@"
>   
>   	if [[ -z ${CHECKREQS_MEMORY} &&
> +			"${#CHECKREQS_DISK_RUNTIME[@]}" -eq 0 &&
>   			-z ${CHECKREQS_DISK_BUILD} &&
>   			-z ${CHECKREQS_DISK_USR} &&
>   			-z ${CHECKREQS_DISK_VAR} ]]; then
> @@ -161,6 +174,16 @@ _check-reqs_run() {
>   	fi
>   
>   	if [[ ${MERGE_TYPE} != buildonly ]]; then
> +		if [[ "${#CHECKREQS_DISK_RUNTIME[@]}" -gt 0 ]]; then
> +			for _path_size in "${CHECKREQS_DISK_RUNTIME[@]}"; do
> +				_path=${_path_size/:*}
> +				_size=${_path_size/*:}
> +				_check-reqs_disk \
> +					"${EROOT%/}${_path}" "${_size}"
> +			done
> +			unset _path_size _path _size
> +		fi
> +
>   		[[ -n ${CHECKREQS_DISK_USR} ]] && \
>   			_check-reqs_disk \
>   				"${EROOT%/}/usr" \



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

* Re: [gentoo-dev] [PATCH v2 1/2] check-reqs.eclass: runtime disk checks for any path.
  2024-02-26  7:01   ` zzam
@ 2024-02-26  9:46     ` Robin H. Johnson
  0 siblings, 0 replies; 10+ messages in thread
From: Robin H. Johnson @ 2024-02-26  9:46 UTC (permalink / raw)
  To: gentoo-dev

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

On Mon, Feb 26, 2024 at 08:01:28AM +0100, zzam@gentoo.org wrote:
> Am 26.02.24 um 07:31 schrieb Robin H. Johnson:
> > Allow checking any runtime path for installing ever-larger packages.
> > 
> > CHECKREQS_DISK_RUNTIME=( /boot:40M /:350M /opt:500M )
> 
> In the example case: Shouldn't the eclass check for 850M on / if /opt is 
> not a separate partition?
> I am not sure how often it really happens that multiple large 
> requirements for different folders exist.
I just summed up the 2 example packages here.

I do see your concern about the filesystem/mountpoint layout.

If it's a single /: that needs 850M
If it's split / and /opt: then it's the listed space in each location.

Correctly processing this would require converting each of the listed
check locations to their common mounts, summing the needs, and then
validating.

This should be possible with "stat --printf=%m" to resolve any directory
into it's mountpoint.

I'll see if it can be done trivially enough for the eclass.

-- 
Robin Hugh Johnson
Gentoo Linux: Dev, Infra Lead, Foundation President & Treasurer
E-Mail   : robbat2@gentoo.org
GnuPG FP : 11ACBA4F 4778E3F6 E4EDF38E B27B944E 34884E85
GnuPG FP : 7D0B3CEB E9B85B1F 825BCECF EE05E6F6 A48F6136

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

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

* Re: [gentoo-dev] [PATCH v2 1/2] check-reqs.eclass: runtime disk checks for any path.
  2024-02-26  6:31 ` [gentoo-dev] [PATCH v2 1/2] check-reqs.eclass: runtime disk checks for any path Robin H. Johnson
  2024-02-26  7:01   ` zzam
@ 2024-02-26 13:50   ` Michał Górny
  1 sibling, 0 replies; 10+ messages in thread
From: Michał Górny @ 2024-02-26 13:50 UTC (permalink / raw)
  To: gentoo-dev; +Cc: Robin H. Johnson

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

On Sun, 2024-02-25 at 22:31 -0800, Robin H. Johnson wrote:
> Allow checking any runtime path for installing ever-larger packages.
> 
> CHECKREQS_DISK_RUNTIME=( /boot:40M /:350M /opt:500M )
> 
> Recent example of large packages:
> 
> gentoo-kernel-bin:
> /     >=350MB/version (in /lib/modules)
> /boot >=40MB/version
> 
> rust-bin:
> /opt  >=450MB/version
> 
> Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
> ---
>  eclass/check-reqs.eclass | 23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)
> 
> diff --git a/eclass/check-reqs.eclass b/eclass/check-reqs.eclass
> index fac2f4553d74..1c59c69489a9 100644
> --- a/eclass/check-reqs.eclass
> +++ b/eclass/check-reqs.eclass
> @@ -30,6 +30,13 @@
>  # # install will need this much space in /var
>  # CHECKREQS_DISK_VAR="1024M"
>  #
> +# # install will need this much space in listed paths.
> +# CHECKREQS_DISK_RUNTIME=(
> +#   /var:1G
> +#   /boot/efi:32M

I'd avoid listing /boot/efi as an example, as /boot is a bit special
and might need special handling in the eclass.  In particular,
on the system here I have EFI mounted at /boot, so there
is no /boot/efi.

A possible generic solution would be to "fall back" from non-existing
locations to a "higher" directory, assuming they would normally be
created as subdirectories.

> +#   /opt/giant-package-with-dedicated-disk:100G
> +# )
> +#
>  # @CODE
>  #
>  # If you don't specify a value for, say, CHECKREQS_MEMORY, then the test is not
> @@ -66,6 +73,11 @@ _CHECK_REQS_ECLASS=1
>  # @DESCRIPTION:
>  # How much space is needed in /var? Eg.: CHECKREQS_DISK_VAR=3000M
>  
> +# @ECLASS_VARIABLE: CHECKREQS_DISK_RUNTIME
> +# @DEFAULT_UNSET
> +# @DESCRIPTION:
> +# How much space is needed in paths? Eg.: CHECKREQS_DISK_RUNTIME=( /:1G /var:5G )
> +
>  # @ECLASS_VARIABLE: CHECKREQS_DONOTHING
>  # @USER_VARIABLE
>  # @DEFAULT_UNSET
> @@ -120,6 +132,7 @@ _check-reqs_prepare() {
>  	debug-print-function ${FUNCNAME} "$@"
>  
>  	if [[ -z ${CHECKREQS_MEMORY} &&
> +			"${#CHECKREQS_DISK_RUNTIME[@]}" -eq 0 &&
>  			-z ${CHECKREQS_DISK_BUILD} &&
>  			-z ${CHECKREQS_DISK_USR} &&
>  			-z ${CHECKREQS_DISK_VAR} ]]; then

Considering all the extra logic discussed in this thread, it might be
reasonable to implicitly convert CHECKREQS_DISK_* into
CHECKREQS_DISK_RUNTIME, so they'd share all the solutions discussed.

So ideally the logic would be something like:

1. Append CHECKREQS_DISK_* into CHECKREQS_DISK_RUNTIME.

2. Replace missing paths with the first parent directory that exists.

3. Replace paths with their respective mount points.

4. Sum the values corresponding to the same mount point.

> @@ -161,6 +174,16 @@ _check-reqs_run() {
>  	fi
>  
>  	if [[ ${MERGE_TYPE} != buildonly ]]; then
> +		if [[ "${#CHECKREQS_DISK_RUNTIME[@]}" -gt 0 ]]; then
> +			for _path_size in "${CHECKREQS_DISK_RUNTIME[@]}"; do
> +				_path=${_path_size/:*}
> +				_size=${_path_size/*:}
> +				_check-reqs_disk \
> +					"${EROOT%/}${_path}" "${_size}"
> +			done
> +			unset _path_size _path _size

Instead of setting them globally, then unsetting, you should use local
variables.

> +		fi
> +
>  		[[ -n ${CHECKREQS_DISK_USR} ]] && \
>  			_check-reqs_disk \
>  				"${EROOT%/}/usr" \

-- 
Best regards,
Michał Górny


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

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

end of thread, other threads:[~2024-02-26 13:50 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-19 22:08 [gentoo-dev] [PATCH] check-reqs.eclass: more disk checks Robin H. Johnson
2024-02-19 22:14 ` [gentoo-dev] " Robin H. Johnson
2024-02-20  6:16   ` Michał Górny
2024-02-20  4:38 ` [gentoo-dev] " Sam James
2024-02-20  5:53 ` Andrew Ammerlaan
2024-02-26  6:31 ` [gentoo-dev] [PATCH v2 1/2] check-reqs.eclass: runtime disk checks for any path Robin H. Johnson
2024-02-26  7:01   ` zzam
2024-02-26  9:46     ` Robin H. Johnson
2024-02-26 13:50   ` Michał Górny
2024-02-26  6:31 ` [gentoo-dev] [PATCH v2 2/2] sys-firmware/intel-microcode: check-reqs for /boot space Robin H. Johnson

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