GNU bug report logs - #50614
[PATCH core-updates] build: utils: Add ‘optional’ macro.

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: Xinglu Chen <public@HIDDEN>; Keywords: patch; dated Thu, 16 Sep 2021 07:12:02 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.

Message received at 50614 <at> debbugs.gnu.org:


Received: (at 50614) by debbugs.gnu.org; 19 Sep 2021 13:50:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 19 09:50:53 2021
Received: from localhost ([127.0.0.1]:37704 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mRxDZ-0008Jr-2E
	for submit <at> debbugs.gnu.org; Sun, 19 Sep 2021 09:50:53 -0400
Received: from h87-96-130-155.cust.a3fiber.se ([87.96.130.155]:50926
 helo=mail.yoctocell.xyz) by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <public@HIDDEN>) id 1mRxDW-0008Jc-49
 for 50614 <at> debbugs.gnu.org; Sun, 19 Sep 2021 09:50:51 -0400
From: Xinglu Chen <public@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yoctocell.xyz;
 s=mail; t=1632059442;
 bh=OZBnOtVjQbsI8p7v3fH9L73lwroG0LiOGAlWK77nq90=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date;
 b=dggjx5epdZsp/6mTI40baSHJG5tZp9n2Ip23VNDtnzJa+3Fj6h+p3fApnFxhmnBYd
 PhRyTmcsgIdl/CDACAbSf6u3bSp5cjld9xIx47ozHnMpPvo4vAZB7Vkv5+ShruCR+n
 NHJwrvFz75NVm62j6zpF7ZooiW6bpFzW1VGWNMt0=
To: 50614 <at> debbugs.gnu.org
Subject: [PATCH core-updates v2] build: utils: Add =?utf-8?B?4oCYbGlzdC13?=
 =?utf-8?B?aGVu4oCZ?= macro.
In-Reply-To: <08db559a4e24a409d332b3552d6a176de6353166.1631867018.git.public@HIDDEN>
References: <08db559a4e24a409d332b3552d6a176de6353166.1631867018.git.public@HIDDEN>
Message-Id: <ccbe07b719e498438a8f610cffa9ba274f6d608d.1632059166.git.public@HIDDEN>
Date: Sun, 19 Sep 2021 15:50:41 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 2.9 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview: * 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: S [...] 
 Content analysis details:   (2.9 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 SPF_PASS               SPF: sender matches SPF record
 2.0 PDS_OTHER_BAD_TLD      Untrustworthy TLDs
 [URI: yoctocell.xyz (xyz)]
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 0.5 FROM_SUSPICIOUS_NTLD   From abused NTLD
 0.4 RDNS_DYNAMIC           Delivered to internal network by host with
 dynamic-looking rDNS
 0.0 PDS_RDNS_DYNAMIC_FP    RDNS_DYNAMIC with FP steps
X-Debbugs-Envelope-To: 50614
Cc: Sarah Morgensen <iskarian@HIDDEN>,
 Liliana Marie Prikler <liliana.prikler@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 1.9 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  * 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: S [...] 
 
 Content analysis details:   (1.9 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 SPF_PASS               SPF: sender matches SPF record
  2.0 PDS_OTHER_BAD_TLD      Untrustworthy TLDs
                             [URI: yoctocell.xyz (xyz)]
  0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
  0.5 FROM_SUSPICIOUS_NTLD   From abused NTLD
  0.4 RDNS_DYNAMIC           Delivered to internal network by host with
                             dynamic-looking rDNS
 -1.0 MAILING_LIST_MULTI     Multiple indicators imply a widely-seen list
                             manager
  0.0 PDS_RDNS_DYNAMIC_FP    RDNS_DYNAMIC with FP steps

* 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 =E2=80=98scheme-indent-function=E2=80=99 to 1 for =E2=
=80=98list-when=E2=80=99.
---
Changes since v1:

* Add an entry for =E2=80=98list-when=E2=80=99 in .dir-locals.el.

* Some fixes to the documentation.

 .dir-locals.el        |  1 +
 doc/guix.texi         | 34 ++++++++++++++++++++++++++++++++++
 guix/build/utils.scm  | 17 ++++++++++++++++-
 tests/build-utils.scm |  8 ++++++++
 4 files changed, 59 insertions(+), 1 deletion(-)

diff --git a/.dir-locals.el b/.dir-locals.el
index 919ed1d1c4..554044ee8c 100644
--- a/.dir-locals.el
+++ b/.dir-locals.el
@@ -56,6 +56,7 @@ ((nil
    (eval . (put 'lambda* 'scheme-indent-function 1))
    (eval . (put 'substitute* 'scheme-indent-function 1))
    (eval . (put 'match-record 'scheme-indent-function 2))
+   (eval . (put 'list-when 'scheme-indent-function 1))
=20
    ;; 'modify-inputs' and its keywords.
    (eval . (put 'modify-inputs 'scheme-indent-function 1))
diff --git a/doc/guix.texi b/doc/guix.texi
index 9a3e8ae12c..4bea366b8e 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -8801,6 +8801,40 @@
         `("PATH" ":" prefix ,(list coreutils))))))
 @end lisp
=20
+@subsection Miscellaneous
+
+@cindex miscellaneous build utilities
+This section documents some miscellaneous utilities.
+
+@deffn {Scheme Syntax} list-when @var{test} @var{consequent} @dots{}
+Like @code{when} (@pxref{Conditionals,,, guile, GNU Guile Reference
+Manual}), but if @var{test} evaluates to true, return @code{(list
+@var{consequent} @dots{})}, and if @var{test} evaluates to false, return
+the empty list.  This replaces the following idiom:
+@end deffn
+
+@lisp
+(if @var{test}
+    (list @var{consequent} @dots{})
+    '())
+@end lisp
+
+with this:
+
+@lisp
+(list-when @var{test} @var{consequent} @dots{})
+@end lisp
+
+It can be useful when certain targets require additional configure
+flags, e.g.,
+
+@lisp
+(arguments
+ `(#:configure-flags (list "--localstatedir=3D/var"
+                           "--sysconfdir=3D/etc"
+                           ,@@(list-when (hurd-target?) "--with-courage"))=
))
+@end lisp
+
 @subsection Build Phases
=20
 @cindex build phases
diff --git a/guix/build/utils.scm b/guix/build/utils.scm
index 3beb7da67a..d3fb207ee5 100644
--- a/guix/build/utils.scm
+++ b/guix/build/utils.scm
@@ -8,6 +8,7 @@
 ;;; Copyright =C2=A9 2020 Efraim Flashner <efraim@HIDDEN>
 ;;; Copyright =C2=A9 2020, 2021 Maxim Cournoyer <maxim.cournoyer@HIDDEN>
 ;;; Copyright =C2=A9 2021 Maxime Devos <maximedevos@HIDDEN>
+;;; Copyright =C2=A9 2021 Xinglu Chen <public@HIDDEN>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -123,7 +124,9 @@ (define-module (guix build utils)
=20
             make-desktop-entry-file
=20
-            locale-category->string))
+            locale-category->string
+
+            list-when))
=20
 
 ;;;
@@ -1613,6 +1616,18 @@ (define (locale-category->string category)
              LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE
              LC_TIME)))
=20
+
+;;;
+;;; Misc.
+;;;
+
+;; If EXPR1 evaluates to a non-#f value, return '(EXPR2 ...).  Otherwise,
+;; return an empty list.
+(define-syntax list-when
+  (syntax-rules ()
+    ((_ expr1 expr2 ...)
+     (if expr1 (list expr2 ...) '()))))
+
 ;;; Local Variables:
 ;;; eval: (put 'call-with-output-file/atomic 'scheme-indent-function 1)
 ;;; eval: (put 'call-with-ascii-input-file 'scheme-indent-function 1)
diff --git a/tests/build-utils.scm b/tests/build-utils.scm
index 6b131c0af8..b558feb47d 100644
--- a/tests/build-utils.scm
+++ b/tests/build-utils.scm
@@ -3,6 +3,7 @@
 ;;; Copyright =C2=A9 2019 Ricardo Wurmus <rekado@HIDDEN>
 ;;; Copyright =C2=A9 2021 Maxim Cournoyer <maxim.cournoyer@HIDDEN>
 ;;; Copyright =C2=A9 2021 Maxime Devos <maximedevos@HIDDEN>
+;;; Copyright =C2=A9 2021 Xinglu Chen <public@HIDDEN>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -287,5 +288,12 @@ (define-module (test build-utils)
           ("guile/bin" . ,(dirname (which "guile"))))
         "guile"))))
