From unknown Sun Jun 22 07:48:15 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#73518] [PATCH] services: configuration: Document multiple configurations per field. Resent-From: Herman Rimm Original-Sender: "Debbugs-submit" Resent-CC: pelzflorian@pelzflorian.de, ludo@gnu.org, maxim.cournoyer@gmail.com, guix-patches@gnu.org Resent-Date: Fri, 27 Sep 2024 18:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 73518 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 73518@debbugs.gnu.org Cc: Florian Pelz , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Maxim Cournoyer X-Debbugs-Original-To: guix-patches@gnu.org X-Debbugs-Original-Xcc: Florian Pelz , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Maxim Cournoyer Received: via spool by submit@debbugs.gnu.org id=B.172746244530341 (code B ref -1); Fri, 27 Sep 2024 18:41:02 +0000 Received: (at submit) by debbugs.gnu.org; 27 Sep 2024 18:40:45 +0000 Received: from localhost ([127.0.0.1]:47406 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1suFtU-0007tH-Po for submit@debbugs.gnu.org; Fri, 27 Sep 2024 14:40:45 -0400 Received: from lists.gnu.org ([209.51.188.17]:43334) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1suFtR-0007t7-Us for submit@debbugs.gnu.org; Fri, 27 Sep 2024 14:40:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1suFsy-0007Ku-QA for guix-patches@gnu.org; Fri, 27 Sep 2024 14:40:12 -0400 Received: from 81-205-150-117.fixed.kpn.net ([81.205.150.117] helo=email.rimm.ee) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from ) id 1suFst-00025h-DY for guix-patches@gnu.org; Fri, 27 Sep 2024 14:40:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rimm.ee; s=herman; t=1727462398; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XcIV87Tnv3ZfrjE4/gWcVPj6Kdi/JZHxX8JT3oV3bC0=; b=f4NxXfxplbsDJ45p2hljqhy/3QDDUM0VgzBshf1VI9bTDHttbQ25WBq9S1fbsv3J++s0i1 XdRQQnA+e2Vod/F66RFARhw/Z/b0fSTmzs7uIMIQlzY+ZkYkRB+DY75Do8cY3KFEefdpzo MB/YGsUC/QOygy2BVS8hHjtpET8vy0Sk78dJ1mLEaKeQD2OXB0rO/PYS5wzUQtrHx38kfs 9p5bjEpDOtzF12zHk4Ym2ppDnho5kGvwhEm33aL89NHPw9PV0DmhVFjSssp9EGwy8oBws7 YsA76/sAoBrh8GojNHYzRfCOu+kmafF/J5hJ3O5mcZXitO3gt+DT8RVE6NBuTg== Received: by 81-205-150-117.fixed.kpn.net (OpenSMTPD) with ESMTPSA id 07ce17a4 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO) for ; Fri, 27 Sep 2024 18:39:58 +0000 (UTC) From: Herman Rimm Date: Fri, 27 Sep 2024 20:39:19 +0200 Message-ID: <66078ca304218cd3cb1f5cf9cd27861e54a404ee.1727462231.git.herman@rimm.ee> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=81.205.150.117; envelope-from=herman@rimm.ee; helo=email.rimm.ee X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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, RCVD_IN_PBL=3.335, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, TVD_RCVD_IP=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) 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.4 (--) * gnu/serives/configuration.scm (generate-documentation): Filter for all configurations associated with each field-name. * doc/guix.texi (Complex Configurations): Describe use case for multiple field-names. Change-Id: I6d1e7b8858231aa05fda884b31a9bd0a48f07293 --- doc/guix.texi | 4 +++- gnu/services/configuration.scm | 9 +++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 52e36e4354..877221239b 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -44685,7 +44685,9 @@ Complex Configurations @var{sub-documentation} is a @code{(@var{field-name} @var{configuration-name})} tuple. @var{field-name} is the name of the field which takes another configuration record as its value, and -@var{configuration-name} is the name of that configuration record. +@var{configuration-name} is the name of that configuration record. The +same value may be used for multiple @var{field-name}s, in case a field +accepts different types of configurations. @var{sub-documentation} is only needed if there are nested configuration records. For example, the @code{getmail-configuration} record diff --git a/gnu/services/configuration.scm b/gnu/services/configuration.scm index d2b1687496..e76ad5e8cb 100644 --- a/gnu/services/configuration.scm +++ b/gnu/services/configuration.scm @@ -7,6 +7,7 @@ ;;; Copyright © 2021 Andrew Tropin ;;; Copyright © 2022 Maxime Devos ;;; Copyright © 2023 Bruno Victal +;;; Copyright © 2024 Herman Rimm ;;; ;;; This file is part of GNU Guix. ;;; @@ -460,8 +461,12 @@ (define (generate-documentation documentation documentation-name) (para ,@field-docs) ,@(append-map generate - (or (assq-ref sub-documentation field-name) - '()))))) + (filter-map + (match-lambda + ((name config) + (and (eq? name field-name) + config))) + sub-documentation))))) fields))))))) (stexi->texi `(*fragment* . ,(generate documentation-name)))) base-commit: 9a141b5bd633227ea31776b9ce7ca40928de2442 -- 2.45.2 From unknown Sun Jun 22 07:48:15 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Herman Rimm Subject: bug#73518: closed (Re: [bug#73518] [PATCH] services: configuration: Document multiple configurations per field.) Message-ID: References: <87ed4j3prw.fsf@gnu.org> <66078ca304218cd3cb1f5cf9cd27861e54a404ee.1727462231.git.herman@rimm.ee> X-Gnu-PR-Message: they-closed 73518 X-Gnu-PR-Package: guix-patches X-Gnu-PR-Keywords: patch Reply-To: 73518@debbugs.gnu.org Date: Mon, 14 Oct 2024 11:10:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1728904202-7787-1" This is a multi-part message in MIME format... ------------=_1728904202-7787-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #73518: [PATCH] services: configuration: Document multiple configurations p= er field. which was filed against the guix-patches package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 73518@debbugs.gnu.org. --=20 73518: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D73518 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1728904202-7787-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 73518-done) by debbugs.gnu.org; 14 Oct 2024 11:09:23 +0000 Received: from localhost ([127.0.0.1]:35539 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t0Ix1-00020R-2O for submit@debbugs.gnu.org; Mon, 14 Oct 2024 07:09:23 -0400 Received: from eggs.gnu.org ([209.51.188.92]:47200) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t0Iwz-000209-1v for 73518-done@debbugs.gnu.org; Mon, 14 Oct 2024 07:09:21 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t0Iwa-0000Oy-Ph; Mon, 14 Oct 2024 07:08:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=v2Ph80cln+K8tWj3FxigUTmVeuF+xlRXbjHvOwUfc+A=; b=QnNgR4PsaPycDIjqWVMx TGJ//DavUIcyGTqgiMW9f+Uh/si02gf8w8thPBFoQu36ILBONOYPZoueQEIOdipZA6J/Auve/OeK7 sAiK13wukLrjniPH+IFyOUnX23pofon2OjMFT+FtzLDi6IyU1sR5GmFcYYlUIvTFc786ecWrV+zQ1 /gZxu98Br5VGIWCG+rzBUQve8aMplRfNs8OTLrcxpFkKo2o+6ksxyLo59VN5vBJ5Mnq/zTv6+1P2g ZTg3NL+SAaoqefxnEGehcEjwB5xZ/CdrqxyxNMWv+EIS9u/t8n44bVpZEi9vyJtIE60PAJF3rVDZv 7kDqpxYf6jskag==; From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Herman Rimm Subject: Re: [bug#73518] [PATCH] services: configuration: Document multiple configurations per field. In-Reply-To: <66078ca304218cd3cb1f5cf9cd27861e54a404ee.1727462231.git.herman@rimm.ee> (Herman Rimm's message of "Fri, 27 Sep 2024 20:39:19 +0200") References: <66078ca304218cd3cb1f5cf9cd27861e54a404ee.1727462231.git.herman@rimm.ee> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: Tridi 23 =?utf-8?Q?Vend=C3=A9miaire?= an 233 de la =?utf-8?Q?R=C3=A9volution=2C?= jour du Navet X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Mon, 14 Oct 2024 13:08:51 +0200 Message-ID: <87ed4j3prw.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 73518-done Cc: 73518-done@debbugs.gnu.org, Maxim Cournoyer , Florian Pelz 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: -3.3 (---) Herman Rimm skribis: > * gnu/serives/configuration.scm (generate-documentation): Filter for all > configurations associated with each field-name. > * doc/guix.texi (Complex Configurations): Describe use case for multiple > field-names. > > Change-Id: I6d1e7b8858231aa05fda884b31a9bd0a48f07293 Applied, thanks! ------------=_1728904202-7787-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 27 Sep 2024 18:40:45 +0000 Received: from localhost ([127.0.0.1]:47406 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1suFtU-0007tH-Po for submit@debbugs.gnu.org; Fri, 27 Sep 2024 14:40:45 -0400 Received: from lists.gnu.org ([209.51.188.17]:43334) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1suFtR-0007t7-Us for submit@debbugs.gnu.org; Fri, 27 Sep 2024 14:40:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1suFsy-0007Ku-QA for guix-patches@gnu.org; Fri, 27 Sep 2024 14:40:12 -0400 Received: from 81-205-150-117.fixed.kpn.net ([81.205.150.117] helo=email.rimm.ee) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from ) id 1suFst-00025h-DY for guix-patches@gnu.org; Fri, 27 Sep 2024 14:40:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rimm.ee; s=herman; t=1727462398; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XcIV87Tnv3ZfrjE4/gWcVPj6Kdi/JZHxX8JT3oV3bC0=; b=f4NxXfxplbsDJ45p2hljqhy/3QDDUM0VgzBshf1VI9bTDHttbQ25WBq9S1fbsv3J++s0i1 XdRQQnA+e2Vod/F66RFARhw/Z/b0fSTmzs7uIMIQlzY+ZkYkRB+DY75Do8cY3KFEefdpzo MB/YGsUC/QOygy2BVS8hHjtpET8vy0Sk78dJ1mLEaKeQD2OXB0rO/PYS5wzUQtrHx38kfs 9p5bjEpDOtzF12zHk4Ym2ppDnho5kGvwhEm33aL89NHPw9PV0DmhVFjSssp9EGwy8oBws7 YsA76/sAoBrh8GojNHYzRfCOu+kmafF/J5hJ3O5mcZXitO3gt+DT8RVE6NBuTg== Received: by 81-205-150-117.fixed.kpn.net (OpenSMTPD) with ESMTPSA id 07ce17a4 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO) for ; Fri, 27 Sep 2024 18:39:58 +0000 (UTC) From: Herman Rimm To: guix-patches@gnu.org Subject: [PATCH] services: configuration: Document multiple configurations per field. Date: Fri, 27 Sep 2024 20:39:19 +0200 Message-ID: <66078ca304218cd3cb1f5cf9cd27861e54a404ee.1727462231.git.herman@rimm.ee> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 X-Debbugs-Cc: Florian Pelz , Ludovic Courtès , Maxim Cournoyer Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=81.205.150.117; envelope-from=herman@rimm.ee; helo=email.rimm.ee X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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, RCVD_IN_PBL=3.335, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, TVD_RCVD_IP=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit 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.4 (--) * gnu/serives/configuration.scm (generate-documentation): Filter for all configurations associated with each field-name. * doc/guix.texi (Complex Configurations): Describe use case for multiple field-names. Change-Id: I6d1e7b8858231aa05fda884b31a9bd0a48f07293 --- doc/guix.texi | 4 +++- gnu/services/configuration.scm | 9 +++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 52e36e4354..877221239b 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -44685,7 +44685,9 @@ Complex Configurations @var{sub-documentation} is a @code{(@var{field-name} @var{configuration-name})} tuple. @var{field-name} is the name of the field which takes another configuration record as its value, and -@var{configuration-name} is the name of that configuration record. +@var{configuration-name} is the name of that configuration record. The +same value may be used for multiple @var{field-name}s, in case a field +accepts different types of configurations. @var{sub-documentation} is only needed if there are nested configuration records. For example, the @code{getmail-configuration} record diff --git a/gnu/services/configuration.scm b/gnu/services/configuration.scm index d2b1687496..e76ad5e8cb 100644 --- a/gnu/services/configuration.scm +++ b/gnu/services/configuration.scm @@ -7,6 +7,7 @@ ;;; Copyright © 2021 Andrew Tropin ;;; Copyright © 2022 Maxime Devos ;;; Copyright © 2023 Bruno Victal +;;; Copyright © 2024 Herman Rimm ;;; ;;; This file is part of GNU Guix. ;;; @@ -460,8 +461,12 @@ (define (generate-documentation documentation documentation-name) (para ,@field-docs) ,@(append-map generate - (or (assq-ref sub-documentation field-name) - '()))))) + (filter-map + (match-lambda + ((name config) + (and (eq? name field-name) + config))) + sub-documentation))))) fields))))))) (stexi->texi `(*fragment* . ,(generate documentation-name)))) base-commit: 9a141b5bd633227ea31776b9ce7ca40928de2442 -- 2.45.2 ------------=_1728904202-7787-1--