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)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id D0D5915800A for ; Thu, 20 Jul 2023 17:11:18 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id BB9D1E0885; Thu, 20 Jul 2023 17:11:14 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 7A42AE0878 for ; Thu, 20 Jul 2023 17:11:14 +0000 (UTC) Date: Thu, 20 Jul 2023 13:11:10 -0400 From: Ionen Wolkens To: gentoo-dev@lists.gentoo.org Subject: Re: [gentoo-dev] [PATCH v2] meson.eclass: allow disabling verbose compilation Message-ID: Mail-Followup-To: gentoo-dev@lists.gentoo.org References: <20230717145104.1404135-1-mattst88@gentoo.org> <20230718164433.1940514-1-mattst88@gentoo.org> <5abedff6-f348-d5fd-2ee4-552488491f4a@gentoo.org> <61b16cf8-9a1c-09c1-ab42-279fae0e0a4a@gentoo.org> 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 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="3x0KwAUrtLYRQByo" Content-Disposition: inline In-Reply-To: X-Archives-Salt: 2cedcd52-852e-4e89-ae99-25149d329034 X-Archives-Hash: 1b3eff00f9f5b24be78dd4c716f84ab7 --3x0KwAUrtLYRQByo Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jul 20, 2023 at 06:58:04PM +0200, Ulrich Mueller wrote: > >>>>> On Thu, 20 Jul 2023, Mike Gilbert wrote: >=20 > > On Thu, Jul 20, 2023 at 11:06=E2=80=AFAM Florian Schmaus wrote: > >> While the bash language has no boolean datatype, you can exploit the > >> fact that 'true' and 'false' are usually shell builtins: > >>=20 > >> : "${MESON_VERBOSE:=3Dtrue}" > >>=20 > >> and then later > >>=20 > >> if $MESON_VERBOSE; then > >> mesoncompileargs+=3D( --verbose ) > >> fi >=20 > > I think we generally try to avoid exploiting that behavior in ebuilds. > > It's usually much more obvious to check for a non-empty string, or for > > a specific value. >=20 > Testing for a non-empty variable is also faster than executing "true" > or "false" builtins from variable values. (Which doesn't play any role > here, but readability of the code does.) Yes, this is what I'd recommend typically. Then documentation can say "if set to a non-empty value" to toggle. Unfortunately this doesn't work so great when the default is enabled. Telling people to empty it is probably weird. wrt true/false, given MESON_VERBOSE can be set "by users" to anything I think trying to execute that would be extra weird. On a side-note, another way to avoid case statements is extglob which is always enabled in [[ ]] (no need for shopt) aka: [[ ${var} =3D=3D @(first|second|third) ]] --=20 ionen --3x0KwAUrtLYRQByo Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEx3SLh1HBoPy/yLVYskQGsLCsQzQFAmS5aq4ACgkQskQGsLCs QzRRNwf8CAL7Zeqmwk96d/fCPvAZZckH0MND55copN2ZbIzSYc+X6wff5TqyYftO bllwtiUj6wbmZluQeOV8FwOhsJt5YxLaeWFNLqiezGs7hhrS8+xuzmG1OaYonXQM FY+QPH+RtQbPv9E2wpKxZ00gf4CJqR7shXs2LHpSt36gOVo5xpQp+lmZ+yVMOVwr lhkHfLqJe54cycGurLsAxqJPSdi6tBUG04s7Ijp71d57gwNqjfmb8vKIJp1eHZYV rvG96AexT2BKPflid3okTSFjrswRdQGV+eyuAlCmPjDAIEDeW+MuO2pTMzg9b9HQ KcF3cTyG09UKeYHSZcJg5xY3Cj4SkA== =cGmI -----END PGP SIGNATURE----- --3x0KwAUrtLYRQByo--