From unknown Sat Sep 20 23:53:13 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#48934 <48934@debbugs.gnu.org> To: bug#48934 <48934@debbugs.gnu.org> Subject: Status: [PATCH 0/2] Some improvements to (gnu services configuration) Reply-To: bug#48934 <48934@debbugs.gnu.org> Date: Sun, 21 Sep 2025 06:53:13 +0000 retitle 48934 [PATCH 0/2] Some improvements to (gnu services configuration) reassign 48934 guix-patches submitter 48934 Xinglu Chen severity 48934 normal tag 48934 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 09 09:04:43 2021 Received: (at submit) by debbugs.gnu.org; 9 Jun 2021 13:04:43 +0000 Received: from localhost ([127.0.0.1]:60748 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lqxsx-00026o-BV for submit@debbugs.gnu.org; Wed, 09 Jun 2021 09:04:43 -0400 Received: from lists.gnu.org ([209.51.188.17]:52342) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lqxst-00026d-Eh for submit@debbugs.gnu.org; Wed, 09 Jun 2021 09:04:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51952) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lqxst-0000YO-82 for guix-patches@gnu.org; Wed, 09 Jun 2021 09:04:39 -0400 Received: from h87-96-130-155.cust.a3fiber.se ([87.96.130.155]:52852 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 ) id 1lqxsr-0005pu-7I for guix-patches@gnu.org; Wed, 09 Jun 2021 09:04:38 -0400 From: Xinglu Chen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yoctocell.xyz; s=mail; t=1623243872; bh=5bBQE6rjKvTSx1/b3G8AEr8RCXtymh5IyYWIVfpszpc=; h=From:To:Cc:Subject:Date; b=pnLkIzSETXg0nSCgxedHt/9MKgVAPPk7DmsMe/xJtch+iWADLCbRp8UVn1ZP0rv0e 0Qn2Ot2/HQbzLuWWuqlXkfXtnL+ipEsb4L/kmQSUncHJqv6lVQl0df3ZJHNVsdwwAf BraShKg1SDUZQYwvE3Kvti5x/0fx1QEquYV7aayA= To: guix-patches@gnu.org Subject: [PATCH 0/2] Some improvements to (gnu services configuration) Message-Id: Date: Wed, 09 Jun 2021 15:04:31 +0200 MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Received-SPF: pass client-ip=87.96.130.155; envelope-from=public@yoctocell.xyz; helo=mail.yoctocell.xyz X-Spam_score_int: 30 X-Spam_score: 3.0 X-Spam_bar: +++ X-Spam_report: (3.0 / 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.498, FROM_SUSPICIOUS_NTLD_FP=1.597, PDS_OTHER_BAD_TLD=1.997, 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: 2.8 (++) 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: This series contains some improvements to the (gnu services configuration) module. The first patch changes the formatting of the generated documentation for configuration records. Previously, the generated documentation looked a bit different from the ones that were to generated, co [...] Content analysis details: (2.8 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 2.0 PDS_OTHER_BAD_TLD Untrustworthy TLDs [URI: yoctocell.xyz (xyz)] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [209.51.188.17 listed in wl.mailspike.net] -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] 1.6 FROM_SUSPICIOUS_NTLD_FP From abused NTLD 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders 0.5 FROM_SUSPICIOUS_NTLD From abused NTLD X-Debbugs-Envelope-To: submit Cc: Maxim Cournoyer X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.2 (/) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable This series contains some improvements to the (gnu services configuration) module. The first patch changes the formatting of the generated documentation for configuration records. Previously, the generated documentation looked a bit different from the ones that were to generated, compare the docs for =E2=80=98getmail-configuration=E2=80=99 (generated) and =E2=80=98o= penssh-configuration=E2=80=99 (not generated). =2D-8<---------------cut here---------------start------------->8--- Available =E2=80=98getmail-configuration=E2=80=99 fields are: -- =E2=80=98getmail-configuration=E2=80=99 parameter: symbol name A symbol to identify the getmail service. Defaults to =E2=80=98"unset"=E2=80=99. -- =E2=80=98getmail-configuration=E2=80=99 parameter: package package The getmail package to use. =2D-8<---------------cut here---------------end--------------->8--- =2D-8<---------------cut here---------------start------------->8--- -- Data Type: openssh-configuration This is the configuration record for OpenSSH=E2=80=99s =E2=80=98sshd= =E2=80=99. =E2=80=98openssh=E2=80=99 (default OPENSSH) The Openssh package to use. =E2=80=98pid-file=E2=80=99 (default: =E2=80=98"/var/run/sshd.pid"=E2= =80=99) Name of the file where =E2=80=98sshd=E2=80=99 writes its PID. =E2=80=98port-number=E2=80=99 (default: =E2=80=9822=E2=80=99) TCP port on which =E2=80=98sshd=E2=80=99 listens for incoming con= nections. =2D-8<---------------cut here---------------end--------------->8--- The first patch will make the generated documentation look at lot more similiar to the hand-written ones. =2D-8<---------------cut here---------------start------------->8--- -- Data Type: getmail-configuration Available =E2=80=98getmail-configuration=E2=80=99 fields are: =E2=80=98name=E2=80=99 (default: =E2=80=98"unset"=E2=80=99) (type: sym= bol) A symbol to identify the getmail service. =E2=80=98package=E2=80=99 (default: =E2=80=98getmail=E2=80=99) (type: = package) The getmail package to use. =2D-8<---------------cut here---------------end--------------->8--- If you paid close attention you will also notice that the old generated docs didn=E2=80=99t specify the default value of the =E2=80=98package=E2=80= =99 field, whereas the new docs do. This brings us to the second patch, it looks the package and shows the value of the =E2=80=98name=E2=80=99 field of the pack= age. This will only show the correct package name if the =E2=80=98name=E2=80=99 field= and the Scheme variable corresponding to the package are the same, in most cases it is, so I don=E2=80=99t think it would be a huge deal. Xinglu Chen (2): services: configuration: Change formatting of generated documentation. services: configuration: Show default value when it is a package. gnu/services/configuration.scm | 62 ++++++++++++++++++++-------------- 1 file changed, 36 insertions(+), 26 deletions(-) base-commit: 86bb77608d375043f837583332a7c852ea2080ec =2D-=20 2.32.0 --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJJBAEBCAAzFiEEAVhh4yyK5+SEykIzrPUJmaL7XHkFAmDAvF8VHHB1YmxpY0B5 b2N0b2NlbGwueHl6AAoJEKz1CZmi+1x579cP/jGOaroYfsMlBf+SY0/QSHBFBzh8 +3DGfyA5/ltMzBLHAe7aFSWUItHJqrUfGxkix2preh8iVHCq9KoGMxMr0BdEP80L t7nj+ciTE8ua10NcIW7RJTvaAeHkpb6pcEXh2mynS5sw2/z9GlcG9rX2TuyFE9mA Ov7rEp64Czg+yfJEmRy+D9G6JUzhJzPVzk6Uu5j9lL/7oNUB/pdEOteY/kQo+LOD aP0dM5UZeSzVxT0RtZcSR5pwZEtUiNht/5VesPJKtXk5lK2bgHYKfDaQjYt3kTcF vdNbZvrQYsJGSW5VORP2kKFpE9+iNebi5rP40dPnpT45H9NqgI98WM5USIauTyLU 9cxG13R+BV6F50eHSX+hF4/nOh5PmUtR2gmdv9sFLUzsq682GzAU1WYDkwxgg8qZ ciTYb0C0PiTdLmxKF6Tw3VibBcZWpE6SdugxqDfvaBzphzpkZ91oFPbExnQJQoy2 rIigctfHHegnIqdbkanuZkkgCQYL63W+qf7UtXf5Pw6NNG6M+Uh9BU3sQoMjGRLS CJvdq8/WbLs8/wh9YV2QG8HaMlCOV2YiAQ6UJj6WZz12DNZ0G+5KRsAzwIdNPZ6X 6u0AzLH5Wk6aYxBQ3iQgLmQKRGk4SVFhNukjL5Bgj0fFC7ITTpWQZlEpw9LvouEk n2YqoFUdNT22EWOI =cAuz -----END PGP SIGNATURE----- --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 09 09:06:36 2021 Received: (at 48934) by debbugs.gnu.org; 9 Jun 2021 13:06:36 +0000 Received: from localhost ([127.0.0.1]:60762 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lqxum-0002BP-C3 for submit@debbugs.gnu.org; Wed, 09 Jun 2021 09:06:36 -0400 Received: from h87-96-130-155.cust.a3fiber.se ([87.96.130.155]:32938 helo=mail.yoctocell.xyz) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lqxui-0002Ay-M0 for 48934@debbugs.gnu.org; Wed, 09 Jun 2021 09:06:34 -0400 From: Xinglu Chen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yoctocell.xyz; s=mail; t=1623243987; bh=YfxPEKFxM9q/JtnqgCSJxmOk2/nv/tOAx9c4HbOVT1s=; h=From:To:Subject:In-Reply-To:References:Date; b=e0zsV8/YWtRxPATytRkQA8pEVVN2HkcZ4EN6vngMmDXebVl7UVoeo1RXatWDFhs9R 6A/uTBhR9kxbdG3f7tG3YIbpet43JsKRPvPUTcNE1c7X26Sw3hTgOMKCwq4/la+qFq BKGM9vDuENeNMh6Y30sRMakYvNAf7Tk12O3rID2g= To: 48934@debbugs.gnu.org Subject: [PATCH 1/2] services: configuration: Change formatting of generated In-Reply-To: References: Message-Id: <07aed2e6ffe6c6fdab4a38207cafb7d3169c6e11.1623243063.git.public@yoctocell.xyz> Date: Wed, 09 Jun 2021 15:06:26 +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: * gnu/services/configuration (generate-documentation): Make the formatting of the generated docs more consistent with the rest of the docs in the “Services” section of the manual. --- gnu/services [...] Content analysis details: (2.9 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 2.0 PDS_OTHER_BAD_TLD Untrustworthy TLDs [URI: yoctocell.xyz (xyz)] 0.4 RDNS_DYNAMIC Delivered to internal network by host with dynamic-looking rDNS 0.5 FROM_SUSPICIOUS_NTLD From abused NTLD X-Debbugs-Envelope-To: 48934 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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: * gnu/services/configuration (generate-documentation): Make the formatting of the generated docs more consistent with the rest of the docs in the “Services” section of the manual. --- gnu/services [...] Content analysis details: (1.9 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 2.0 PDS_OTHER_BAD_TLD Untrustworthy TLDs [URI: yoctocell.xyz (xyz)] 0.4 RDNS_DYNAMIC Delivered to internal network by host with dynamic-looking rDNS 0.5 FROM_SUSPICIOUS_NTLD From abused NTLD -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager * gnu/services/configuration (generate-documentation): Make the formatting = of the generated docs more consistent with the rest of the docs in the =E2= =80=9CServices=E2=80=9D section of the manual. --- gnu/services/configuration.scm | 54 ++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/gnu/services/configuration.scm b/gnu/services/configuration.scm index f23840ee6d..abcbc70520 100644 --- a/gnu/services/configuration.scm +++ b/gnu/services/configuration.scm @@ -239,32 +239,34 @@ does not have a default value" field kind))) (define (generate configuration-name) (match (assq-ref documentation configuration-name) ((fields . sub-documentation) - `((para "Available " (code ,(str configuration-name)) " fields are:= ") - ,@(map - (lambda (f) - (let ((field-name (configuration-field-name f)) - (field-type (configuration-field-type f)) - (field-docs (cdr (texi-fragment->stexi - (configuration-field-documentation f= )))) - (default (catch #t - (configuration-field-default-value-thunk f) - (lambda _ '%invalid)))) - (define (show-default? val) - (or (string? val) (number? val) (boolean? val) - (and (symbol? val) (not (eq? val '%invalid))) - (and (list? val) (and-map show-default? val)))) - `(deftypevr (% (category - (code ,(str configuration-name)) " paramet= er") - (data-type ,(str field-type)) - (name ,(str field-name))) - ,@field-docs - ,@(if (show-default? default) - `((para "Defaults to " (samp ,(str default)) ".")) - '()) - ,@(append-map - generate - (or (assq-ref sub-documentation field-name) '()))))) - fields))))) + `((deftp (% (category "Data Type") (name ,(str configuration-name))) + (para "Available " (code ,(str configuration-name)) " fields ar= e:") + (table (% (formatter (asis))) + ,@(map + (lambda (f) + (let ((field-name (configuration-field-name f)) + (field-type (configuration-field-type f)) + (field-docs (cdr (texi-fragment->stexi + (configuration-field-docume= ntation f)))) + (default (catch #t + (configuration-field-default-value= -thunk f) + (lambda _ '%invalid)))) + (define (show-default? val) + (or (string? val) (number? val) (boolean? val) + (and (symbol? val) (not (eq? val '%invalid)= )) + (and (list? val) (and-map show-default? val= )))) + `(entry (% (heading (code ,(str field-name)) + ,@(if (show-default? default) + `(" (default: " (code ,= (str default)) ")") + '()) + " (type: " + ,(str field-type) + ")")) + (para ,@field-docs) + ,@(append-map + generate + (or (assq-ref sub-documentation field-= name) '()))))) + fields))))))) (stexi->texi `(*fragment* . ,(generate documentation-name)))) =20 (define (configuration->documentation configuration-symbol) --=20 2.32.0 From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 09 09:06:36 2021 Received: (at 48934) by debbugs.gnu.org; 9 Jun 2021 13:06:37 +0000 Received: from localhost ([127.0.0.1]:60764 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lqxum-0002BR-LH for submit@debbugs.gnu.org; Wed, 09 Jun 2021 09:06:36 -0400 Received: from h87-96-130-155.cust.a3fiber.se ([87.96.130.155]:32944 helo=mail.yoctocell.xyz) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lqxuj-0002B1-Mc for 48934@debbugs.gnu.org; Wed, 09 Jun 2021 09:06:34 -0400 From: Xinglu Chen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yoctocell.xyz; s=mail; t=1623243988; bh=kKET/OblmL+GlyxnFyNM/fc7x5/iatuyLGKm/wvouB0=; h=From:To:Subject:In-Reply-To:References:Date; b=giHjy4RVTYC9EFBI7bajmKHp1kxJLNxHurPnxv7OIK0Ie+m3HTTY0gOcgWQluDyia FQj1H8T40SXlrWzg8siP73LGr8f65sLEAu0fmV+PoyiioLdvoylivMTZlD9F1a/VOZ CYShK/4MRV+WJUojHNP3ZwULi0y4j84MUsUXWerk= To: 48934@debbugs.gnu.org Subject: [PATCH 2/2] services: configuration: Show default value when it is a In-Reply-To: References: Message-Id: <9de0174c0818edd7c3f1f58a264a6ea3c5c3be50.1623243063.git.public@yoctocell.xyz> Date: Wed, 09 Jun 2021 15:06:27 +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: * gnu/services/configuration.scm (generate-documentation): If the default value of a field is a package, show the value of the ‘name’ field of the package. This might not be the correct name in so [...] Content analysis details: (2.9 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 2.0 PDS_OTHER_BAD_TLD Untrustworthy TLDs [URI: yoctocell.xyz (xyz)] 0.4 RDNS_DYNAMIC Delivered to internal network by host with dynamic-looking rDNS 0.5 FROM_SUSPICIOUS_NTLD From abused NTLD X-Debbugs-Envelope-To: 48934 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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: * gnu/services/configuration.scm (generate-documentation): If the default value of a field is a package, show the value of the ‘name’ field of the package. This might not be the correct name in so [...] Content analysis details: (1.9 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 2.0 PDS_OTHER_BAD_TLD Untrustworthy TLDs [URI: yoctocell.xyz (xyz)] 0.4 RDNS_DYNAMIC Delivered to internal network by host with dynamic-looking rDNS 0.5 FROM_SUSPICIOUS_NTLD From abused NTLD -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager * gnu/services/configuration.scm (generate-documentation): If the default value of a field is a package, show the value of the =E2=80=98name=E2=80= =99 field of the package. This might not be the correct name in some cases though. --- gnu/services/configuration.scm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/gnu/services/configuration.scm b/gnu/services/configuration.scm index abcbc70520..99687d065a 100644 --- a/gnu/services/configuration.scm +++ b/gnu/services/configuration.scm @@ -252,12 +252,20 @@ does not have a default value" field kind))) (configuration-field-default-value= -thunk f) (lambda _ '%invalid)))) (define (show-default? val) - (or (string? val) (number? val) (boolean? val) + (or (string? val) (number? val) (boolean? val) = (package? val) (and (symbol? val) (not (eq? val '%invalid)= )) (and (list? val) (and-map show-default? val= )))) + + (define (show-default val) + (cond + ((package? val) + ;; Maybe not always correct. + (package-name val)) + (else (str val)))) + `(entry (% (heading (code ,(str field-name)) ,@(if (show-default? default) - `(" (default: " (code ,= (str default)) ")") + `(" (default: " (code ,= (show-default default)) ")") '()) " (type: " ,(str field-type) --=20 2.32.0 From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 02 14:10:09 2021 Received: (at 48934) by debbugs.gnu.org; 2 Aug 2021 18:10:09 +0000 Received: from localhost ([127.0.0.1]:39215 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mAcO9-0008WF-EQ for submit@debbugs.gnu.org; Mon, 02 Aug 2021 14:10:09 -0400 Received: from mail-qv1-f42.google.com ([209.85.219.42]:37432) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mAcO8-0008W1-3k for 48934@debbugs.gnu.org; Mon, 02 Aug 2021 14:10:08 -0400 Received: by mail-qv1-f42.google.com with SMTP id js7so6740354qvb.4 for <48934@debbugs.gnu.org>; Mon, 02 Aug 2021 11:10:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=sNeqlwC1gMtmGo3urky5dt67sIHiJokfOIcNZTC1lek=; b=ukkNrEz4WXCnrBxBTjf/T+WfsKpHLM2/DwUTLn/2ZIlGX0kOqJc7D6oSpl+7+M5NpK cOxy6quRfWcdsi7yVc6mda06+XlHb01Bz9FLSZZWANMq3KvU09oA82R1Yzi7GfcLDG5w VlFwDutlGDM/Y0N/nwGDDkEckcMFkotGrTvKLYaxT0flp6bnRnZjJf4ZcRCHL/QH36E9 uKEhWryIHCultCg2gM8YXKNS+9ZkyTveeBwP0jKKZ4pGugegF9UV3orAxWsLfN3mn11g JPy/Ga/X6HSRFlGrZCprgFKEqwrcSllRuviR9KhaRJcwDzdUZopC6ktRxyh7u4P3Al8G 4wXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=sNeqlwC1gMtmGo3urky5dt67sIHiJokfOIcNZTC1lek=; b=Rp/asqibqZ5f79OSvcncY+K4jj6ShrGQgy9dgU33xoaL/ZPfLYh6YHL1Pa4bDGuof1 yrXpUApMtrs5LNiWyRwBgvGM0xmTu21GU2LomsghZKoDFVKL7IXb4jwj4ypAy3WPhpEk OgCXS8NhfZmOfHho/p+cbrpO9uk4o/4yrgXtKQ3Bhed/kest6vP3beNCX2kwhfef88tw mtVgzYLaiRnEdxpBK0AsV66Vu5qOM8dHQdbDwfftQh8Ep0FpqefTbEpBgE9YqyvTPO+l zLpyPkh5aLghEdw102xpC8OznxFiMevR3+n1l0RY+XQSYIp2MKOwMuqILzWBOtViuFRM CigQ== X-Gm-Message-State: AOAM531cBb7Qm4lP57C7tAR83fm46bqMp746fBJc7N1FQOFzJ8zAbkxA WPI7bfYKDP64vhvWFHreIFHmLT8cdrLTEg== X-Google-Smtp-Source: ABdhPJxhSAZuzr3eTKo3SfwR1yDODeyzsc2/FeZWZwHgdaZ/ASz9rk7HK1UTvvYtDagmNe5OrftW6A== X-Received: by 2002:a0c:aa42:: with SMTP id e2mr17893692qvb.23.1627927802498; Mon, 02 Aug 2021 11:10:02 -0700 (PDT) Received: from hurd ([207.35.94.204]) by smtp.gmail.com with ESMTPSA id j72sm4643491qke.112.2021.08.02.11.10.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Aug 2021 11:10:02 -0700 (PDT) From: Maxim Cournoyer To: Xinglu Chen Subject: Re: bug#48934: [PATCH 0/2] Some improvements to (gnu services configuration) References: <07aed2e6ffe6c6fdab4a38207cafb7d3169c6e11.1623243063.git.public@yoctocell.xyz> Date: Mon, 02 Aug 2021 14:10:01 -0400 In-Reply-To: <07aed2e6ffe6c6fdab4a38207cafb7d3169c6e11.1623243063.git.public@yoctocell.xyz> (Xinglu Chen's message of "Wed, 09 Jun 2021 15:06:26 +0200") Message-ID: <87im0n90qu.fsf_-_@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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: Hello Xinglu! Xinglu Chen writes: > * gnu/services/configuration (generate-documentation): Make the formatting of > the generated docs more consistent with the rest of the docs in the “Services” > section of the manual. 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 (maxim.cournoyer[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_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.219.42 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.219.42 listed in wl.mailspike.net] X-Debbugs-Envelope-To: 48934 Cc: 48934@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) Hello Xinglu! Xinglu Chen writes: > * gnu/services/configuration (generate-documentation): Make the formattin= g of > the generated docs more consistent with the rest of the docs in the =E2= =80=9CServices=E2=80=9D > section of the manual. I've modified the commit message to be more in line with the GNU change log style (see 'info (standards) Style of Change Logs'), like so: services: configuration: Uniformize the generated documentation. Make the formatting of the generated docs more consistent with the rest o= f the docs in the =E2=80=9CServices=E2=80=9D section of the manual. * gnu/services/configuration (generate-documentation): Represent the data= type documentation of a field using a DEFTP table rather than DEFTYPEVR elemen= ts. > --- > gnu/services/configuration.scm | 54 ++++++++++++++++++---------------- > 1 file changed, 28 insertions(+), 26 deletions(-) > > diff --git a/gnu/services/configuration.scm b/gnu/services/configuration.= scm > index f23840ee6d..abcbc70520 100644 > --- a/gnu/services/configuration.scm > +++ b/gnu/services/configuration.scm > @@ -239,32 +239,34 @@ does not have a default value" field kind))) > (define (generate configuration-name) > (match (assq-ref documentation configuration-name) > ((fields . sub-documentation) > - `((para "Available " (code ,(str configuration-name)) " fields ar= e:") > - ,@(map > - (lambda (f) > - (let ((field-name (configuration-field-name f)) > - (field-type (configuration-field-type f)) > - (field-docs (cdr (texi-fragment->stexi > - (configuration-field-documentation= f)))) > - (default (catch #t > - (configuration-field-default-value-thunk = f) > - (lambda _ '%invalid)))) > - (define (show-default? val) > - (or (string? val) (number? val) (boolean? val) > - (and (symbol? val) (not (eq? val '%invalid))) > - (and (list? val) (and-map show-default? val)))) > - `(deftypevr (% (category > - (code ,(str configuration-name)) " param= eter") > - (data-type ,(str field-type)) > - (name ,(str field-name))) > - ,@field-docs > - ,@(if (show-default? default) > - `((para "Defaults to " (samp ,(str default)) ".= ")) > - '()) > - ,@(append-map > - generate > - (or (assq-ref sub-documentation field-name) '())))= )) > - fields))))) > + `((deftp (% (category "Data Type") (name ,(str configuration-name= ))) > + (para "Available " (code ,(str configuration-name)) " fields = are:") > + (table (% (formatter (asis))) > + ,@(map > + (lambda (f) > + (let ((field-name (configuration-field-name f)) > + (field-type (configuration-field-type f)) > + (field-docs (cdr (texi-fragment->stexi > + (configuration-field-docu= mentation f)))) > + (default (catch #t > + (configuration-field-default-val= ue-thunk f) > + (lambda _ '%invalid)))) > + (define (show-default? val) > + (or (string? val) (number? val) (boolean? val) > + (and (symbol? val) (not (eq? val '%invali= d))) > + (and (list? val) (and-map show-default? v= al)))) > + `(entry (% (heading (code ,(str field-name)) > + ,@(if (show-default? defaul= t) > + `(" (default: " (code= ,(str default)) ")") > + '()) > + " (type: " > + ,(str field-type) > + ")")) > + (para ,@field-docs) > + ,@(append-map > + generate > + (or (assq-ref sub-documentation fiel= d-name) '()))))) > + fields))))))) > (stexi->texi `(*fragment* . ,(generate documentation-name)))) >=20=20 > (define (configuration->documentation configuration-symbol) I've used this opportunity to re-indent the code a bit, so that it'd fit under 80 characters column width. Thanks for this neat improvement! Maxim From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 02 14:21:16 2021 Received: (at 48934-done) by debbugs.gnu.org; 2 Aug 2021 18:21:16 +0000 Received: from localhost ([127.0.0.1]:39261 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mAcYt-0000OF-Om for submit@debbugs.gnu.org; Mon, 02 Aug 2021 14:21:16 -0400 Received: from mail-qv1-f50.google.com ([209.85.219.50]:39730) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mAcYs-0000O2-Dw for 48934-done@debbugs.gnu.org; Mon, 02 Aug 2021 14:21:14 -0400 Received: by mail-qv1-f50.google.com with SMTP id d3so9308049qvq.6 for <48934-done@debbugs.gnu.org>; Mon, 02 Aug 2021 11:21:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=zttM+573gmGyXOR+RUh7J4jouSqeCGTDKZVa597vpQA=; b=hYE0Jfg3U8ON5uM/HxMbLV/EBxbfMQDG63OWbnATRBrGAhpL14xQUeYsYPj79JIPtt ot+4mAgWwOZU1ATPvTRP/DapHYnxt759vAhMJWXJjUmH77aGduy3/mRFs9avViHPuv63 dMVgQIb3UOAaU0bRDz37UK6qbzjS0CQh2wDSM6bCh39oybMIeffYxSHTXTm5K5A4Kg/0 TFvPG/h3mELodSJlmmzmJPECRGMMwGlRQSL5sbEDPG5xnVi5bRYNpXDhMMQcbe4B5oJO QK+kAO+5ukFuNtyMCzit+HX+93Abpyr4PbSjHObKtdaD9KUCxV+EvxuYW/JYxMbyuY6A d5zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=zttM+573gmGyXOR+RUh7J4jouSqeCGTDKZVa597vpQA=; b=OMqXVcM155gh3/Wm1VGfK+8ze1M62SNe8yIlFL+ofaG/sIf2WObN9Ye4gvafd9Cq0f GKljoGVKH5AUPfKianm8m6ndGCLRk5vtGvvIt7NSiK2V6p1lt71FkU37hhyb8nA/poWU 5gt31lneq0r5BBOEO3iLrj4+mKhC/dQ7/fN/JSpuKPHfhLEAN7kum/txufsfaRnpkX5b cExWVj8R8Uf0uZjR6gleQThAWXrqVTOR4su+YMKO3F2HPP5KPzbtJvAsHngp69949/k9 cYd1z/O6muT2lT5IViqHATgCW8ZMwD12iuE+mpdYyXWBCdFyG1K3AxQYORWlGmPQERzD TiJQ== X-Gm-Message-State: AOAM531q0qmegJe1Efzt02SA1eODdlPYPDLDJy4Ucf7UOuB2cZC84n9x 6opfdc6wTcohZA+IqRXcIwzCnC7er23znw== X-Google-Smtp-Source: ABdhPJwBgMdubbtofwwkjwIGFK0am3LtvtbJ7nemhvspc4fzXZmPiAXYJ/rTkVflgvcqLoZ9/neylQ== X-Received: by 2002:ad4:4e0e:: with SMTP id dl14mr17633616qvb.37.1627928468893; Mon, 02 Aug 2021 11:21:08 -0700 (PDT) Received: from hurd ([207.35.94.204]) by smtp.gmail.com with ESMTPSA id b21sm4899055qtb.58.2021.08.02.11.21.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Aug 2021 11:21:08 -0700 (PDT) From: Maxim Cournoyer To: Xinglu Chen Subject: Re: bug#48934: [PATCH 0/2] Some improvements to (gnu services configuration) References: <9de0174c0818edd7c3f1f58a264a6ea3c5c3be50.1623243063.git.public@yoctocell.xyz> Date: Mon, 02 Aug 2021 14:21:07 -0400 In-Reply-To: <9de0174c0818edd7c3f1f58a264a6ea3c5c3be50.1623243063.git.public@yoctocell.xyz> (Xinglu Chen's message of "Wed, 09 Jun 2021 15:06:27 +0200") Message-ID: <87eebb908c.fsf_-_@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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: Hello again, Xinglu Chen writes: > * gnu/services/configuration.scm (generate-documentation): If the default > value of a field is a package, show the value of the ‘name’ field of the > package. This might not be the correct name [...] 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 (maxim.cournoyer[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_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.219.50 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.219.50 listed in wl.mailspike.net] X-Debbugs-Envelope-To: 48934-done Cc: 48934-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) Hello again, Xinglu Chen writes: > * gnu/services/configuration.scm (generate-documentation): If the default > value of a field is a package, show the value of the =E2=80=98name=E2= =80=99 field of the > package. This might not be the correct name in some cases though. Here also, I've edited the commit message like so: services: configuration: Derive the default value from the package variab= le. If the type of a configuration field is a package, show the name of its package *variable* as the default value. * gnu/services/configuration.scm (generate-documentation){show-default} {package->symbol}: New nested procedures. Use them to format the field entries. > --- > gnu/services/configuration.scm | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) > > diff --git a/gnu/services/configuration.scm b/gnu/services/configuration.= scm > index abcbc70520..99687d065a 100644 > --- a/gnu/services/configuration.scm > +++ b/gnu/services/configuration.scm > @@ -252,12 +252,20 @@ does not have a default value" field kind))) > (configuration-field-default-val= ue-thunk f) > (lambda _ '%invalid)))) > (define (show-default? val) > - (or (string? val) (number? val) (boolean? val) > + (or (string? val) (number? val) (boolean? val= ) (package? val) > (and (symbol? val) (not (eq? val '%invali= d))) > (and (list? val) (and-map show-default? v= al)))) > + > + (define (show-default val) > + (cond > + ((package? val) > + ;; Maybe not always correct. > + (package-name val)) > + (else (str val)))) > + > `(entry (% (heading (code ,(str field-name)) > ,@(if (show-default? defaul= t) > - `(" (default: " (code= ,(str default)) ")") > + `(" (default: " (code= ,(show-default default)) ")") > '()) > " (type: " > ,(str field-type) I've found a (rather hacky?) way to derive a package's symbol name instead of using its name, which eliminates the risk of a mismatch, using such procedure: --8<---------------cut here---------------start------------->8--- @@ -252,6 +254,21 @@ does not have a default value" field kind))) ;; A little helper to make it easier to document all those fields. (define (generate-documentation documentation documentation-name) (define (str x) (object->string x)) + + (define (package->symbol package) + "Return the first symbol name of a package that matches PACKAGE, else = #f." + (let* ((module (file-name->module-name + (location-file (package-location package)))) + (symbols (filter-map + identity + (module-map (lambda (symbol var) + (and (equal? package (variable-ref var)) + symbol)) + (resolve-module module))))) + (if (null? symbols) + #f + (first symbols)))) + (define (generate configuration-name) (match (assq-ref documentation configuration-name) ((fields . sub-documentation) @@ -270,14 +287,21 @@ does not have a default value" field kind))) (lambda _ '%invalid)))) (define (show-default? val) (or (string? val) (number? val) (boolean? val) + (package? val) (and (symbol? val) (not (eq? val '%invalid))) (and (list? val) (and-map show-default? val)))) =20 + (define (show-default val) + (cond + ((package? val) + (symbol->string (package->symbol val))) + (else (str val)))) + `(entry (% (heading (code ,(str field-name)) ,@(if (show-default? default) `(" (default: " --8<---------------cut here---------------end--------------->8--- Tested it to generate the new Jami service documentation, and pushed as commit 8e1f94421873777c6bb0b83daa4f81cbacc8b3ff. I think (guix services configuration) is starting to look good! Thanks to your efforts toward improving the module. Closing. Maxim From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 03 03:25:17 2021 Received: (at 48934-done) by debbugs.gnu.org; 3 Aug 2021 07:25:17 +0000 Received: from localhost ([127.0.0.1]:39761 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mAond-0006op-1e for submit@debbugs.gnu.org; Tue, 03 Aug 2021 03:25:17 -0400 Received: from h87-96-130-155.cust.a3fiber.se ([87.96.130.155]:42058 helo=mail.yoctocell.xyz) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mAona-0006oR-I6 for 48934-done@debbugs.gnu.org; Tue, 03 Aug 2021 03:25:15 -0400 From: Xinglu Chen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yoctocell.xyz; s=mail; t=1627975504; bh=RIvz+KxRbzakHDSngKJ/yugtZ23qPmVrerux05pCj38=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=GURqGGKsOUzxih6dx7xdGWrzl8U8PFVLLUpih+rsNlef7YWRju+/sbvcHph1aQFyg 0r/pog6l0HoQGG1iUWc2lQr31ovRWypJwIztgNL5t/L2rRjP6wASbfIopMps6c381G grx8AjO2OjGC1rQmDoK0cXH4755N5DxL3+ja17q8= To: Maxim Cournoyer Subject: Re: bug#48934: [PATCH 0/2] Some improvements to (gnu services configuration) In-Reply-To: <87eebb908c.fsf_-_@gmail.com> References: <9de0174c0818edd7c3f1f58a264a6ea3c5c3be50.1623243063.git.public@yoctocell.xyz> <87eebb908c.fsf_-_@gmail.com> Date: Tue, 03 Aug 2021 09:24:46 +0200 Message-ID: <87fsvruh1d.fsf@yoctocell.xyz> 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 Mon, Aug 02 2021, Maxim Cournoyer wrote: > Hello again, > > Xinglu Chen writes: > >> * gnu/services/configuration.scm (generate-documentation): If the default >> value of a field is a package, show the value of the ‘ [...] 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: 48934-done Cc: 48934-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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 Mon, Aug 02 2021, Maxim Cournoyer wrote: > Hello again, > > Xinglu Chen writes: > >> * gnu/services/configuration.scm (generate-documentation): If the default >> value of a field is a package, show the value of the ‘ [...] 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 Mon, Aug 02 2021, Maxim Cournoyer wrote: > Hello again, > > Xinglu Chen writes: > >> * gnu/services/configuration.scm (generate-documentation): If the default >> value of a field is a package, show the value of the =E2=80=98name=E2= =80=99 field of the >> package. This might not be the correct name in some cases though. > > Here also, I've edited the commit message like so: > > services: configuration: Derive the default value from the package vari= able. > > If the type of a configuration field is a package, show the name of its > package *variable* as the default value. > > * gnu/services/configuration.scm (generate-documentation){show-default} > {package->symbol}: New nested procedures. Use them to format the field > entries. Thanks, I should probably re-read the manual. :) >> --- >> gnu/services/configuration.scm | 12 ++++++++++-- >> 1 file changed, 10 insertions(+), 2 deletions(-) >> >> diff --git a/gnu/services/configuration.scm b/gnu/services/configuration= .scm >> index abcbc70520..99687d065a 100644 >> --- a/gnu/services/configuration.scm >> +++ b/gnu/services/configuration.scm >> @@ -252,12 +252,20 @@ does not have a default value" field kind))) >> (configuration-field-default-va= lue-thunk f) >> (lambda _ '%invalid)))) >> (define (show-default? val) >> - (or (string? val) (number? val) (boolean? va= l) >> + (or (string? val) (number? val) (boolean? va= l) (package? val) >> (and (symbol? val) (not (eq? val '%inval= id))) >> (and (list? val) (and-map show-default? = val)))) >> + >> + (define (show-default val) >> + (cond >> + ((package? val) >> + ;; Maybe not always correct. >> + (package-name val)) >> + (else (str val)))) >> + >> `(entry (% (heading (code ,(str field-name)) >> ,@(if (show-default? defau= lt) >> - `(" (default: " (cod= e ,(str default)) ")") >> + `(" (default: " (cod= e ,(show-default default)) ")") >> '()) >> " (type: " >> ,(str field-type) > > I've found a (rather hacky?) way to derive a package's symbol name > instead of using its name, which eliminates the risk of a mismatch, > using such procedure: > > --8<---------------cut here---------------start------------->8--- > @@ -252,6 +254,21 @@ does not have a default value" field kind))) > ;; A little helper to make it easier to document all those fields. > (define (generate-documentation documentation documentation-name) > (define (str x) (object->string x)) > + > + (define (package->symbol package) > + "Return the first symbol name of a package that matches PACKAGE, els= e #f." > + (let* ((module (file-name->module-name > + (location-file (package-location package)))) > + (symbols (filter-map > + identity > + (module-map (lambda (symbol var) > + (and (equal? package (variable-ref va= r)) > + symbol)) > + (resolve-module module))))) > + (if (null? symbols) > + #f > + (first symbols)))) > + > (define (generate configuration-name) > (match (assq-ref documentation configuration-name) > ((fields . sub-documentation) > @@ -270,14 +287,21 @@ does not have a default value" field kind))) > (lambda _ '%invalid)))) > (define (show-default? val) > (or (string? val) (number? val) (boolean? val) > + (package? val) > (and (symbol? val) (not (eq? val '%invalid))) > (and (list? val) (and-map show-default? val)))) >=20=20 > + (define (show-default val) > + (cond > + ((package? val) > + (symbol->string (package->symbol val))) > + (else (str val)))) > + > `(entry (% (heading > (code ,(str field-name)) > ,@(if (show-default? default) > `(" (default: " > --8<---------------cut here---------------end--------------->8--- Cool, that looks like a better way than just getting the package name. > Tested it to generate the new Jami service documentation, and pushed as > commit 8e1f94421873777c6bb0b83daa4f81cbacc8b3ff. > > I think (guix services configuration) is starting to look good! Thanks > to your efforts toward improving the module. You are welcome, happy to help out. The next step would probably be to automatically generate the docs when invoking =E2=80=98make docs=E2=80=99. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJJBAEBCAAzFiEEAVhh4yyK5+SEykIzrPUJmaL7XHkFAmEI7z4VHHB1YmxpY0B5 b2N0b2NlbGwueHl6AAoJEKz1CZmi+1x5Vl0QAIf62F0s4sL92RGe1ffakRjO7PLd dOKiCgSh2gMeyIm3rYBsHLZ5s2KKyuyB9kCavXSUoCjvdGCdZolD+dHfJeE85Pzi srL8HmtZ7Fd5sE0YQcQFF1hcV7y4tvRmAqIHc30wn8QcU51haVgdie0E2suKECZp /vz5GIyMQFWdRTA4TMfYZ9qOWAfLMpsJfWDLXhQtO7ZBgxwxRFx1vm6TeOH5YYYj Vx1leFp+WeO4JGUVI0soTa4VXB/GC+QLSXHmmFihPvaU8VBvWENW+A9lVrc+eeUb 9TfWE6NHUyDc0uwB5zajZPreLhEZy7jaFRjuq0N9V0O03HuFlbiZCF0L5IelUG6/ 26COz08wUBCihO/8rWawWXl1aPo6BFd8jmuMhLRimGMxzH0/xCDNtcJPSxjGuUW+ LKSp9y3cDbeESeMocW3vwnP3KOuRjx04mXcA+kwHB/FvifIMJAQNRMRa1lq0gjov iweKsSD9xzCObKJ2wAMbBsORZ+TyumHmDHdhTTWQCaqpTkqIiGYpfKDvvrJKrwlG oTVM0KnHZ8fGgBakTfeAUF+3F19s3KGQCCSGaV5x9W+wArxrei6HxHMCOjINmn/R C/yTXdEpMlwC8Np+oRwW6Yb//XQdYgltSKkYEytaj1yhfXy4eHOWjO1jvUM8f10n bkvcReGLpHH5aSGN =iO7/ -----END PGP SIGNATURE----- --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 03 10:38:43 2021 Received: (at 48934-done) by debbugs.gnu.org; 3 Aug 2021 14:38:43 +0000 Received: from localhost ([127.0.0.1]:41178 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mAvZ5-0005Ci-2e for submit@debbugs.gnu.org; Tue, 03 Aug 2021 10:38:43 -0400 Received: from mail-qt1-f175.google.com ([209.85.160.175]:35813) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mAvZ2-0005CV-W0 for 48934-done@debbugs.gnu.org; Tue, 03 Aug 2021 10:38:41 -0400 Received: by mail-qt1-f175.google.com with SMTP id a12so14069911qtb.2 for <48934-done@debbugs.gnu.org>; Tue, 03 Aug 2021 07:38:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=PNre1LeKkgnj26QC/iOcOacFtSW92QxFvWFtaS1Wf+s=; b=fsBy+u6AQIkg0xUgDM0pNQ+dk0MnVwazt2az8+lIPNvS8/pxSm98N3559z5lav0Dny 0jXeaQpy4B5QHtLhaFcuG/ovkzD6Sc9jRyh3vZncC5QrB6CJgO4gf0q5CpFiKN5DAHiD 4UDETl3T0fwsQYcvrzPfGJKw2zUIEDCFiy+hYiP6KNp7sWq6OCHYZGnprbHo443sr+yq mO1XlxhGU/NaMqMHCsU9Xi9YdvMzUQJnpPecp8MNMx/cb+Yq1GJclnIpBJ8iYJflK2Tz rGo4A7Jv21Vdjm28r1HRvUYYwIvndT1Rp4I0SAVDwQDaMqEjR6plS6Eg169IBzc71UrX pdAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=PNre1LeKkgnj26QC/iOcOacFtSW92QxFvWFtaS1Wf+s=; b=WLHjLaBGePczgO6e7jzS7lbBAH11l2kIwN1EKTfs2C8Cu7G0ckqnIwJeiPlJdGmUdi 5mq4KmVAS6iO7PK7EaORTR13sAsguhGLZStrPoeLv0eRmZPqbCg81uKDBxffvzZqEdKi COwA4oIa1tu32+8ZgHTf+yBVYrMh4WVTzmMrcOarXxk1TRXpnlIUZduCrYxJSCZJa7H3 oM9hWxpb+fnZB72K3yCvxUiuTw4TizBbTjPKyIPv4Hlve8Uo48WyBoQVXTWkmSCq4gNU DsIc0dyR3bcwynRemeEafC+wO7sSTxwesEQMRNr83rJ3zFuMQdJcrY2yrH+tE4U3fupX JoQA== X-Gm-Message-State: AOAM533fNQWp31JGG1Wv5b0mcgK/xEoJdpAN8F4xswe+nPLckgHkN/l6 LC54hLGPZygw3QXbFiS7LIDQ5zOVJ/hlRxQS X-Google-Smtp-Source: ABdhPJzkrJ/EB1Ct4gh33jM0FDwKAZ4S+wt/vNnfk8oYgTAaKrkT2U1hIAYBbUKArNmIkZNCHgc+8w== X-Received: by 2002:ac8:5991:: with SMTP id e17mr18436920qte.6.1628001515350; Tue, 03 Aug 2021 07:38:35 -0700 (PDT) Received: from hurd (dsl-10-129-132.b2b2c.ca. [72.10.129.132]) by smtp.gmail.com with ESMTPSA id t14sm7484244qkm.7.2021.08.03.07.38.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Aug 2021 07:38:34 -0700 (PDT) From: Maxim Cournoyer To: Xinglu Chen Subject: Re: bug#48934: [PATCH 0/2] Some improvements to (gnu services configuration) References: <9de0174c0818edd7c3f1f58a264a6ea3c5c3be50.1623243063.git.public@yoctocell.xyz> <87eebb908c.fsf_-_@gmail.com> <87fsvruh1d.fsf@yoctocell.xyz> Date: Tue, 03 Aug 2021 10:38:34 -0400 In-Reply-To: <87fsvruh1d.fsf@yoctocell.xyz> (Xinglu Chen's message of "Tue, 03 Aug 2021 09:24:46 +0200") Message-ID: <87a6ly7fv9.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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 writes: [...] 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 (maxim.cournoyer[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_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.160.175 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.160.175 listed in wl.mailspike.net] X-Debbugs-Envelope-To: 48934-done Cc: 48934-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) Hi, Xinglu Chen writes: [...] >> I think (guix services configuration) is starting to look good! Thanks >> to your efforts toward improving the module. > > You are welcome, happy to help out. The next step would probably be to > automatically generate the docs when invoking =E2=80=98make docs=E2=80=99. Agreed! I've left a TODO in the recent Jami service addition to guix.texi that suggests to do this. It'd be useful! Maxim From unknown Sat Sep 20 23:53:13 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 01 Sep 2021 11:24:06 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator