public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Robin H. Johnson" <robbat2@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: "Robin H. Johnson" <robbat2@gentoo.org>
Subject: [gentoo-dev] [PATCH v2 1/2] check-reqs.eclass: runtime disk checks for any path.
Date: Sun, 25 Feb 2024 22:31:03 -0800	[thread overview]
Message-ID: <20240226063105.1767-1-robbat2@gentoo.org> (raw)
In-Reply-To: <20240219220832.25919-1-robbat2@gentoo.org>

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



  parent reply	other threads:[~2024-02-26  6:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Robin H. Johnson [this message]
2024-02-26  7:01   ` [gentoo-dev] [PATCH v2 1/2] check-reqs.eclass: runtime disk checks for any path 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240226063105.1767-1-robbat2@gentoo.org \
    --to=robbat2@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox