From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 1F8FE158041 for ; Mon, 26 Feb 2024 13:50:54 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 949F72BC016; Mon, 26 Feb 2024 13:50:49 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 3922D2BC013 for ; Mon, 26 Feb 2024 13:50:48 +0000 (UTC) Message-ID: <2d7cf2ad7b4ccd33dc2cf5d56f1315b289fa599d.camel@gentoo.org> Subject: Re: [gentoo-dev] [PATCH v2 1/2] check-reqs.eclass: runtime disk checks for any path. From: =?UTF-8?Q?Micha=C5=82_G=C3=B3rny?= To: gentoo-dev@lists.gentoo.org Cc: "Robin H. Johnson" Date: Mon, 26 Feb 2024 14:50:43 +0100 In-Reply-To: <20240226063105.1767-1-robbat2@gentoo.org> References: <20240219220832.25919-1-robbat2@gentoo.org> <20240226063105.1767-1-robbat2@gentoo.org> Organization: Gentoo Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-azbomgIiz8gb2EjoPl6K" User-Agent: Evolution 3.50.4 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 X-Archives-Salt: aa63c343-8d4f-45cd-aea0-4bac9b0a0568 X-Archives-Hash: 2335ef4d4d44ef14bda9619d50b72d1e --=-azbomgIiz8gb2EjoPl6K Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sun, 2024-02-25 at 22:31 -0800, Robin H. Johnson wrote: > Allow checking any runtime path for installing ever-larger packages. >=20 > CHECKREQS_DISK_RUNTIME=3D( /boot:40M /:350M /opt:500M ) >=20 > Recent example of large packages: >=20 > gentoo-kernel-bin: > / >=3D350MB/version (in /lib/modules) > /boot >=3D40MB/version >=20 > rust-bin: > /opt >=3D450MB/version >=20 > Signed-off-by: Robin H. Johnson > --- > eclass/check-reqs.eclass | 23 +++++++++++++++++++++++ > 1 file changed, 23 insertions(+) >=20 > 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=3D"1024M" > # > +# # install will need this much space in listed paths. > +# CHECKREQS_DISK_RUNTIME=3D( > +# /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=3D1 > # @DESCRIPTION: > # How much space is needed in /var? Eg.: CHECKREQS_DISK_VAR=3D3000M > =20 > +# @ECLASS_VARIABLE: CHECKREQS_DISK_RUNTIME > +# @DEFAULT_UNSET > +# @DESCRIPTION: > +# How much space is needed in paths? Eg.: CHECKREQS_DISK_RUNTIME=3D( /:1= G /var:5G ) > + > # @ECLASS_VARIABLE: CHECKREQS_DONOTHING > # @USER_VARIABLE > # @DEFAULT_UNSET > @@ -120,6 +132,7 @@ _check-reqs_prepare() { > debug-print-function ${FUNCNAME} "$@" > =20 > 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 > =20 > if [[ ${MERGE_TYPE} !=3D buildonly ]]; then > + if [[ "${#CHECKREQS_DISK_RUNTIME[@]}" -gt 0 ]]; then > + for _path_size in "${CHECKREQS_DISK_RUNTIME[@]}"; do > + _path=3D${_path_size/:*} > + _size=3D${_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" \ --=20 Best regards, Micha=C5=82 G=C3=B3rny --=-azbomgIiz8gb2EjoPl6K Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- iQFGBAABCgAwFiEEx2qEUJQJjSjMiybFY5ra4jKeJA4FAmXclzMSHG1nb3JueUBn ZW50b28ub3JnAAoJEGOa2uIyniQOAZIH/Aq0M2qiVq0+edD2kJYZkmKRge2y53YJ VU9ZhJJ137NjZZnwwYD9SlRL3lsMf/QXOUPWClcM3SgLhD8r4ZHp8/3iroJJbJvO 8JhQRHrfOaPKjtbXU5oyAxpoLnHbKL6FTgeZFJ3U8qRatsdjDkD0cjEUzU28QFqG m78J6dqW9BKGxSqxzFNu6id/1AYab5VITlgsDZneOPyr173xE26Zxagl+TAam99A 8bTzuO6MbJVqVY65J8s0LgMlTWABHdAepDe+IdPbFklfEPtpaF1Oy1QxDgZLnF1T HO1LYRph3D58FeMBcKYzD+ZsVrai+KeI9cqs7TLKt0m91KLl6hXY4ms= =pZHZ -----END PGP SIGNATURE----- --=-azbomgIiz8gb2EjoPl6K--