public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Ionen Wolkens <ionen@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Subject: Re: [gentoo-dev] [PATCH v2] meson.eclass: allow disabling verbose compilation
Date: Thu, 20 Jul 2023 13:11:10 -0400	[thread overview]
Message-ID: <ZLlqrsfE25LlOmt9@eversor> (raw)
In-Reply-To: <uwmyujzab@gentoo.org>

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

On Thu, Jul 20, 2023 at 06:58:04PM +0200, Ulrich Mueller wrote:
> >>>>> On Thu, 20 Jul 2023, Mike Gilbert wrote:
> 
> > On Thu, Jul 20, 2023 at 11:06 AM Florian Schmaus <flow@gentoo.org> wrote:
> >> While the bash language has no boolean datatype, you can exploit the
> >> fact that 'true' and 'false' are usually shell builtins:
> >> 
> >> : "${MESON_VERBOSE:=true}"
> >> 
> >> and then later
> >> 
> >> if $MESON_VERBOSE; then
> >> mesoncompileargs+=( --verbose )
> >> fi
> 
> > 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.
> 
> 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} == @(first|second|third) ]]
-- 
ionen

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

  reply	other threads:[~2023-07-20 17:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-17 14:51 [gentoo-dev] [PATCH] meson.eclass: allow disabling verbose compilation Matt Turner
2023-07-17 14:56 ` Adrian Schollmeyer
2023-07-17 15:24   ` Matt Turner
2023-07-17 15:23 ` [gentoo-dev] " Matt Turner
2023-07-18 16:44 ` [gentoo-dev] [PATCH v2] " Matt Turner
2023-07-19  7:23   ` Florian Schmaus
2023-07-20 15:00     ` Matt Turner
2023-07-20 15:06       ` Florian Schmaus
2023-07-20 15:08         ` Matt Turner
2023-07-20 15:45         ` Mike Gilbert
2023-07-20 16:58           ` Ulrich Mueller
2023-07-20 17:11             ` Ionen Wolkens [this message]
2023-07-20 17:33               ` Ionen Wolkens

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=ZLlqrsfE25LlOmt9@eversor \
    --to=ionen@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