From patchwork Fri Sep 27 18:39:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Herman Rimm X-Patchwork-Id: 68478 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 70FA827BBE9; Fri, 27 Sep 2024 19:42:05 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_VALIDITY_CERTIFIED, RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 5DAB927BBE2 for ; Fri, 27 Sep 2024 19:42:03 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1suFtW-0008UE-PO; Fri, 27 Sep 2024 14:40:47 -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 1suFtM-0007ti-LB for guix-patches@gnu.org; Fri, 27 Sep 2024 14:40:37 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1suFtK-0002L2-Ra; Fri, 27 Sep 2024 14:40:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:Subject; bh=XcIV87Tnv3ZfrjE4/gWcVPj6Kdi/JZHxX8JT3oV3bC0=; b=dFKz+EsBNX6BIQmY0wf1tvxetmSi2six0crvBmtd8CyclsYGFOf+d6w+3ys//SdmGnkF4AkzZINKaK25cHqYmMO0RWuv/cNxO8RVC1DG+7zBU49G/trMC3rjhelPcGd2pWeMc5gIhZ4LyB9BRgDOfAroNDc56BoiwiZmb81SkX+ePN653PNSNP2LT0ksTtKE5OKa+g1KsU13I3s3Djoz/2ssolZReo+7j4BERK+x+ALPxyUjMBhCCkJ54k+eFOAagvaz6KN+DMTbFD5KFJGFKUtCTDBlX729cNOmk0rJIPd5vyyO+wI2VgcRY04x3+hd9E3jwlVOY1cSIjaknlqa7Q==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1suFtm-0007uU-Rp; Fri, 27 Sep 2024 14:41:02 -0400 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=A8?= =?utf-8?q?s?= , 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) 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 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Herman Rimm X-ACL-Warn: , Herman Rimm via Guix-patches X-Patchwork-Original-From: Herman Rimm via Guix-patches via From: Herman Rimm Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * 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(-) base-commit: 9a141b5bd633227ea31776b9ce7ca40928de2442 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))))