Subject: [bug#50614] [PATCH core-updates v2] build: utils: Add ‘list-when’ macro.

From: Maxime Devos <[email-masked]>
Date: Sun, 19 Sep 2021 16:35:33 +0200

Xinglu Chen schreef op zo 19-09-2021 om 15:50 [+0200]:
> * guix/build/utils.scm (list-when): New syntax
> * tests/build-utils.scm ("list-when: expr1 is non-#f", list-when: expr1 is #f"):
>   Test it.
> * guix.texi (Build Utilities): Document it.
> * .dir-locals.el: Set ‘scheme-indent-function’ to 1 for ‘list-when’.
> ---

If you will be doing this in (guix build utils), leading to a world-rebuild,
you light want to define list-unless as well.  E.g., 'boost' has

    (native-inputs
     `(("perl" ,perl)
       ,@(if (%current-target-system)
             '()
             `(("python" ,python-wrapper)))
       ("tcsh" ,tcsh)))

with 'list-when', this could be rewritten to

    (native-inputs
     `(("perl" ,perl)
       ,@(list-when (not (%current-target-system))
           `("python" ,python-wrapper))
       ("tcsh" ,tcsh)))

but '(when (not ...) EXP ...)' is simply '(unless EXP ...)',
so it would be nice to be able to do

    (native-inputs
     `(("perl" ,perl)
       ,@(list-unless (%current-target-system)
           `("python" ,python-wrapper))
       ("tcsh" ,tcsh)))

Greetings,
Maxime.