=20
+(test-equal "list-when: expr1 is non-#f"
+  (list 3 'bar)
+  (list-when 'foo (+ 1 2) 'bar))
+
+(test-equal "list-when: expr1 is #f"
+  '()
+  (list-when #f (+ 2 3) 'bar))
=20
 (test-end)

base-commit: 22f7d4bce1e694b7ac38e62410d76a6d46d96c5d
--=20
2.33.0







Information forwarded to guix-patches@HIDDEN:
bug#50614; Package guix-patches. Full text available.

Message received at 50614 <at> debbugs.gnu.org:


Received: (at 50614) by debbugs.gnu.org; 19 Sep 2021 13:41:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 19 09:41:37 2021
Received: from localhost ([127.0.0.1]:37695 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mRx4a-00083B-TD
	for submit <at> debbugs.gnu.org; Sun, 19 Sep 2021 09:41:37 -0400
Received: from h87-96-130-155.cust.a3fiber.se ([87.96.130.155]:50678
 helo=mail.yoctocell.xyz) by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <public@HIDDEN>) id 1mRx4Z-00082m-IR
 for 50614 <at> debbugs.gnu.org; Sun, 19 Sep 2021 09:41:35 -0400
From: Xinglu Chen <public@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yoctocell.xyz;
 s=mail; t=1632058887;
 bh=1MobOyZeaeyqrFclISZ/MD8BwR4twjLBlp8V4xJOQoA=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date;
 b=om9nQm73uXILBREHkyRRHNlSU0FiVYzggeNHCuLy6SeTveZnu2+LgwhqekAwzsRTf
 AGS8J0rPyHw7s0k4AReEAjktikaJVc22IMKJIxyRHx0J3Uf7Jrr6nny5EwskmSgdsN
 fBJx3jQsYaCLn1l1gyiaPXY0uTG0SHex7Tw/AP0E=
To: Sarah Morgensen <iskarian@HIDDEN>
Subject: Re: [bug#50614] [PATCH] build: utils: Add =?utf-8?B?4oCYbGlzdC13?=
 =?utf-8?B?aGVu4oCZ?= macro.
In-Reply-To: <86tuijggcr.fsf@HIDDEN>
References: <b7ee7798dbf384021126a2cd4366b604730181b8.1631776133.git.public@HIDDEN>
 <08db559a4e24a409d332b3552d6a176de6353166.1631867018.git.public@HIDDEN>
 <86tuijggcr.fsf@HIDDEN>
Date: Sun, 19 Sep 2021 15:41:26 +0200
Message-ID: <87v92wof7d.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha256; protocol="application/pgp-signature"
X-Spam-Score: 2.9 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  On Fri, Sep 17 2021, Sarah Morgensen wrote: > Hi, > > Looking
 at this again I have a couple more comments. > > Xinglu Chen
 <public@HIDDEN>
 writes: >> +@cindex miscellaneous build utilities >> +This section documents
 some miscellaneous ut [...] 
 Content analysis details:   (2.9 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 SPF_PASS               SPF: sender matches SPF record
 2.0 PDS_OTHER_BAD_TLD      Untrustworthy TLDs
 [URI: yoctocell.xyz (xyz)]
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 0.5 FROM_SUSPICIOUS_NTLD   From abused NTLD
 0.4 RDNS_DYNAMIC           Delivered to internal network by host with
 dynamic-looking rDNS
 0.0 PDS_RDNS_DYNAMIC_FP    RDNS_DYNAMIC with FP steps
X-Debbugs-Envelope-To: 50614
Cc: 50614 <at> debbugs.gnu.org, Liliana Marie Prikler <liliana.prikler@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 2.9 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  On Fri, Sep 17 2021, Sarah Morgensen wrote: > Hi, > > Looking
    at this again I have a couple more comments. > > Xinglu Chen <public@HIDDEN>
    writes: >> +@cindex miscellaneous build utilities >> +This section documents
    some miscellaneous ut [...] 
 
 Content analysis details:   (2.9 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 SPF_PASS               SPF: sender matches SPF record
  2.0 PDS_OTHER_BAD_TLD      Untrustworthy TLDs
                             [URI: yoctocell.xyz (xyz)]
  0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
  0.5 FROM_SUSPICIOUS_NTLD   From abused NTLD
  0.4 RDNS_DYNAMIC           Delivered to internal network by host with
                             dynamic-looking rDNS
  1.0 BULK_RE_SUSP_NTLD      Precedence bulk and RE: from a suspicious TLD
 -1.0 MAILING_LIST_MULTI     Multiple indicators imply a widely-seen list
                             manager
  0.0 PDS_RDNS_DYNAMIC_FP    RDNS_DYNAMIC with FP steps

--=-=-=
Content-Type: text/plain

On Fri, Sep 17 2021, Sarah Morgensen wrote:

> Hi,
>
> Looking at this again I have a couple more comments.
>
> Xinglu Chen <public@HIDDEN> writes:
>> +@cindex miscellaneous build utilities
>> +This section documents some miscellaneous utilities that are useful to
>> +have.
>
> "that are useful to have" is implied by its presence in the manual, so
> it's unnecessary to write it.

Good point.

> Also, you might consider adding a rule to .dir-locals.el:
>
>   (eval . (put list-when 'scheme-indent-function 1))
>
> which would cause it to be indented like this:
>
>   (list-when expr1
>     expr2
>     expr3)

Yes, that would be a good idea.

> (I pointed out a couple other minor grammar corrections in the last
> review--did you see those?)

Oops, looks like I missed those.  I will send a v2 with the suggestions
applied.  :-)


--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQJJBAEBCAAzFiEEAVhh4yyK5+SEykIzrPUJmaL7XHkFAmFHPgcVHHB1YmxpY0B5
b2N0b2NlbGwueHl6AAoJEKz1CZmi+1x5ZpQP/0/p2m+XQWnl0m7pXDJtBTuGZr5f
01V38qdlazS0Yn7gD7pHbpuMDn7874nDVDndilxfp9bIddwNqLr1lKsFSELi/gsA
ZuvkUO2VfKD2Xw/XmuZLcfG6vwRm22SHIcmjgOZs9QOkb05FRzhe9n8OWVTZypPC
QsvUHZJoiiUX0Qn2eAm+rdAYidY2UNp0H/KbbIF9G8sCM9W43mhytpREpWAq5toY
doohKSeor5lM6fuJeolwvH85VXJ6PoAR98cZ3eWVKvbqTlmWzWFoQtBZIej6VELn
ipukqH4IxE8XIDUXpnuhtNq29CspQ6BM/I/axUdeDBCneqTvZx12UUN3y5NoAW1L
aQNUXZxk1BsUil56UAINCr5B66qjajLmDBTThHoX+W+2EZtq6h5kOLe2gcuSKf7/
IMVE7FXGuLWNQYv6R9smAU0/CBikg8alQuAkaPCv+NwbfYc8gqzbhwiKlmDoo5W3
nPMuc4A+EbyPZV26jeJaavhZr03NP8RnyBWuR9pp68243e2vAnjqQSyqiUCgXX2s
bb/eIBfCI3Y5xyN2ERdD5bgK224kiZkIi/wLOH5DGJGrYuIK6kYevn8l8nb1V9Oi
1HEhk6Byy/DircVXevmXOOn1UlPvcxCTdFvR4VwbwpmyOTJjDdG2Xcm7ZmVQvNSk
FjpvyzTakUHdep2n
=mO9A
-----END PGP SIGNATURE-----
--=-=-=--




Information forwarded to guix-patches@HIDDEN:
bug#50614; Package guix-patches. Full text available.

Message received at 50614 <at> debbugs.gnu.org:


Received: (at 50614) by debbugs.gnu.org; 19 Sep 2021 13:39:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 19 09:39:37 2021
Received: from localhost ([127.0.0.1]:37688 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mRx2b-0007zP-Kg
	for submit <at> debbugs.gnu.org; Sun, 19 Sep 2021 09:39:37 -0400
Received: from h87-96-130-155.cust.a3fiber.se ([87.96.130.155]:50618
 helo=mail.yoctocell.xyz) by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <public@HIDDEN>) id 1mRx2W-0007z4-37
 for 50614 <at> debbugs.gnu.org; Sun, 19 Sep 2021 09:39:32 -0400
From: Xinglu Chen <public@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yoctocell.xyz;
 s=mail; t=1632058757;
 bh=8xpzXxG2CnKP8f/Y+GTChxI89s4qTdJG5cS8SJTXIII=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date;
 b=A8uSbuOo+5SXQtuzcye/KKdn5c7WLlUzC6O1XdBR9S9n+VDdFD0EqkL+0lAZr9eOe
 5QMRfPX937hoAj3FVrqVrJn2zDWb/m0pu0BAosQQ2nvFHDzJRohFxG6r+XBhLOB0XR
 akYlEE9/0oK87d2UdxTrwuY0+y5DsgIgY2lMyzko=
To: Liliana Marie Prikler <liliana.prikler@HIDDEN>, 50614 <at> debbugs.gnu.org
Subject: Re: [bug#50614] [PATCH] build: utils: Add =?utf-8?B?4oCYbGlzdC13?=
 =?utf-8?B?aGVu4oCZ?= macro.
In-Reply-To: <eb9d11aa546425b6012feba70a2967b1f9b0b1f4.camel@HIDDEN>
References: <b7ee7798dbf384021126a2cd4366b604730181b8.1631776133.git.public@HIDDEN>
 <08db559a4e24a409d332b3552d6a176de6353166.1631867018.git.public@HIDDEN>
 <eb9d11aa546425b6012feba70a2967b1f9b0b1f4.camel@HIDDEN>
Date: Sun, 19 Sep 2021 15:38:26 +0200
Message-ID: <87y27sofcd.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha256; protocol="application/pgp-signature"
X-Spam-Score: 2.9 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  On Fri, Sep 17 2021,
 Liliana Marie Prikler wrote: > Am Freitag, 
 den 17.09.2021, 10:26 +0200 schrieb Xinglu Chen: >> * guix/build/utils.scm
 (list-when): New syntax >> * tests/build-utils.scm ("list-when: expr1 is
 non-#f", list-when: >> expr1 is #f"): [...] 
 Content analysis details:   (2.9 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 SPF_PASS               SPF: sender matches SPF record
 2.0 PDS_OTHER_BAD_TLD      Untrustworthy TLDs
 [URI: yoctocell.xyz (xyz)]
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 0.5 FROM_SUSPICIOUS_NTLD   From abused NTLD
 0.4 RDNS_DYNAMIC           Delivered to internal network by host with
 dynamic-looking rDNS
 0.0 PDS_RDNS_DYNAMIC_FP    RDNS_DYNAMIC with FP steps
X-Debbugs-Envelope-To: 50614
Cc: Sarah Morgensen <iskarian@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 2.9 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  On Fri, Sep 17 2021, Liliana Marie Prikler wrote: > Am Freitag,
    den 17.09.2021, 10:26 +0200 schrieb Xinglu Chen: >> * guix/build/utils.scm
    (list-when): New syntax >> * tests/build-utils.scm ("list-when: expr1 is
   non-#f", list-when: >> expr1 is #f"): [...] 
 
 Content analysis details:   (2.9 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 SPF_PASS               SPF: sender matches SPF record
  2.0 PDS_OTHER_BAD_TLD      Untrustworthy TLDs
                             [URI: yoctocell.xyz (xyz)]
  0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
  0.5 FROM_SUSPICIOUS_NTLD   From abused NTLD
  0.4 RDNS_DYNAMIC           Delivered to internal network by host with
                             dynamic-looking rDNS
  1.0 BULK_RE_SUSP_NTLD      Precedence bulk and RE: from a suspicious TLD
 -1.0 MAILING_LIST_MULTI     Multiple indicators imply a widely-seen list
                             manager
  0.0 PDS_RDNS_DYNAMIC_FP    RDNS_DYNAMIC with FP steps

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On Fri, Sep 17 2021, Liliana Marie Prikler wrote:

> Am Freitag, den 17.09.2021, 10:26 +0200 schrieb Xinglu Chen:
>> * 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.
>> ---
>> Changes since v1:
>>=20
>> * Rename =E2=80=98optional=E2=80=99 to =E2=80=98list-when=E2=80=99.
>>=20
>> * Make
>>=20
>>     (list-when test consequent ...)
>>=20
>>   equivalent to
>>=20
>>     (if tests
>>         (list consequent ...)
>>         '())
> LGTM, but let's wait on more opinions.  IIRC, changing (guix build)
> causes a world rebuild, no?  So this patch might go to core-updates
> first.

Sorry, I forgot to add =E2=80=98core-updates=E2=80=99 to the subject prefix.

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQJJBAEBCAAzFiEEAVhh4yyK5+SEykIzrPUJmaL7XHkFAmFHPVIVHHB1YmxpY0B5
b2N0b2NlbGwueHl6AAoJEKz1CZmi+1x5q0QQAL38nYOe7WgGzSYl3XvkpzdicOVR
S40Rhc+rh7mdvm9yf+Y7DIG6mtVR7Ea1+lKa8bs63OGgHoM9J2TfZkoZiZwVDwLa
oGHO2zECTG3ESIaJN/1DCo2c5OuG1cOf66vAzEahfKd77SdVzQXKawQF7155958W
NF++n1RK38Zp83pnxqattiNyONXvEoJoYK3o++o0TGUA8hiLKHWIineink3Hu0r/
FHapErErhHC7CB8lLcvManWeVPBU5u6dd0zGtSzB67dPMq8HSMEvUjXM3emJgjUa
wigHyq1WPJS0ac0rqY1jfFoPFvZw2FUiJOGvHRQ5UqEpy9JkhaSENr0v/NadmuUv
YCoe4IO5YtlcDXNHkHJm6TQ2k5JXkXnlooGrznY5uAynqDOvF5UNZn0LSSxGLmk8
OkZDLnOM9KcmAogBENuXzFvH0C14iCKt6v63w6LJtWKjsH71S/5Teup0TR69kFuj
4B+bzMyd+oJJ0fXp8kTa7+ipin1dp7vgHshTbM8gsrpWOieyiyZqxG8OVFB0kirD
OIfyJvpENyJ1gftxn/fXBmUC1TZ8UI7VD9ubx8pGVCFz1lTE0OY/EfIaYh2IsR5g
/oq6kzakaibE+vyKNUg62c3injj47Mmkae2Nj0GvRMXtSeAo0id2RMpYuYL4HsTe
+xVqRcE+uaY1TQp/
=ja/C
-----END PGP SIGNATURE-----
--=-=-=--




Information forwarded to guix-patches@HIDDEN:
bug#50614; Package guix-patches. Full text available.

Message received at 50614 <at> debbugs.gnu.org:


Received: (at 50614) by debbugs.gnu.org; 18 Sep 2021 14:41:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 18 10:41:53 2021
Received: from localhost ([127.0.0.1]:36432 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mRbXN-0008E7-33
	for submit <at> debbugs.gnu.org; Sat, 18 Sep 2021 10:41:53 -0400
Received: from baptiste.telenet-ops.be ([195.130.132.51]:47780)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maximedevos@HIDDEN>) id 1mRbXL-0008Dy-91
 for 50614 <at> debbugs.gnu.org; Sat, 18 Sep 2021 10:41:52 -0400
Received: from ptr-bvsjgyjmffd7q9timvx.18120a2.ip6.access.telenet.be
 ([IPv6:2a02:1811:8c09:9d00:aaf1:9810:a0b8:a55d])
 by baptiste.telenet-ops.be with bizsmtp
 id vSho2500J0mfAB401Sho9x; Sat, 18 Sep 2021 16:41:49 +0200
Message-ID: <9b662947afe2da5d5243bfa09fa85a1caf9ab2cc.camel@HIDDEN>
Subject: Re: [bug#50614] [PATCH] build: utils: Add
 =?UTF-8?Q?=E2=80=98list-when=E2=80=99?= macro.
From: Maxime Devos <maximedevos@HIDDEN>
To: Liliana Marie Prikler <liliana.prikler@HIDDEN>, Xinglu Chen
 <public@HIDDEN>, 50614 <at> debbugs.gnu.org
Date: Sat, 18 Sep 2021 16:41:42 +0200
In-Reply-To: <eb9d11aa546425b6012feba70a2967b1f9b0b1f4.camel@HIDDEN>
References: <b7ee7798dbf384021126a2cd4366b604730181b8.1631776133.git.public@HIDDEN>
 <08db559a4e24a409d332b3552d6a176de6353166.1631867018.git.public@HIDDEN>
 <eb9d11aa546425b6012feba70a2967b1f9b0b1f4.camel@HIDDEN>
Content-Type: multipart/signed; micalg="pgp-sha512";
 protocol="application/pgp-signature"; boundary="=-ftP8CVdGEmwI5TJw2k1s"
User-Agent: Evolution 3.34.2 
MIME-Version: 1.0
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r21;
 t=1631976109; bh=n/WxhpW4Drmd/1anVb+M0pZ/uXYctrd4z4Fa4R1c7Vo=;
 h=Subject:From:To:Cc:Date:In-Reply-To:References;
 b=nUxC7nd8+dI+MouVJAv1/pLAZ3bxAqYL+9seqVPM8XD/lcHofLRM0lf5bWXaQEUZx
 i+hiL71X2FcXieBEJcwqYjhwz4wBflsFL9dUXBU6/rEtLqC8INybt9sdpQv/5yOZcp
 Rb8Vi+ZTDd47NPWN87dcmaR+0X5FTXyjRT2NJHL0aSx8hOtHmF2YPcFDHKrk0FnQJ9
 jLnWz6SRRW0dhaG+5FFSUiscMUlXIfSU04FAkpFk45FiJppzUJhAakJYqteVXEY4nL
 6qlKawL7dKD+9yWQyQ9glyosRqaYmdak2APM78YzP4305/2fpuggBcndQDdZ7+HlbS
 A2f7/l6egnyQw==
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 50614
Cc: Sarah Morgensen <iskarian@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)


--=-ftP8CVdGEmwI5TJw2k1s
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Liliana Marie Prikler schreef op vr 17-09-2021 om 19:55 [+0200]:
> Am Freitag, den 17.09.2021, 10:26 +0200 schrieb Xinglu Chen:
> > * 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.
> > ---
> > Changes since v1:
> >=20
> > * Rename =E2=80=98optional=E2=80=99 to =E2=80=98list-when=E2=80=99.
> >=20
> > * Make
> >=20
> >     (list-when test consequent ...)
> >=20
> >   equivalent to
> >=20
> >     (if tests
> >         (list consequent ...)
> >         '())
> LGTM, but let's wait on more opinions.

It looks nice to me, though you might want an opinion from someone who
is new to Scheme.

Greetings,
Maxime.

--=-ftP8CVdGEmwI5TJw2k1s
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: This is a digitally signed message part
Content-Transfer-Encoding: 7bit

-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYUX6pxccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7hIUAPsGwfhTLPq6OgTLxssjGXoewgdE
sqqNd2VLDvfmXypKDAD+LaBJies1pB2XMyqHxOR/kd4wrl2lwo9Xk/FNooMLTAg=
=A59r
-----END PGP SIGNATURE-----

--=-ftP8CVdGEmwI5TJw2k1s--





Information forwarded to guix-patches@HIDDEN:
bug#50614; Package guix-patches. Full text available.

Message received at 50614 <at> debbugs.gnu.org:


Received: (at 50614) by debbugs.gnu.org; 17 Sep 2021 19:31:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 17 15:31:12 2021
Received: from localhost ([127.0.0.1]:33049 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mRJZn-0002ji-TF
	for submit <at> debbugs.gnu.org; Fri, 17 Sep 2021 15:31:12 -0400
Received: from mail-wr1-f67.google.com ([209.85.221.67]:42784)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <liliana.prikler@HIDDEN>) id 1mRJZl-0002jU-HH
 for 50614 <at> debbugs.gnu.org; Fri, 17 Sep 2021 15:31:10 -0400
Received: by mail-wr1-f67.google.com with SMTP id q11so16835094wrr.9
 for <50614 <at> debbugs.gnu.org>; Fri, 17 Sep 2021 12:31:09 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=message-id:subject:from:to:cc:date:in-reply-to:references
 :user-agent:mime-version:content-transfer-encoding;
 bh=zpm/iRb0ETuE+H2qButZp6nsZqOcA+78uuJK5JjbJjY=;
 b=WvnjNW8bAUSPzD7iTGGAex4TKXcwGWNqG7LI5CNpFibN+ClXr5gqOKtFpkL39g48oX
 RXskLyX6GajjkbHTROmRGLpGFFhQtNlV+yX4EvZDYJFepteEKguSiXUAcn1YFB/c9xEI
 skSBDI9PnO/+JeNQfVXIr//2sJtPVSi3FuA/Wv12uT87CoO7a1Q+W1104hRMuC5ef2/y
 6QvOVkD8cHpArRN9a/O5JHXbEaf+LzA/r8eanMU2ZRBYHCh23jzsy8peykdAtS2LsVrz
 Fd/4gO9BRF5nB2UOIc7OUv5DqRtnr/LZKCxUd5zxvF24Skd+ASCh5iNE+qhvdYVsUzPC
 8hwg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to
 :references:user-agent:mime-version:content-transfer-encoding;
 bh=zpm/iRb0ETuE+H2qButZp6nsZqOcA+78uuJK5JjbJjY=;
 b=2WDzyCaDBsT9jQ/bxTtgSf/tcbyFcgizvP2uvidEXQHGwyY++yvrL7xJWPoKawWqZs
 1tDKzNLqrWBMwbuir+ey/5dQgkyU88YP6+EXFVTPw8GNTjoZB9ZJ3G0OOisR4CFo6grI
 0gKfaYb8GcDAWiYduQ4Z/y+FUb9poNwXP9mRlPNfzBz5g9I6ucRDWHGUAXZIZ4rP23Mk
 62WlgPKLK6+fEoHFWu7p1todocoWMvGvlyMldT6yY/tZCfh/VIpSZ+Zp5/0UUh1jDTkQ
 vSneGuFw40v/cl/vmDpa32dxAkchtVN7uuJnMqSh1ixd7qSQrxY9YlfpOQm9ITDI9C+2
 JTnw==
X-Gm-Message-State: AOAM5336rQDVWIXf+QL0foOESndaQfyTlvRoAv5scuu+ph7/XBSFZZMA
 2HdTAomQUiY8TAEAa/bfQ7U=
X-Google-Smtp-Source: ABdhPJx+z+M6QeqAfeq4G3cMgoL6mc/yswbnYAV2CHZO8mcWT8O6ZpMWp+RPgrp9engWq7Fk/vUggg==
X-Received: by 2002:a5d:63d2:: with SMTP id c18mr13672607wrw.311.1631907063745; 
 Fri, 17 Sep 2021 12:31:03 -0700 (PDT)
Received: from nijino.fritz.box (85-127-52-93.dsl.dynamic.surfer.at.
 [85.127.52.93])
 by smtp.gmail.com with ESMTPSA id u13sm6600643wmq.33.2021.09.17.12.31.03
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 17 Sep 2021 12:31:03 -0700 (PDT)
Message-ID: <7a8f3586ef49a5a4e5ec66b92581f70262262e27.camel@HIDDEN>
Subject: Re: [bug#50614] [PATCH] build: utils: Add
 =?UTF-8?Q?=E2=80=98list-when=E2=80=99?= macro.
From: Liliana Marie Prikler <liliana.prikler@HIDDEN>
To: Sarah Morgensen <iskarian@HIDDEN>
Date: Fri, 17 Sep 2021 21:31:02 +0200
In-Reply-To: <86v92zggjs.fsf@HIDDEN>
References: <b7ee7798dbf384021126a2cd4366b604730181b8.1631776133.git.public@HIDDEN>
 <08db559a4e24a409d332b3552d6a176de6353166.1631867018.git.public@HIDDEN>
 <eb9d11aa546425b6012feba70a2967b1f9b0b1f4.camel@HIDDEN>
 <86v92zggjs.fsf@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
User-Agent: Evolution 3.34.2 
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 50614
Cc: 50614 <at> debbugs.gnu.org, Xinglu Chen <public@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Am Freitag, den 17.09.2021, 12:15 -0700 schrieb Sarah Morgensen:
> Do we actually use this idiom anywhere build-side?  (If not, does it
> belong in (guix utils)?  Or should we stick it in (guix build utils)
> just to be safe?)
I'm pretty sure that this would mostly be used in quasi-quoted contexts
outside of the actual build to build #:configure-flags, #:make-flags
and inputs.  However, I can't really say there'd be no use of it inside
builds, even if builds typically don't need to check for conditionals
other than tests?





Information forwarded to guix-patches@HIDDEN:
bug#50614; Package guix-patches. Full text available.

Message received at 50614 <at> debbugs.gnu.org:


Received: (at 50614) by debbugs.gnu.org; 17 Sep 2021 19:19:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 17 15:19:22 2021
Received: from localhost ([127.0.0.1]:33044 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mRJOL-0002Rl-Qp
	for submit <at> debbugs.gnu.org; Fri, 17 Sep 2021 15:19:21 -0400
Received: from out2.migadu.com ([188.165.223.204]:50933)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <iskarian@HIDDEN>) id 1mRJOK-0002Rc-49
 for 50614 <at> debbugs.gnu.org; Fri, 17 Sep 2021 15:19:21 -0400
X-Report-Abuse: Please report any abuse attempt to abuse@HIDDEN and
 include these headers.
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mgsn.dev; s=key1;
 t=1631906358;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to:references:references;
 bh=GwsxQlO+Px+5jmH6qXMRKFcad4WVznsA3od5TExnmyI=;
 b=GFDVe5q1NCe6lIvxTjoHs18n4N8KjMdfrV+ascsw5JpfRT3FC58+ujxAc3TKQS4NVpBa0a
 3FFTs+TOzRTpGwLkRBa9cNIf5jMLjDwJmmariOe6nC/xXSyXOpo5hR1fEqGUm+zXrBiNYY
 8KlTSuXsc1D+wDPbbegHIRas+MV0VH8=
From: Sarah Morgensen <iskarian@HIDDEN>
To: Xinglu Chen <public@HIDDEN>
Subject: Re: [bug#50614] [PATCH] build: utils: Add =?utf-8?B?4oCYbGlzdC13?=
 =?utf-8?B?aGVu4oCZ?= macro.
References: <b7ee7798dbf384021126a2cd4366b604730181b8.1631776133.git.public@HIDDEN>
 <08db559a4e24a409d332b3552d6a176de6353166.1631867018.git.public@HIDDEN>
Date: Fri, 17 Sep 2021 12:19:16 -0700
In-Reply-To: <08db559a4e24a409d332b3552d6a176de6353166.1631867018.git.public@HIDDEN>
 (Xinglu Chen's message of "Fri, 17 Sep 2021 10:26:41 +0200 (10 hours, 45
 seconds ago)")
Message-ID: <86tuijggcr.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Migadu-Flow: FLOW_OUT
X-Migadu-Auth-User: iskarian@HIDDEN
X-Spam-Score: 2.0 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  Hi,
 Looking at this again I have a couple more comments. Xinglu
 Chen <public@HIDDEN> writes: > +@cindex miscellaneous build utilities
 > +This section documents some miscellaneous utilities that are useful to
 > +have. 
 Content analysis details:   (2.0 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 SPF_PASS               SPF: sender matches SPF record
 -0.0 RCVD_IN_MSPIKE_H2      RBL: Average reputation (+2)
 [188.165.223.204 listed in wl.mailspike.net]
 2.0 PDS_OTHER_BAD_TLD      Untrustworthy TLDs
 [URI: yoctocell.xyz (xyz)]
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
X-Debbugs-Envelope-To: 50614
Cc: 50614 <at> debbugs.gnu.org, Liliana Marie Prikler <liliana.prikler@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 1.0 (+)

Hi,

Looking at this again I have a couple more comments.

Xinglu Chen <public@HIDDEN> writes:
> +@cindex miscellaneous build utilities
> +This section documents some miscellaneous utilities that are useful to
> +have.

"that are useful to have" is implied by its presence in the manual, so
it's unnecessary to write it.

Also, you might consider adding a rule to .dir-locals.el:

  (eval . (put list-when 'scheme-indent-function 1))

which would cause it to be indented like this:

  (list-when expr1
    expr2
    expr3)

(I pointed out a couple other minor grammar corrections in the last
review--did you see those?)

--
Sarah




Information forwarded to guix-patches@HIDDEN:
bug#50614; Package guix-patches. Full text available.

Message received at 50614 <at> debbugs.gnu.org:


Received: (at 50614) by debbugs.gnu.org; 17 Sep 2021 19:15:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 17 15:15:11 2021
Received: from localhost ([127.0.0.1]:33032 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mRJKJ-0002LV-HL
	for submit <at> debbugs.gnu.org; Fri, 17 Sep 2021 15:15:11 -0400
Received: from out0.migadu.com ([94.23.1.103]:59209)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <iskarian@HIDDEN>) id 1mRJKH-0002LI-17
 for 50614 <at> debbugs.gnu.org; Fri, 17 Sep 2021 15:15:10 -0400
X-Report-Abuse: Please report any abuse attempt to abuse@HIDDEN and
 include these headers.
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mgsn.dev; s=key1;
 t=1631906107;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 content-transfer-encoding:content-transfer-encoding:
 in-reply-to:in-reply-to:references:references;
 bh=hZQu4pcLw4VdLE+L45LAh9Z6tqshfkFGjyjfLPDlhvU=;
 b=d9PKEZjzPAjHKxCzCwvrP1HQMbtMBGdmk7BDOgee76LzK+btV2b3T4t6ChUjzxwv3322pg
 aza61QToGE8jyH123mz2Ah5yEvvno3+jpVS5TE2iCFNMn3euK1SOChRca4gTioYDf8VIuI
 Xbw2POeacrB1XU7ykaTJ3x7Q2lpjlqE=
From: Sarah Morgensen <iskarian@HIDDEN>
To: Liliana Marie Prikler <liliana.prikler@HIDDEN>
Subject: Re: [bug#50614] [PATCH] build: utils: Add =?utf-8?B?4oCYbGlzdC13?=
 =?utf-8?B?aGVu4oCZ?= macro.
References: <b7ee7798dbf384021126a2cd4366b604730181b8.1631776133.git.public@HIDDEN>
 <08db559a4e24a409d332b3552d6a176de6353166.1631867018.git.public@HIDDEN>
 <eb9d11aa546425b6012feba70a2967b1f9b0b1f4.camel@HIDDEN>
Date: Fri, 17 Sep 2021 12:15:03 -0700
In-Reply-To: <eb9d11aa546425b6012feba70a2967b1f9b0b1f4.camel@HIDDEN>
 (Liliana Marie Prikler's message of "Fri, 17 Sep 2021 19:55:52 +0200 (1
 hour, 17 minutes, 50 seconds ago)")
Message-ID: <86v92zggjs.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Migadu-Flow: FLOW_OUT
X-Migadu-Auth-User: iskarian@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 50614
Cc: 50614 <at> debbugs.gnu.org, Xinglu Chen <public@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Hi,

Liliana Marie Prikler <liliana.prikler@HIDDEN> writes:

> Am Freitag, den 17.09.2021, 10:26 +0200 schrieb Xinglu Chen:
>> * 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.
>> ---
>> Changes since v1:
>>=20
>> * Rename =E2=80=98optional=E2=80=99 to =E2=80=98list-when=E2=80=99.
>>=20
>> * Make
>>=20
>>     (list-when test consequent ...)
>>=20
>>   equivalent to
>>=20
>>     (if tests
>>         (list consequent ...)
>>         '())
> LGTM, but let's wait on more opinions.  IIRC, changing (guix build)
> causes a world rebuild, no?  So this patch might go to core-updates
> first.

Do we actually use this idiom anywhere build-side?  (If not, does it
belong in (guix utils)?  Or should we stick it in (guix build utils)
just to be safe?)

--
Sarah




Information forwarded to guix-patches@HIDDEN:
bug#50614; Package guix-patches. Full text available.

Message received at 50614 <at> debbugs.gnu.org:


Received: (at 50614) by debbugs.gnu.org; 17 Sep 2021 17:56:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 17 13:56:08 2021
Received: from localhost ([127.0.0.1]:32954 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mRI5n-0000Pf-VQ
	for submit <at> debbugs.gnu.org; Fri, 17 Sep 2021 13:56:08 -0400
Received: from mail-wm1-f47.google.com ([209.85.128.47]:46910)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <liliana.prikler@HIDDEN>) id 1mRI5g-0000OU-Kt
 for 50614 <at> debbugs.gnu.org; Fri, 17 Sep 2021 13:56:05 -0400
Received: by mail-wm1-f47.google.com with SMTP id
 d207-20020a1c1dd8000000b00307e2d1ec1aso7427193wmd.5
 for <50614 <at> debbugs.gnu.org>; Fri, 17 Sep 2021 10:56:00 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=message-id:subject:from:to:cc:date:in-reply-to:references
 :user-agent:mime-version:content-transfer-encoding;
 bh=kq1Le8/vqnZdIrwNrD6EUp0EKywHEcjGgrZM36j7/1k=;
 b=M6BXlfQxkIplSNJYJo5NrYClJkro+DFhFXuVp1uqhtGsr6xXVwrTxH8yhWjhwiiB9x
 elCCSGbAIdI4/binWaKhZtTjAJkmS/dmqZL55dc/Qaew5/2YITqBZminKHwWlM0VZJ6B
 fCiFO/3dMMAVP6Y1C5m1h99x5H5B41DtnqXwb6uDs2sBSaGlYPlCW12II5TypkTHzJJE
 dCxatkWUBJETBq1KFe+XdHMUymczSMCkxzm6I5A5qoJ/7/Ul/Eg0477JPI5ANuMj4/SS
 N0/djlQKfx3n8zrNxUOvk7h+RGh+QpNnKUYQr5xvBXAJzW2wULxZ1BsAB0hqGlOTMUQ3
 ru1w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to
 :references:user-agent:mime-version:content-transfer-encoding;
 bh=kq1Le8/vqnZdIrwNrD6EUp0EKywHEcjGgrZM36j7/1k=;
 b=VcjrrZLdPFWlc8KLrTaNJg0Edyl4fYYvGJiiIdL+mc/V5sfdD65Gos873hysN8uQpc
 RuYnp1YJ9J9nzVa4sG0n8IdpubpDuBmMepa3rWz7zCB4rVEtI3dfJxbbCs9qr9NLakF3
 ujKBJgxq1CV/EJoJD40pliCrVyKGoyEK0zpepyz+scDCU8+gLnX2lULACwAE8h0FiA/l
 yA1gUOKYqQv03D7hnYYvaYi359f2iH8ny7+3IFiQx5ADYKtnSWryGC6eGkEqhKwpwqiY
 4IgxbB/xSbkXX/hpx/fDCyuidLpsJ4QWfjqDs1vFSt7Z+NEpRl6P0mUsoqQa6F4rxZvJ
 +1Vw==
X-Gm-Message-State: AOAM532F3VhdhOWggl65NCoFErqoDWPFikV1QXROWHORBpFrz64zc9eD
 bfQUxFFtmcanJ4REAR/wxTY=
X-Google-Smtp-Source: ABdhPJw6XKSZuWb8lkQFbIxKxvkteqWFWQAsl31XjxAeYpRefPPlClRi7HpX8h6hoe+WpkN8p0S4mw==
X-Received: by 2002:a1c:2785:: with SMTP id n127mr3484533wmn.155.1631901354643; 
 Fri, 17 Sep 2021 10:55:54 -0700 (PDT)
Received: from nijino.fritz.box (85-127-52-93.dsl.dynamic.surfer.at.
 [85.127.52.93])
 by smtp.gmail.com with ESMTPSA id o17sm7460860wrj.96.2021.09.17.10.55.53
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 17 Sep 2021 10:55:54 -0700 (PDT)
Message-ID: <eb9d11aa546425b6012feba70a2967b1f9b0b1f4.camel@HIDDEN>
Subject: Re: [PATCH] build: utils: Add
 =?UTF-8?Q?=E2=80=98list-when=E2=80=99?= macro.
From: Liliana Marie Prikler <liliana.prikler@HIDDEN>
To: Xinglu Chen <public@HIDDEN>, 50614 <at> debbugs.gnu.org
Date: Fri, 17 Sep 2021 19:55:52 +0200
In-Reply-To: <08db559a4e24a409d332b3552d6a176de6353166.1631867018.git.public@HIDDEN>
References: <b7ee7798dbf384021126a2cd4366b604730181b8.1631776133.git.public@HIDDEN>
 <08db559a4e24a409d332b3552d6a176de6353166.1631867018.git.public@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
User-Agent: Evolution 3.34.2 
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 50614
Cc: Sarah Morgensen <iskarian@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Am Freitag, den 17.09.2021, 10:26 +0200 schrieb Xinglu Chen:
> * 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.
> ---
> Changes since v1:
> 
> * Rename ‘optional’ to ‘list-when’.
> 
> * Make
> 
>     (list-when test consequent ...)
> 
>   equivalent to
> 
>     (if tests
>         (list consequent ...)
>         '())
LGTM, but let's wait on more opinions.  IIRC, changing (guix build)
causes a world rebuild, no?  So this patch might go to core-updates
first.





Information forwarded to guix-patches@HIDDEN:
bug#50614; Package guix-patches. Full text available.

Message received at 50614 <at> debbugs.gnu.org:


Received: (at 50614) by debbugs.gnu.org; 17 Sep 2021 08:26:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 17 04:26:56 2021
Received: from localhost ([127.0.0.1]:58443 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mR9Cx-0001sZ-Pq
	for submit <at> debbugs.gnu.org; Fri, 17 Sep 2021 04:26:56 -0400
Received: from h87-96-130-155.cust.a3fiber.se ([87.96.130.155]:33300
 helo=mail.yoctocell.xyz) by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <public@HIDDEN>) id 1mR9Cw-0001sL-2L
 for 50614 <at> debbugs.gnu.org; Fri, 17 Sep 2021 04:26:55 -0400
From: Xinglu Chen <public@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yoctocell.xyz;
 s=mail; t=1631867204;
 bh=kf65h+k4wrgAm6eIOeqOs33UDqKrUmq0pRMkl2GKBzE=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date;
 b=jDNQGHx/wuXtQ4GJZ7obXeGyxXRduj45cWzDbErysec+Qb8LQNf0qScGnT+dU8+AG
 biAjVTkAE6fxzOjZfY5uS9kFHbD35jSmBWuD+mGJtRmGetboq80JRIxYmhct55yscy
 ctg7ayXIK5T/NSCm6Ra6L95StjC2p1WULBsTS+kg=
To: 50614 <at> debbugs.gnu.org
Subject: [PATCH] =?UTF-8?q?build:=20utils:=20Add=20=E2=80=98list-when?=
 =?UTF-8?q?=E2=80=99=20macro.?=
In-Reply-To: <b7ee7798dbf384021126a2cd4366b604730181b8.1631776133.git.public@HIDDEN>
References: <b7ee7798dbf384021126a2cd4366b604730181b8.1631776133.git.public@HIDDEN>
Message-Id: <08db559a4e24a409d332b3552d6a176de6353166.1631867018.git.public@HIDDEN>
Date: Fri, 17 Sep 2021 10:26:41 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 2.9 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview: * 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. --- Changes since v [...] 
 Content analysis details:   (2.9 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 SPF_PASS               SPF: sender matches SPF record
 2.0 PDS_OTHER_BAD_TLD      Untrustworthy TLDs
 [URI: yoctocell.xyz (xyz)]
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 0.5 FROM_SUSPICIOUS_NTLD   From abused NTLD
 0.4 RDNS_DYNAMIC           Delivered to internal network by host with
 dynamic-looking rDNS
 0.0 PDS_RDNS_DYNAMIC_FP    RDNS_DYNAMIC with FP steps
X-Debbugs-Envelope-To: 50614
Cc: Sarah Morgensen <iskarian@HIDDEN>,
 Liliana Marie Prikler <liliana.prikler@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 1.9 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  * 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. --- Changes since v [...] 
 
 Content analysis details:   (1.9 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 SPF_PASS               SPF: sender matches SPF record
  2.0 PDS_OTHER_BAD_TLD      Untrustworthy TLDs
                             [URI: yoctocell.xyz (xyz)]
  0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
  0.5 FROM_SUSPICIOUS_NTLD   From abused NTLD
  0.4 RDNS_DYNAMIC           Delivered to internal network by host with
                             dynamic-looking rDNS
 -1.0 MAILING_LIST_MULTI     Multiple indicators imply a widely-seen list
                             manager
  0.0 PDS_RDNS_DYNAMIC_FP    RDNS_DYNAMIC with FP steps

* 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.
---
Changes since v1:

* Rename =E2=80=98optional=E2=80=99 to =E2=80=98list-when=E2=80=99.

* Make

    (list-when test consequent ...)

  equivalent to

    (if tests
        (list consequent ...)
        '())

 doc/guix.texi         | 35 +++++++++++++++++++++++++++++++++++
 guix/build/utils.scm  | 17 ++++++++++++++++-
 tests/build-utils.scm |  8 ++++++++
 3 files changed, 59 insertions(+), 1 deletion(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 9a3e8ae12c..3b469c04c9 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -8801,6 +8801,41 @@ in a build phase of the @code{wireguard-tools} packa=
ge:
         `("PATH" ":" prefix ,(list coreutils))))))
 @end lisp
=20
+@subsection Miscellaneous
+
+@cindex miscellaneous build utilities
+This section documents some miscellaneous utilities that are useful to
+have.
+
+@deffn {Scheme Syntax} list-when @var{test} @var{consequent} @dots{}
+Like @code{when} (@pxref{Conditionals,,, guile, GNU Guile Reference
+Manual}), but if @var{test} evaluates to true, return @code{(list
+@var{consequent} @dots{})}, and if @var{test} evaluates to false, return
+the empty list.  This is replaces the following idiom:
+@end deffn
+
+@lisp
+(if @var{test}
+    (list @var{consequent} @dots{})
+    '())
+@end lisp
+
+with this:
+
+@lisp
+(list-when @var{test} @var{consequent} @dots{})
+@end lisp
+
+It can be useful when certain targets require an additional configure
+flags, e.g.,
+
+@lisp
+(arguments
+ `(#:configure-flags (list "--localstatedir=3D/var"
+                           "--sysconfdir=3D/etc"
+                           ,@@(list-when (hurd-target?) "--with-courage"))=
))
+@end lisp
+
 @subsection Build Phases
=20
 @cindex build phases
diff --git a/guix/build/utils.scm b/guix/build/utils.scm
index 3beb7da67a..d3fb207ee5 100644
--- a/guix/build/utils.scm
+++ b/guix/build/utils.scm
@@ -8,6 +8,7 @@
 ;;; Copyright =C2=A9 2020 Efraim Flashner <efraim@HIDDEN>
 ;;; Copyright =C2=A9 2020, 2021 Maxim Cournoyer <maxim.cournoyer@HIDDEN>
 ;;; Copyright =C2=A9 2021 Maxime Devos <maximedevos@HIDDEN>
+;;; Copyright =C2=A9 2021 Xinglu Chen <public@HIDDEN>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -123,7 +124,9 @@
=20
             make-desktop-entry-file
=20
-            locale-category->string))
+            locale-category->string
+
+            list-when))
=20
 
 ;;;
@@ -1613,6 +1616,18 @@ returned."
              LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE
              LC_TIME)))
=20
+
+;;;
+;;; Misc.
+;;;
+
+;; If EXPR1 evaluates to a non-#f value, return '(EXPR2 ...).  Otherwise,
+;; return an empty list.
+(define-syntax list-when
+  (syntax-rules ()
+    ((_ expr1 expr2 ...)
+     (if expr1 (list expr2 ...) '()))))
+
 ;;; Local Variables:
 ;;; eval: (put 'call-with-output-file/atomic 'scheme-indent-function 1)
 ;;; eval: (put 'call-with-ascii-input-file 'scheme-indent-function 1)
diff --git a/tests/build-utils.scm b/tests/build-utils.scm
index 6b131c0af8..b558feb47d 100644
--- a/tests/build-utils.scm
+++ b/tests/build-utils.scm
@@ -3,6 +3,7 @@
 ;;; Copyright =C2=A9 2019 Ricardo Wurmus <rekado@HIDDEN>
 ;;; Copyright =C2=A9 2021 Maxim Cournoyer <maxim.cournoyer@HIDDEN>
 ;;; Copyright =C2=A9 2021 Maxime Devos <maximedevos@HIDDEN>
+;;; Copyright =C2=A9 2021 Xinglu Chen <public@HIDDEN>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -287,5 +288,12 @@ print('hello world')"))
           ("guile/bin" . ,(dirname (which "guile"))))
         "guile"))))
=20
+(test-equal "list-when: expr1 is non-#f"
+  (list 3 'bar)
+  (list-when 'foo (+ 1 2) 'bar))
+
+(test-equal "list-when: expr1 is #f"
+  '()
+  (list-when #f (+ 2 3) 'bar))
=20
 (test-end)

base-commit: 22f7d4bce1e694b7ac38e62410d76a6d46d96c5d
--=20
2.33.0







Information forwarded to guix-patches@HIDDEN:
bug#50614; Package guix-patches. Full text available.

Message received at 50614 <at> debbugs.gnu.org:


Received: (at 50614) by debbugs.gnu.org; 17 Sep 2021 00:37:30 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 16 20:37:30 2021
Received: from localhost ([127.0.0.1]:57943 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mR1sg-00068t-Hr
	for submit <at> debbugs.gnu.org; Thu, 16 Sep 2021 20:37:30 -0400
Received: from out2.migadu.com ([188.165.223.204]:47882)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <iskarian@HIDDEN>) id 1mR1sd-00068g-L5
 for 50614 <at> debbugs.gnu.org; Thu, 16 Sep 2021 20:37:29 -0400
X-Report-Abuse: Please report any abuse attempt to abuse@HIDDEN and
 include these headers.
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mgsn.dev; s=key1;
 t=1631839046;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 content-transfer-encoding:content-transfer-encoding:
 in-reply-to:in-reply-to:references:references;
 bh=a4189ToxF8Lyjx7eWNVvTuEaAidd1nlJ7QpfDWAqB+U=;
 b=T5GGDlhIK7jJw17sl12VDUeuJau9LdYDpPnzxmf+F1IBltzUE64QApe/r+MqKMl9MFQ/LT
 CMFdWeKV7HtN722peEh3Ff1P6V/aOBtKDsh7plNQYSXklmASky2icjGy+MRPrZ6HVwMjoP
 pfZn4Z99auB6/13ueN87XSC/JXPlL38=
From: Sarah Morgensen <iskarian@HIDDEN>
To: Xinglu Chen <public@HIDDEN>
Subject: Re: [bug#50614] [PATCH core-updates] build: utils: Add
 =?utf-8?B?4oCYb3B0aW9uYWzigJk=?= macro.
References: <b7ee7798dbf384021126a2cd4366b604730181b8.1631776133.git.public@HIDDEN>
Date: Thu, 16 Sep 2021 17:37:24 -0700
In-Reply-To: <b7ee7798dbf384021126a2cd4366b604730181b8.1631776133.git.public@HIDDEN>
 (Xinglu Chen's message of "Thu, 16 Sep 2021 09:11:22 +0200 (17 hours, 10
 minutes, 11 seconds ago)")
Message-ID: <864kakhwaj.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Migadu-Flow: FLOW_OUT
X-Migadu-Auth-User: iskarian@HIDDEN
X-Spam-Score: 2.0 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  Hi,
 Xinglu Chen <public@HIDDEN> writes: > * guix/build/utils.scm
 (optional): New syntax > * tests/build-utils.scm ("optional: expr1 is non-#f", 
 optional: expr1 is #f"): > Test it. > * guix.texi (Build Utilities): Document
 it. > --- > A comm [...] 
 Content analysis details:   (2.0 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 RCVD_IN_MSPIKE_H2      RBL: Average reputation (+2)
 [188.165.223.204 listed in wl.mailspike.net]
 -0.0 SPF_PASS               SPF: sender matches SPF record
 2.0 PDS_OTHER_BAD_TLD      Untrustworthy TLDs
 [URI: yoctocell.xyz (xyz)]
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
X-Debbugs-Envelope-To: 50614
Cc: 50614 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 1.0 (+)

Hi,

Xinglu Chen <public@HIDDEN> writes:

> * guix/build/utils.scm (optional): New syntax
> * tests/build-utils.scm ("optional: expr1 is non-#f", optional: expr1 is =
#f"):
>   Test it.
> * guix.texi (Build Utilities): Document it.
> ---
> A common idiom I have seen is
>
>   (if EXPR1
>       EXPR2
>       '())
>
> with the =E2=80=98optional=E2=80=99 macro, one can just write
>
>   (optional EXPR1
>             EXPR2)
>
> I am not sure if =E2=80=98optional=E2=80=99 is the best name (it was insp=
ired by
> =E2=80=98lib.optional=E2=80=99 in Nixpkgs), feedback welcome!

I like the idea!  But perhaps if we're getting rid of boilerplate, we
should go all the way and make it so that instead of

  (if EXPR1
      `(EXPR2 EXPR3)
      '())

we can write

  (optional EXPR1 EXPR2 EXPR3)

What do you think?

Also, maybe 'list-when' for the name?

> +@deffn {Scheme Syntax} optional @var{test} @var{consequent}
> +Like @code{when} (@pxref{Conditionals,,, guile, GNU Guile Reference
> +Manual}), but if @var{test} evaluates to false, return the empty list.
> +This is replaces the following idiom:
        ^ no "is"

> +@end deffn
> +
> +@lisp
> +(if @var{test}
> +    @var{consequent}
> +    '())
> +@end lisp
> +
> +with this:
> +
> +@lisp
> +(optional @var{test}
> +          @var{consequent})
> +@end lisp=20=20=20=20=20=20=20=20=20=20
> +
> +It can be useful when certain targets require an additional configure
                                                 ^ no "an"

> +flags, e.g.,
> +
> +@lisp
> +(arguments
> + `(#:configure-flags (list "--localstatedir=3D/var"
> +                           "--sysconfdir=3D/etc"
> +                           ,@@(optional (hurd-target?) '("--with-courage=
"))))
                               ^ extra "@"?

--
Sarah




Information forwarded to guix-patches@HIDDEN:
bug#50614; Package guix-patches. Full text available.

Message received at 50614 <at> debbugs.gnu.org:


Received: (at 50614) by debbugs.gnu.org; 16 Sep 2021 16:22:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 16 12:22:05 2021
Received: from localhost ([127.0.0.1]:56317 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mQu9E-00077R-UR
	for submit <at> debbugs.gnu.org; Thu, 16 Sep 2021 12:22:05 -0400
Received: from mail-wr1-f66.google.com ([209.85.221.66]:39818)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <liliana.prikler@HIDDEN>) id 1mQu9C-00076l-0g
 for 50614 <at> debbugs.gnu.org; Thu, 16 Sep 2021 12:22:03 -0400
Received: by mail-wr1-f66.google.com with SMTP id u15so10410423wru.6
 for <50614 <at> debbugs.gnu.org>; Thu, 16 Sep 2021 09:22:01 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=message-id:subject:from:to:date:in-reply-to:references:user-agent
 :mime-version:content-transfer-encoding;
 bh=oAoJPFIBOAzw954Rrn9Q8rqGEIQHgf/TicNZDNCCP6M=;
 b=ddHbP3JNB9wSPcSzYix6+WiLKzk6MMIzx0fOYph2JoThUUp+YlpZjrJ3sF8GAGmoMu
 X0+Iqjvc/CT5UMylKc+pvnkq8KMYGn00rjUvov9d7tAK7jiKYnC4WQ6vt+MWlGO3v/n8
 cgQo2mTSMcZiDfQjHLLG+qX//sZGRzX12WrTMuFif3ti2TG8mPLOy2wUnYXUcP5W6Uc9
 Jk4vuMZDk9SknUPiWVYUJDQ0PIFXZYVMsw1/ydYNT2S4UE6wnPyLBZbFeWY4reRqLGCj
 6WEnnAg30gX3QNiZ37zlO+4ALaXFxuB9XVDufv1/q3G20zhA3/CQoJwqrO1KG4rJ4EIq
 FClQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:message-id:subject:from:to:date:in-reply-to
 :references:user-agent:mime-version:content-transfer-encoding;
 bh=oAoJPFIBOAzw954Rrn9Q8rqGEIQHgf/TicNZDNCCP6M=;
 b=uN5XGuErP74qs0STgnLpDjGgJUXYNxZxcJlvhvbtsF6toMfUsdQhICfGU2FECLaf2I
 RM6uXDmd4lcLDfRDGYWqbMhLwVhZErxU98FkLVck4j/j02djPk0VEkuZGiiRGcvooA8q
 wfu+qvaA8Vs9uJgGF4QNaoV4E/UksC5NnhpKiVUqBVRcZnLsGG3FyCsAA/utHM2PxgcN
 kkBJg4wetXVV1pljjS1bu2AEBqycQk/5PGlWOAE/R9BekjPk9Eo9gnqC7zcyVftG7JFp
 bG0WC/qcjsrHB/UH70YNT5m/0cQ5p4OPPuTaC/BsBk5pMCmomQIclnP6oZLjZHBN67R+
 YS+g==
X-Gm-Message-State: AOAM530OkAuY2qLXAGTrYleGvWFHVK2GrcHWKmhGdSZA9ES/Hb3iw+FA
 M2uCa/moKLFsDrWmWBeIu0wUt+5zR9Y=
X-Google-Smtp-Source: ABdhPJwAZ7vybSx5u2+7cdorj06E9sqhngWMNv/BcTdY76qBGqVbFBc9yqaONxPudV1h6grt7qE81A==
X-Received: by 2002:a05:6000:18a4:: with SMTP id
 b4mr1106490wri.96.1631809315883; 
 Thu, 16 Sep 2021 09:21:55 -0700 (PDT)
Received: from nijino.fritz.box (85-127-52-93.dsl.dynamic.surfer.at.
 [85.127.52.93])
 by smtp.gmail.com with ESMTPSA id e2sm4000318wra.40.2021.09.16.09.21.55
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 16 Sep 2021 09:21:55 -0700 (PDT)
Message-ID: <d4b9d957809ed02dd7c1f85d6519f719ad016abe.camel@HIDDEN>
Subject: Re: [PATCH core-updates] build: utils: Add
 =?UTF-8?Q?=E2=80=98optional=E2=80=99?= macro.
From: Liliana Marie Prikler <liliana.prikler@HIDDEN>
To: Xinglu Chen <public@HIDDEN>, 50614 <at> debbugs.gnu.org
Date: Thu, 16 Sep 2021 18:21:54 +0200
In-Reply-To: <b7ee7798dbf384021126a2cd4366b604730181b8.1631776133.git.public@HIDDEN>
References: <b7ee7798dbf384021126a2cd4366b604730181b8.1631776133.git.public@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
User-Agent: Evolution 3.34.2 
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: 2.0 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  Hi, Am Donnerstag, den 16.09.2021, 09:11 +0200 schrieb Xinglu
 Chen: > * guix/build/utils.scm (optional): New syntax > *
 tests/build-utils.scm
 ("optional: expr1 is non-#f", optional: expr1 > is #f"): > Tes [...] 
 Content analysis details:   (2.0 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 SPF_PASS               SPF: sender matches SPF record
 0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
 provider (liliana.prikler[at]gmail.com)
 2.0 PDS_OTHER_BAD_TLD      Untrustworthy TLDs
 [URI: yoctocell.xyz (xyz)]
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 -0.0 RCVD_IN_MSPIKE_H2      RBL: Average reputation (+2)
 [209.85.221.66 listed in wl.mailspike.net]
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
 no trust [209.85.221.66 listed in list.dnswl.org]
X-Debbugs-Envelope-To: 50614
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 1.0 (+)

Hi,

Am Donnerstag, den 16.09.2021, 09:11 +0200 schrieb Xinglu Chen:
> * guix/build/utils.scm (optional): New syntax
> * tests/build-utils.scm ("optional: expr1 is non-#f", optional: expr1
> is #f"):
>   Test it.
> * guix.texi (Build Utilities): Document it.
> ---
> A common idiom I have seen is
> 
>   (if EXPR1
>       EXPR2
>       '())
> 
> with the ‘optional’ macro, one can just write
> 
>   (optional EXPR1
>             EXPR2)
> 
> I am not sure if ‘optional’ is the best name (it was inspired by
> ‘lib.optional’ in Nixpkgs), feedback welcome!
> 
>  doc/guix.texi         | 35 +++++++++++++++++++++++++++++++++++
>  guix/build/utils.scm  | 17 ++++++++++++++++-
>  tests/build-utils.scm |  8 ++++++++
>  3 files changed, 59 insertions(+), 1 deletion(-)
> 
> diff --git a/doc/guix.texi b/doc/guix.texi
> index 9a3e8ae12c..1bb9ddb397 100644
> --- a/doc/guix.texi
> +++ b/doc/guix.texi
> @@ -8801,6 +8801,41 @@ in a build phase of the @code{wireguard-tools} 
> package:
>          `("PATH" ":" prefix ,(list coreutils))))))
>  @end lisp
>  
> +@subsection Miscellaneous build utilities
> +
> +@cindex miscellaneous build utilities
> +This section documents some miscellaneous utilities that are useful
> to +have.
> +
> +@deffn {Scheme Syntax} optional @var{test} @var{consequent}
> +Like @code{when} (@pxref{Conditionals,,, guile, GNU Guile Reference
> +Manual}), but if @var{test} evaluates to false, return the empty
> list.
> +This is replaces the following idiom:
> +@end deffn
> +
> +@lisp
> +(if @var{test}
> +    @var{consequent}
> +    '())
> +@end lisp
> +
> +with this:
> +
> +@lisp
> +(optional @var{test}
> +          @var{consequent})
> +@end lisp          
> +
> +It can be useful when certain targets require an additional
> configure
> +flags, e.g.,
> +
> +@lisp
> +(arguments
> + `(#:configure-flags (list "--localstatedir=/var"
> +                           "--sysconfdir=/etc"
> +                           ,@@(optional (hurd-target?) '("--with-
> courage"))))
> +@end lisp
> +
>  @subsection Build Phases
>  
>  @cindex build phases
> diff --git a/guix/build/utils.scm b/guix/build/utils.scm
> index 3beb7da67a..ecf834461f 100644
> --- a/guix/build/utils.scm
> +++ b/guix/build/utils.scm
> @@ -8,6 +8,7 @@
>  ;;; Copyright © 2020 Efraim Flashner <efraim@HIDDEN>
>  ;;; Copyright © 2020, 2021 Maxim Cournoyer <
> maxim.cournoyer@HIDDEN>
>  ;;; Copyright © 2021 Maxime Devos <maximedevos@HIDDEN>
> +;;; Copyright © 2021 Xinglu Chen <public@HIDDEN>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -123,7 +124,9 @@
>  
>              make-desktop-entry-file
>  
> -            locale-category->string))
> +            locale-category->string
> +
> +            optional))
>  
>  
>  ;;;
> @@ -1613,6 +1616,18 @@ returned."
>               LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE
>               LC_TIME)))
>  
> +
> +;;;
> +;;; Misc.
> +;;;
> +
> +;; If EXPR1 evaluates to a non-#f value, return EXPR2.  Otherwise,
> return an
> +;; empty list.
> +(define-syntax optional
> +  (syntax-rules ()
> +    ((_ expr1 expr2)
> +     (if expr1 expr2 '()))))
> +
>  ;;; Local Variables:
>  ;;; eval: (put 'call-with-output-file/atomic 'scheme-indent-function 
> 1)
>  ;;; eval: (put 'call-with-ascii-input-file 'scheme-indent-function
> 1)
> diff --git a/tests/build-utils.scm b/tests/build-utils.scm
> index 6b131c0af8..44ad9bafc0 100644
> --- a/tests/build-utils.scm
> +++ b/tests/build-utils.scm
> @@ -3,6 +3,7 @@
>  ;;; Copyright © 2019 Ricardo Wurmus <rekado@HIDDEN>
>  ;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@HIDDEN>
>  ;;; Copyright © 2021 Maxime Devos <maximedevos@HIDDEN>
> +;;; Copyright © 2021 Xinglu Chen <public@HIDDEN>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -287,5 +288,12 @@ print('hello world')"))
>            ("guile/bin" . ,(dirname (which "guile"))))
>          "guile"))))
>  
> +(test-equal "optional: expr1 is non-#f"
> +  'bar
> +  (optional 'foo 'bar))
> +
> +(test-equal "optional: expr1 is #f"
> +  '()
> +  (optional #f 'bar))
>  
>  (test-end)
> 
> base-commit: 22f7d4bce1e694b7ac38e62410d76a6d46d96c5d

Naming choice aside, I don't think I like the asymmetry behind having a
plain symbol on the one side vs. an empty list.  What about 
(list-if condition . rest), which evaluates to rest if condition is
true and otherwise nil?





Information forwarded to guix-patches@HIDDEN:
bug#50614; Package guix-patches. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 16 Sep 2021 07:11:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 16 03:11:44 2021
Received: from localhost ([127.0.0.1]:53659 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mQlYd-00008e-R5
	for submit <at> debbugs.gnu.org; Thu, 16 Sep 2021 03:11:44 -0400
Received: from lists.gnu.org ([209.51.188.17]:60654)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <public@HIDDEN>) id 1mQlYZ-00008V-Ry
 for submit <at> debbugs.gnu.org; Thu, 16 Sep 2021 03:11:43 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:60072)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <public@HIDDEN>)
 id 1mQlYZ-0000Ez-My
 for guix-patches@HIDDEN; Thu, 16 Sep 2021 03:11:39 -0400
Received: from h87-96-130-155.cust.a3fiber.se ([87.96.130.155]:45988
 helo=mail.yoctocell.xyz)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <public@HIDDEN>)
 id 1mQlYU-0002VZ-QY
 for guix-patches@HIDDEN; Thu, 16 Sep 2021 03:11:37 -0400
From: Xinglu Chen <public@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yoctocell.xyz;
 s=mail; t=1631776283;
 bh=ImuW6s/X9UPv4WZ0b/Wdqf+cCK2oZ25rpyb3j7kzl/Y=;
 h=From:To:Subject:Date;
 b=MCPSruK1CNLZlcZuk0NSAtUpap77TBgCIB7SXqcS9Yf87Zxa7PwHp1caSgs3yzH3G
 HRVSvwFUefnA8Ttsc9/c3FldEXfQ/GT9h4sN6Be/ftxhfTsA2hAxCCCnOHSGcIypb3
 5bTgvQSxTAJe4u90QYmtgCG8Qzjcu7DXSeaSEpu4=
To: guix-patches@HIDDEN
Subject: [PATCH core-updates]
 =?UTF-8?q?build:=20utils:=20Add=20=E2=80=98optional?=
 =?UTF-8?q?=E2=80=99=20macro.?=
Message-Id: <b7ee7798dbf384021126a2cd4366b604730181b8.1631776133.git.public@HIDDEN>
Date: Thu, 16 Sep 2021 09:11:22 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass client-ip=87.96.130.155; envelope-from=public@HIDDEN;
 helo=mail.yoctocell.xyz
X-Spam_score_int: 34
X-Spam_score: 3.4
X-Spam_bar: +++
X-Spam_report: (3.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
 DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FROM_SUSPICIOUS_NTLD=0.5,
 FROM_SUSPICIOUS_NTLD_FP=1.999, PDS_OTHER_BAD_TLD=1.999, RDNS_DYNAMIC=0.982,
 SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.7 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview: * guix/build/utils.scm (optional): New syntax *
 tests/build-utils.scm
 ("optional: expr1 is non-#f", optional: expr1 is #f"): Test it. * guix.texi
 (Build Utilities): Document it. --- A common idiom I h [...] 
 Content analysis details:   (1.7 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 2.0 PDS_OTHER_BAD_TLD      Untrustworthy TLDs
 [URI: yoctocell.xyz (xyz)]
 1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
 -2.3 RCVD_IN_DNSWL_MED      RBL: Sender listed at https://www.dnswl.org/,
 medium trust [209.51.188.17 listed in list.dnswl.org]
 -0.0 RCVD_IN_MSPIKE_H2      RBL: Average reputation (+2)
 [209.51.188.17 listed in wl.mailspike.net]
 0.5 FROM_SUSPICIOUS_NTLD_FP From abused NTLD
 0.5 FROM_SUSPICIOUS_NTLD   From abused NTLD
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.2 (/)

* guix/build/utils.scm (optional): New syntax
* tests/build-utils.scm ("optional: expr1 is non-#f", optional: expr1 is #f=
"):
  Test it.
* guix.texi (Build Utilities): Document it.
---
A common idiom I have seen is

  (if EXPR1
      EXPR2
      '())

with the =E2=80=98optional=E2=80=99 macro, one can just write

  (optional EXPR1
            EXPR2)

I am not sure if =E2=80=98optional=E2=80=99 is the best name (it was inspir=
ed by
=E2=80=98lib.optional=E2=80=99 in Nixpkgs), feedback welcome!

 doc/guix.texi         | 35 +++++++++++++++++++++++++++++++++++
 guix/build/utils.scm  | 17 ++++++++++++++++-
 tests/build-utils.scm |  8 ++++++++
 3 files changed, 59 insertions(+), 1 deletion(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 9a3e8ae12c..1bb9ddb397 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -8801,6 +8801,41 @@ in a build phase of the @code{wireguard-tools} packa=
ge:
         `("PATH" ":" prefix ,(list coreutils))))))
 @end lisp
=20
+@subsection Miscellaneous build utilities
+
+@cindex miscellaneous build utilities
+This section documents some miscellaneous utilities that are useful to
+have.
+
+@deffn {Scheme Syntax} optional @var{test} @var{consequent}
+Like @code{when} (@pxref{Conditionals,,, guile, GNU Guile Reference
+Manual}), but if @var{test} evaluates to false, return the empty list.
+This is replaces the following idiom:
+@end deffn
+
+@lisp
+(if @var{test}
+    @var{consequent}
+    '())
+@end lisp
+
+with this:
+
+@lisp
+(optional @var{test}
+          @var{consequent})
+@end lisp=20=20=20=20=20=20=20=20=20=20
+
+It can be useful when certain targets require an additional configure
+flags, e.g.,
+
+@lisp
+(arguments
+ `(#:configure-flags (list "--localstatedir=3D/var"
+                           "--sysconfdir=3D/etc"
+                           ,@@(optional (hurd-target?) '("--with-courage")=
)))
+@end lisp
+
 @subsection Build Phases
=20
 @cindex build phases
diff --git a/guix/build/utils.scm b/guix/build/utils.scm
index 3beb7da67a..ecf834461f 100644
--- a/guix/build/utils.scm
+++ b/guix/build/utils.scm
@@ -8,6 +8,7 @@
 ;;; Copyright =C2=A9 2020 Efraim Flashner <efraim@HIDDEN>
 ;;; Copyright =C2=A9 2020, 2021 Maxim Cournoyer <maxim.cournoyer@HIDDEN>
 ;;; Copyright =C2=A9 2021 Maxime Devos <maximedevos@HIDDEN>
+;;; Copyright =C2=A9 2021 Xinglu Chen <public@HIDDEN>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -123,7 +124,9 @@
=20
             make-desktop-entry-file
=20
-            locale-category->string))
+            locale-category->string
+
+            optional))
=20
 
 ;;;
@@ -1613,6 +1616,18 @@ returned."
              LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE
              LC_TIME)))
=20
+
+;;;
+;;; Misc.
+;;;
+
+;; If EXPR1 evaluates to a non-#f value, return EXPR2.  Otherwise, return =
an
+;; empty list.
+(define-syntax optional
+  (syntax-rules ()
+    ((_ expr1 expr2)
+     (if expr1 expr2 '()))))
+
 ;;; Local Variables:
 ;;; eval: (put 'call-with-output-file/atomic 'scheme-indent-function 1)
 ;;; eval: (put 'call-with-ascii-input-file 'scheme-indent-function 1)
diff --git a/tests/build-utils.scm b/tests/build-utils.scm
index 6b131c0af8..44ad9bafc0 100644
--- a/tests/build-utils.scm
+++ b/tests/build-utils.scm
@@ -3,6 +3,7 @@
 ;;; Copyright =C2=A9 2019 Ricardo Wurmus <rekado@HIDDEN>
 ;;; Copyright =C2=A9 2021 Maxim Cournoyer <maxim.cournoyer@HIDDEN>
 ;;; Copyright =C2=A9 2021 Maxime Devos <maximedevos@HIDDEN>
+;;; Copyright =C2=A9 2021 Xinglu Chen <public@HIDDEN>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -287,5 +288,12 @@ print('hello world')"))
           ("guile/bin" . ,(dirname (which "guile"))))
         "guile"))))
=20
+(test-equal "optional: expr1 is non-#f"
+  'bar
+  (optional 'foo 'bar))
+
+(test-equal "optional: expr1 is #f"
+  '()
+  (optional #f 'bar))
=20
 (test-end)

base-commit: 22f7d4bce1e694b7ac38e62410d76a6d46d96c5d
--=20
2.33.0







Acknowledgement sent to Xinglu Chen <public@HIDDEN>:
New bug report received and forwarded. Copy sent to guix-patches@HIDDEN. Full text available.
Report forwarded to guix-patches@HIDDEN:
bug#50614; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 19 Sep 2021 14:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.