From patchwork Fri Jun 9 21:20:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruno Victal X-Patchwork-Id: 50807 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 BB65C27BBE2; Fri, 9 Jun 2023 22:22:45 +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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, SPF_HELO_PASS autolearn=ham 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 AD51327BBEA for ; Fri, 9 Jun 2023 22:22:44 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7jYa-00062D-DI; Fri, 09 Jun 2023 17:22:04 -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 1q7jYY-00061Q-1u for guix-patches@gnu.org; Fri, 09 Jun 2023 17:22:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q7jYX-0007PO-Oy for guix-patches@gnu.org; Fri, 09 Jun 2023 17:22:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q7jYX-0000Vb-KO for guix-patches@gnu.org; Fri, 09 Jun 2023 17:22:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#63985] [PATCH RFC 1/5] services: configuration: Simplify normalize-extra-args. Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 09 Jun 2023 21:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63985 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 63985@debbugs.gnu.org Cc: Bruno Victal Received: via spool by 63985-submit@debbugs.gnu.org id=B63985.16863456721860 (code B ref 63985); Fri, 09 Jun 2023 21:22:01 +0000 Received: (at 63985) by debbugs.gnu.org; 9 Jun 2023 21:21:12 +0000 Received: from localhost ([127.0.0.1]:32875 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q7jXk-0000Tw-Ht for submit@debbugs.gnu.org; Fri, 09 Jun 2023 17:21:12 -0400 Received: from smtpmciv1.myservices.hosting ([185.26.107.237]:59346) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q7jXi-0000To-UQ for 63985@debbugs.gnu.org; Fri, 09 Jun 2023 17:21:11 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpmciv1.myservices.hosting (Postfix) with ESMTP id 36F1020CD0 for <63985@debbugs.gnu.org>; Fri, 9 Jun 2023 23:21:09 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id 7E79F8009B; Fri, 9 Jun 2023 23:21:09 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id cshjM1svIMQ5; Fri, 9 Jun 2023 23:21:09 +0200 (CEST) Received: from guix-nuc.home.arpa (unknown [10.192.1.83]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id B6D6080098; Fri, 9 Jun 2023 23:21:08 +0200 (CEST) From: Bruno Victal Date: Fri, 9 Jun 2023 22:20:56 +0100 Message-Id: X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 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: , 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/services/configuration.scm (define-configuration-helper, normalize-extra-args): Use #f instead of %unset-value. --- gnu/services/configuration.scm | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) base-commit: c348b1be3891e6eb47bbdd9fc1587aba2b6ab0b7 diff --git a/gnu/services/configuration.scm b/gnu/services/configuration.scm index 367b85c1be..dafe72f4fe 100644 --- a/gnu/services/configuration.scm +++ b/gnu/services/configuration.scm @@ -190,32 +190,32 @@ (define (define-configuration-helper serialize? serializer-prefix syn) (define (normalize-extra-args s) "Extract and normalize arguments following @var{doc}." (let loop ((s s) - (sanitizer* %unset-value) - (serializer* %unset-value)) + (sanitizer* #f) + (serializer* #f)) (syntax-case s (sanitizer serializer empty-serializer) (((sanitizer proc) tail ...) - (if (maybe-value-set? sanitizer*) - (syntax-violation 'sanitizer "duplicate entry" - #'proc) + (if sanitizer* + (syntax-violation 'sanitizer + "duplicate entry" #'proc) (loop #'(tail ...) #'proc serializer*))) (((serializer proc) tail ...) - (if (maybe-value-set? serializer*) - (syntax-violation 'serializer "duplicate or conflicting entry" - #'proc) + (if serializer* + (syntax-violation 'serializer + "duplicate or conflicting entry" #'proc) (loop #'(tail ...) sanitizer* #'proc))) ((empty-serializer tail ...) - (if (maybe-value-set? serializer*) + (if serializer* (syntax-violation 'empty-serializer "duplicate or conflicting entry" #f) (loop #'(tail ...) sanitizer* #'empty-serializer))) (() ; stop condition (values (list sanitizer* serializer*))) ((proc) ; TODO: deprecated, to be removed. - (null? (filter-map maybe-value-set? (list sanitizer* serializer*))) + (every not (list sanitizer* serializer*)) (begin (warning #f (G_ "specifying serializers after documentation is \ deprecated, use (serializer ~a) instead~%") (syntax->datum #'proc)) - (values (list %unset-value #'proc))))))) + (values (list #f #'proc))))))) (syntax-case syn () ((_ stem (field field-type+def doc extra-args ...) ...) @@ -239,11 +239,11 @@ (define (define-configuration-helper serialize? serializer-prefix syn) default-value)) #'((field-type def) ...))) ((field-sanitizer ...) - (map maybe-value #'(sanitizer* ...))) + #'(sanitizer* ...)) ((field-serializer ...) (map (lambda (type proc) (and serialize? - (or (maybe-value proc) + (or proc (if serializer-prefix (id #'stem serializer-prefix #'serialize- type) (id #'stem #'serialize- type))))) From patchwork Fri Jun 9 21:20:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruno Victal X-Patchwork-Id: 50806 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 106D927BBEC; Fri, 9 Jun 2023 22:22:45 +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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, SPF_HELO_PASS autolearn=ham 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 6E33927BBE2 for ; Fri, 9 Jun 2023 22:22:44 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7jYa-00062C-E0; Fri, 09 Jun 2023 17:22:04 -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 1q7jYY-00061d-Ef for guix-patches@gnu.org; Fri, 09 Jun 2023 17:22:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q7jYY-0007PX-67 for guix-patches@gnu.org; Fri, 09 Jun 2023 17:22:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q7jYY-0000Vi-2h for guix-patches@gnu.org; Fri, 09 Jun 2023 17:22:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#63985] [PATCH RFC 2/5] services: configuration: Use transducers within serialize-configuration. Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 09 Jun 2023 21:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63985 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 63985@debbugs.gnu.org Cc: Bruno Victal Received: via spool by 63985-submit@debbugs.gnu.org id=B63985.16863456921895 (code B ref 63985); Fri, 09 Jun 2023 21:22:02 +0000 Received: (at 63985) by debbugs.gnu.org; 9 Jun 2023 21:21:32 +0000 Received: from localhost ([127.0.0.1]:32878 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q7jY3-0000UT-UB for submit@debbugs.gnu.org; Fri, 09 Jun 2023 17:21:32 -0400 Received: from smtpmciv2.myservices.hosting ([185.26.107.238]:34304) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q7jY1-0000UL-S9 for 63985@debbugs.gnu.org; Fri, 09 Jun 2023 17:21:30 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpmciv2.myservices.hosting (Postfix) with ESMTP id 307DB20E2B for <63985@debbugs.gnu.org>; Fri, 9 Jun 2023 23:21:23 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id 6EF218009B; Fri, 9 Jun 2023 23:21:17 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id UFaLkS3tMGwD; Fri, 9 Jun 2023 23:21:17 +0200 (CEST) Received: from guix-nuc.home.arpa (unknown [10.192.1.83]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id 00E9880098; Fri, 9 Jun 2023 23:21:16 +0200 (CEST) From: Bruno Victal Date: Fri, 9 Jun 2023 22:20:57 +0100 Message-Id: X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 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: , 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 Introduces 'base-transducer', a SRFI-171 based transducer that can be used as a starting point for writing custom configuration record serializing procedures. This also fixes the symbol maybe-value serialization test case. * gnu/services/configuration.scm (empty-serializer?): New predicate. (base-transducer): New procedure. (serialize-configuration): Adapt to use base-transducer. * tests/services/configuration.scm: Remove test-expect-fail. --- gnu/services/configuration.scm | 24 +++++++++++++++++++----- tests/services/configuration.scm | 4 ---- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/gnu/services/configuration.scm b/gnu/services/configuration.scm index dafe72f4fe..0818b48bb5 100644 --- a/gnu/services/configuration.scm +++ b/gnu/services/configuration.scm @@ -42,6 +42,7 @@ (define-module (gnu services configuration) #:use-module (srfi srfi-26) #:use-module (srfi srfi-34) #:use-module (srfi srfi-35) + #:use-module (srfi srfi-171) #:export (configuration-field configuration-field-name configuration-field-type @@ -59,6 +60,7 @@ (define-module (gnu services configuration) define-configuration/no-serialization no-serialization + base-transducer serialize-configuration define-maybe define-maybe/no-serialization @@ -125,13 +127,25 @@ (define-record-type* (default-value-thunk configuration-field-default-value-thunk) (documentation configuration-field-documentation)) +(define (empty-serializer? field) + (eq? empty-serializer + (configuration-field-serializer field))) + +(define (base-transducer config) + (compose (tremove empty-serializer?) + ;; Only serialize fields whose value isn't '%unset-marker%. + (tfilter (lambda (field) + (let ((field-value ((configuration-field-getter field) + config))) + (maybe-value-set? field-value)))) + (tmap (lambda (field) + ((configuration-field-serializer field) + (configuration-field-name field) + ((configuration-field-getter field) config)))))) + (define (serialize-configuration config fields) #~(string-append - #$@(map (lambda (field) - ((configuration-field-serializer field) - (configuration-field-name field) - ((configuration-field-getter field) config))) - fields))) + #$@(list-transduce (base-transducer config) rcons fields))) (define-syntax-rule (id ctx parts ...) "Assemble PARTS into a raw (unhygienic) identifier." diff --git a/tests/services/configuration.scm b/tests/services/configuration.scm index 8ad5907f37..1db83bb273 100644 --- a/tests/services/configuration.scm +++ b/tests/services/configuration.scm @@ -337,10 +337,6 @@ (define-maybe symbol) (define-configuration config-with-maybe-symbol (protocol maybe-symbol "")) -;;; Maybe symbol values are currently seen as serializable, because the -;;; unspecified value is '%unset-marker%, which is a symbol itself. -;;; TODO: Remove expected fail marker after resolution. -(test-expect-fail 1) (test-equal "symbol maybe value serialization, unspecified" "" (gexp->approximate-sexp From patchwork Fri Jun 9 21:20:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruno Victal X-Patchwork-Id: 50804 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 5CFAA27BBE9; Fri, 9 Jun 2023 22:22:32 +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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, SPF_HELO_PASS 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 5153E27BBE2 for ; Fri, 9 Jun 2023 22:22:31 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7jYc-00062l-Sm; Fri, 09 Jun 2023 17:22:06 -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 1q7jYY-00061t-W9 for guix-patches@gnu.org; Fri, 09 Jun 2023 17:22:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q7jYY-0007Pi-My for guix-patches@gnu.org; Fri, 09 Jun 2023 17:22:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q7jYY-0000Vq-Ir for guix-patches@gnu.org; Fri, 09 Jun 2023 17:22:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#63985] [PATCH RFC 3/5] services: fstrim-service-type: Serialize with SRFI-171 transducers. Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 09 Jun 2023 21:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63985 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 63985@debbugs.gnu.org Cc: Bruno Victal Received: via spool by 63985-submit@debbugs.gnu.org id=B63985.16863456941909 (code B ref 63985); Fri, 09 Jun 2023 21:22:02 +0000 Received: (at 63985) by debbugs.gnu.org; 9 Jun 2023 21:21:34 +0000 Received: from localhost ([127.0.0.1]:32881 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q7jY6-0000Uj-BN for submit@debbugs.gnu.org; Fri, 09 Jun 2023 17:21:34 -0400 Received: from smtpmciv3.myservices.hosting ([185.26.107.239]:44790) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q7jY4-0000UV-Kr for 63985@debbugs.gnu.org; Fri, 09 Jun 2023 17:21:32 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpmciv3.myservices.hosting (Postfix) with ESMTP id 1260B208D0 for <63985@debbugs.gnu.org>; Fri, 9 Jun 2023 23:21:31 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id 6852D8009C; Fri, 9 Jun 2023 23:21:23 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id o20jgf_5watt; Fri, 9 Jun 2023 23:21:23 +0200 (CEST) Received: from guix-nuc.home.arpa (unknown [10.192.1.83]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id F08C080098; Fri, 9 Jun 2023 23:21:22 +0200 (CEST) From: Bruno Victal Date: Fri, 9 Jun 2023 22:20:58 +0100 Message-Id: <77911cd47e7ae77df6d614d7d07d78b5cf7781f0.1686345627.git.mirai@makinata.eu> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 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: , 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/services/linux.scm (serialize-fstrim-configuration): Refactor to use base-transducer. --- gnu/services/linux.scm | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/gnu/services/linux.scm b/gnu/services/linux.scm index d105c42850..3cfa6d6855 100644 --- a/gnu/services/linux.scm +++ b/gnu/services/linux.scm @@ -40,6 +40,7 @@ (define-module (gnu services linux) #:use-module (srfi srfi-26) #:use-module (srfi srfi-34) #:use-module (srfi srfi-35) + #:use-module (srfi srfi-171) #:use-module (ice-9 format) #:use-module (ice-9 match) #:export (earlyoom-configuration @@ -227,13 +228,9 @@ (define-configuration fstrim-configuration (prefix fstrim-)) (define (serialize-fstrim-configuration config) - (concatenate - (filter list? - (map (lambda (field) - ((configuration-field-serializer field) - (configuration-field-name field) - ((configuration-field-getter field) config))) - fstrim-configuration-fields)))) + (list-transduce (compose (base-transducer config) tconcatenate) + rcons + fstrim-configuration-fields)) (define (fstrim-mcron-job config) (match-record config (package schedule) From patchwork Fri Jun 9 21:20:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruno Victal X-Patchwork-Id: 50808 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 BA52E27BBEA; Fri, 9 Jun 2023 22:27:20 +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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, SPF_HELO_PASS autolearn=ham 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 8800F27BBE2 for ; Fri, 9 Jun 2023 22:27:19 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7jdR-0007Ee-R4; Fri, 09 Jun 2023 17:27:05 -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 1q7jdO-0007Br-Ei for guix-patches@gnu.org; Fri, 09 Jun 2023 17:27:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q7jdO-0000Kf-5U for guix-patches@gnu.org; Fri, 09 Jun 2023 17:27:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q7jdO-0000dJ-0A for guix-patches@gnu.org; Fri, 09 Jun 2023 17:27:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#63985] [PATCH RFC 4/5] services: configuration: Add serializer-kwargs field. Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 09 Jun 2023 21:27:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63985 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 63985@debbugs.gnu.org Cc: Bruno Victal Received: via spool by 63985-submit@debbugs.gnu.org id=B63985.16863460212426 (code B ref 63985); Fri, 09 Jun 2023 21:27:01 +0000 Received: (at 63985) by debbugs.gnu.org; 9 Jun 2023 21:27:01 +0000 Received: from localhost ([127.0.0.1]:32895 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q7jdM-0000d4-TJ for submit@debbugs.gnu.org; Fri, 09 Jun 2023 17:27:01 -0400 Received: from smtpmciv2.myservices.hosting ([185.26.107.238]:35328) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q7jdL-0000cv-9J for 63985@debbugs.gnu.org; Fri, 09 Jun 2023 17:26:59 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpmciv2.myservices.hosting (Postfix) with ESMTP id D261D20E2B for <63985@debbugs.gnu.org>; Fri, 9 Jun 2023 23:26:58 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id 2D0538009B; Fri, 9 Jun 2023 23:21:28 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 95vG5acq2eRl; Fri, 9 Jun 2023 23:21:27 +0200 (CEST) Received: from guix-nuc.home.arpa (unknown [10.192.1.83]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id 93B7C80098; Fri, 9 Jun 2023 23:21:27 +0200 (CEST) From: Bruno Victal Date: Fri, 9 Jun 2023 22:20:59 +0100 Message-Id: <0714ce739dca87c02a3fd405a449876ed72eb511.1686345627.git.mirai@makinata.eu> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 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: , 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 Allow relaying additional arguments to a serialize- procedure. * gnu/services/configuration.scm (configuration-field) : New field. (base-transducer, define-maybe-helper): Adjust to relay additional arguments. (normalize-extra-args): Implement serializer-kwargs literal. * tests/services/configuration.scm: Add tests for serializer-kwargs. --- gnu/services/configuration.scm | 48 +++++++++++++++++++++----------- tests/services/configuration.scm | 34 ++++++++++++++++++++++ 2 files changed, 66 insertions(+), 16 deletions(-) diff --git a/gnu/services/configuration.scm b/gnu/services/configuration.scm index 0818b48bb5..b32a5a85ba 100644 --- a/gnu/services/configuration.scm +++ b/gnu/services/configuration.scm @@ -124,6 +124,7 @@ (define-record-type* (predicate configuration-field-predicate) (sanitizer configuration-field-sanitizer) (serializer configuration-field-serializer) + (serializer-kwargs configuration-field-serializer-kwargs) (default-value-thunk configuration-field-default-value-thunk) (documentation configuration-field-documentation)) @@ -139,9 +140,13 @@ (define (base-transducer config) config))) (maybe-value-set? field-value)))) (tmap (lambda (field) - ((configuration-field-serializer field) - (configuration-field-name field) - ((configuration-field-getter field) config)))))) + (let ((serializer (configuration-field-serializer field)) + (field-name (configuration-field-name field)) + (value + ((configuration-field-getter field) config)) + (serializer-kwargs + (configuration-field-serializer-kwargs field))) + (apply serializer field-name value serializer-kwargs)))))) (define (serialize-configuration config fields) #~(string-append @@ -168,10 +173,9 @@ (define (define-maybe-helper serialize? prefix syn) (or (not (maybe-value-set? val)) (stem? val))) #,@(if serialize? - (list #'(define (serialize-maybe-stem field-name val) - (if (stem? val) - (serialize-stem field-name val) - ""))) + (list #'(define (serialize-maybe-stem field-name val . rest) + (when (maybe-value-set? val) + (apply serialize-stem field-name val rest)))) '())))))) (define-syntax define-maybe @@ -205,38 +209,49 @@ (define (define-configuration-helper serialize? serializer-prefix syn) "Extract and normalize arguments following @var{doc}." (let loop ((s s) (sanitizer* #f) - (serializer* #f)) - (syntax-case s (sanitizer serializer empty-serializer) + (serializer* #f) + (serializer-kwargs* #f)) + (syntax-case s (sanitizer serializer empty-serializer serializer-kwargs) (((sanitizer proc) tail ...) (if sanitizer* (syntax-violation 'sanitizer "duplicate entry" #'proc) - (loop #'(tail ...) #'proc serializer*))) + (loop #'(tail ...) + #'proc serializer* serializer-kwargs*))) (((serializer proc) tail ...) (if serializer* (syntax-violation 'serializer "duplicate or conflicting entry" #'proc) - (loop #'(tail ...) sanitizer* #'proc))) + (loop #'(tail ...) + sanitizer* #'proc serializer-kwargs*))) ((empty-serializer tail ...) (if serializer* (syntax-violation 'empty-serializer "duplicate or conflicting entry" #f) - (loop #'(tail ...) sanitizer* #'empty-serializer))) + (loop #'(tail ...) + sanitizer* #'empty-serializer #f))) + (((serializer-kwargs args) tail ...) + (if serializer-kwargs* + (syntax-violation 'serializer-kwargs + "duplicate or conflicting entry" #f) + (loop #'(tail ...) + sanitizer* serializer* #'args))) (() ; stop condition - (values (list sanitizer* serializer*))) + (values (list sanitizer* serializer* + (or serializer-kwargs* #'(quote ()))))) ((proc) ; TODO: deprecated, to be removed. - (every not (list sanitizer* serializer*)) + (every not (list sanitizer* serializer* serializer-kwargs*)) (begin (warning #f (G_ "specifying serializers after documentation is \ deprecated, use (serializer ~a) instead~%") (syntax->datum #'proc)) - (values (list #f #'proc))))))) + (values (list #f #'proc #'(quote ())))))))) (syntax-case syn () ((_ stem (field field-type+def doc extra-args ...) ...) (with-syntax ((((field-type def) ...) (map normalize-field-type+def #'(field-type+def ...))) - (((sanitizer* serializer*) ...) + (((sanitizer* serializer* serializer-kwargs*) ...) (map normalize-extra-args #'((extra-args ...) ...)))) (with-syntax (((field-getter ...) @@ -322,6 +337,7 @@ (define (define-configuration-helper serialize? serializer-prefix syn) (or field-sanitizer (id #'stem #'validate- #'stem #'- #'field))) (serializer field-serializer) + (serializer-kwargs serializer-kwargs*) (default-value-thunk (lambda () (if (maybe-value-set? (syntax->datum field-default)) diff --git a/tests/services/configuration.scm b/tests/services/configuration.scm index 1db83bb273..ae1b194e81 100644 --- a/tests/services/configuration.scm +++ b/tests/services/configuration.scm @@ -297,6 +297,40 @@ (define (sanitize-port value) (lambda _ "lorem") (sanitizer (lambda () #t))))))) +(test-group "Serializer keyword arguments" + (define* (serialize-port field value #:key host) + (format #f "host=~a,port=~d" host value)) + + (define-configuration kwarg-config + (port + (port 80) + "Lorem Ipsum." + (serializer-kwargs '(#:host "[2001:db8::1]")))) + + (test-equal "keyword argument provided" + "host=[2001:db8::1],port=80" + (eval-gexp + (serialize-configuration (kwarg-config) + kwarg-config-fields)))) + +(test-group "Serializer keyword arguments, define-maybe" + (define* (serialize-port field value #:key host) + (format #f "host=~a,port=~d" host value)) + + (define-maybe port) + + (define-configuration kwarg-config + (port + (maybe-port 80) + "Lorem Ipsum." + (serializer-kwargs '(#:host "[2001:db8::1]")))) + + (test-equal "keyword argument provided, maybe type" + "host=[2001:db8::1],port=80" + (eval-gexp + (serialize-configuration (kwarg-config) + kwarg-config-fields)))) + ;;; ;;; define-maybe macro. From patchwork Fri Jun 9 21:21:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bruno Victal X-Patchwork-Id: 50805 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 A26E227BBEA; Fri, 9 Jun 2023 22:22:40 +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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham 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 EC02F27BBE2 for ; Fri, 9 Jun 2023 22:22:38 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7jYf-000639-5j; Fri, 09 Jun 2023 17:22:09 -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 1q7jYZ-00061w-CC for guix-patches@gnu.org; Fri, 09 Jun 2023 17:22:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q7jYZ-0007Po-3a for guix-patches@gnu.org; Fri, 09 Jun 2023 17:22:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q7jYY-0000Vx-Vk for guix-patches@gnu.org; Fri, 09 Jun 2023 17:22:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#63985] [PATCH RFC 5/5] services: configuration: New generic-ini module. Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 09 Jun 2023 21:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63985 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 63985@debbugs.gnu.org Cc: Bruno Victal Received: via spool by 63985-submit@debbugs.gnu.org id=B63985.16863456991927 (code B ref 63985); Fri, 09 Jun 2023 21:22:02 +0000 Received: (at 63985) by debbugs.gnu.org; 9 Jun 2023 21:21:39 +0000 Received: from localhost ([127.0.0.1]:32884 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q7jYA-0000Uz-KG for submit@debbugs.gnu.org; Fri, 09 Jun 2023 17:21:39 -0400 Received: from smtpm3.myservices.hosting ([185.26.105.234]:56450) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q7jY8-0000Ur-4c for 63985@debbugs.gnu.org; Fri, 09 Jun 2023 17:21:37 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpm3.myservices.hosting (Postfix) with ESMTP id 6F3DC21057 for <63985@debbugs.gnu.org>; Fri, 9 Jun 2023 23:21:35 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id ABB328009D; Fri, 9 Jun 2023 23:21:34 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id u5xLINKXxdzr; Fri, 9 Jun 2023 23:21:34 +0200 (CEST) Received: from guix-nuc.home.arpa (unknown [10.192.1.83]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id D75228009C; Fri, 9 Jun 2023 23:21:33 +0200 (CEST) From: Bruno Victal Date: Fri, 9 Jun 2023 22:21:00 +0100 Message-Id: <9906d692a359142a929634d9e6409164da257914.1686345627.git.mirai@makinata.eu> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 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: , 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 Implements a ‘serialize-ini-configuration’ procedure for serializing record-types defined with define-configuration into generic INI files. * gnu/services/configuration/generic-ini.scm: New module. * tests/services/configuration/generic-ini.scm: Add tests for new module. * Makefile.am: Register tests. * gnu/local.mk: Register module. --- Makefile.am | 1 + gnu/local.mk | 1 + gnu/services/configuration/generic-ini.scm | 129 +++++++++++++++++++ tests/services/configuration/generic-ini.scm | 106 +++++++++++++++ 4 files changed, 237 insertions(+) create mode 100644 gnu/services/configuration/generic-ini.scm create mode 100644 tests/services/configuration/generic-ini.scm diff --git a/Makefile.am b/Makefile.am index ab901df757..8dc9a3438b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -552,6 +552,7 @@ SCM_TESTS = \ tests/services.scm \ tests/services/file-sharing.scm \ tests/services/configuration.scm \ + tests/services/configuration/generic-ini.scm \ tests/services/lightdm.scm \ tests/services/linux.scm \ tests/services/telephony.scm \ diff --git a/gnu/local.mk b/gnu/local.mk index ce16d37e2b..a05d70aff3 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -670,6 +670,7 @@ GNU_SYSTEM_MODULES = \ %D%/services/cgit.scm \ %D%/services/ci.scm \ %D%/services/configuration.scm \ + %D%/services/configuration/generic-ini.scm \ %D%/services/cuirass.scm \ %D%/services/cups.scm \ %D%/services/databases.scm \ diff --git a/gnu/services/configuration/generic-ini.scm b/gnu/services/configuration/generic-ini.scm new file mode 100644 index 0000000000..338a35f90d --- /dev/null +++ b/gnu/services/configuration/generic-ini.scm @@ -0,0 +1,129 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2023 Bruno Victal +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (gnu services configuration generic-ini) + #:use-module (gnu services configuration) + #:use-module (guix gexp) + #:use-module (srfi srfi-171) + #:use-module (ice-9 match) + #:export (ini-entry? + list-of-ini-entries? + + serialize-ini-configuration)) + +;;; +;;; Generic INI serializer +;;; + + +;;; +;;; Predicates +;;; + +;; This is the same format used in SRFI-233 but without comment support. +(define ini-entry? + (match-lambda + (((? symbol) (? symbol) (? string)) #t) + (_ #f))) + +(define list-of-ini-entries + (list-of ini-entry?)) + +;; +;; Overall design document +;; +;; This module implements a generic INI serializer for a record-type defined +;; using define-configuration. +;; It expects that the serialize- procedures return a list with +;; three elements of the form: +;; (list section key value) +;; Where ‘section’ and ‘key’ are symbols and ‘value’ is a string. +;; The fields within define-configuration do not have to be ordered in, +;; any way whatsoever as the ‘serialize-ini’ will group them up automatically. +;; This implies that no assumptions should be made regarding the order of the +;; values in the serializied INI output. +;; +;; Additional notes: +;; Q: Why not replace rcons with string-append and forego the ungexp-splice? +;; A: The transduction happens outside of the G-Exp while the final string-append +;; takes place in the G-Exp. +;; +;; Debugging tips: Open a REPL and try one transducer at a time from +;; ‘ini-transducer’. +;; + +(define (add-section-header partition) + (let ((header (caar partition))) + (cons (list header) + partition))) + +(define serializer + (match-lambda + ((section) + #~(format #f "[~a]~%" '#$section)) + ((section key value) + #~(format #f "~a=~a~%" '#$key #$value)) + ((? string? s) ; used for the newline between sections + s))) + +(define ini-transducer + (compose (tpartition car) + (tmap add-section-header) + (tadd-between '("\n")) + tconcatenate + (tmap serializer))) + +;; A “first-pass” serialization is performed and sorted in order +;; to group up the fields by “section” before passing through the +;; transducer. +(define (serialize-ini-configuration config fields) + (let* ((srfi-233-IR + ;; First pass: “serialize” into a (disordered) list of + ;; SRFI-233 entries. + (list-transduce (base-transducer config) rcons fields)) + (comparator (lambda (x y) + ;; Sort the SRFI-233 entries by section. + (string<=? (symbol->string (car x)) + (symbol->string (car y))))) + (sorted-entries (sort srfi-233-IR comparator))) + #~(string-append + #$@(list-transduce ini-transducer rcons sorted-entries)))) + +;; FIXME:RFC: +;; generic-ini- prefixed serializing procs? +;; (perhaps prefixed as generic-ini: ?) +;; Example procedures: +;; +(define* (generic-ini-serialize-string field-name value #:key section) + (list section field-name value)) + +;; field-name-transform can be used to “uglify” a field-name, +;; e.g. want-ipv6? -> want_ipv6 +(define* (generic-ini-serialize-boolean field-name value #:key section + (field-name-transform identity)) + (list section (field-name-transform field-name) + (if value "true" "false"))) + + +;;; FIXME: delete this before inclusion, these are notes for the first RFC. +;;; +;;; Left out for now (but readily extendable): +;;; * Custom leading (presumed to be whitespace) characters for entries +;;; à la gitconfig, mostly pretty-printing purposes +;;; * Configurable delimiter (\n, \r\n, \0, ...) +;;; * Configurable Key-value separator (this is usually =) diff --git a/tests/services/configuration/generic-ini.scm b/tests/services/configuration/generic-ini.scm new file mode 100644 index 0000000000..c04acdcd46 --- /dev/null +++ b/tests/services/configuration/generic-ini.scm @@ -0,0 +1,106 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2023 Bruno Victal +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (tests services configuration generic-ini) + #:use-module (gnu services configuration) + #:use-module (gnu services configuration generic-ini) + #:use-module (guix diagnostics) + #:use-module (guix gexp) + #:use-module (guix store) + #:autoload (guix i18n) (G_) + #:use-module (srfi srfi-34) + #:use-module (srfi srfi-64) + #:use-module (srfi srfi-71)) + +;;; Tests for the (gnu services configuration generic-ini) module. + +(test-begin "generic-ini serializer") + + +(define expected-output "\ +[featured] +favourite=true +track=Deep affection +artist=Magistina Saga +album=Creaith Anthem + +[main] +enabled=true +") + + +;;; +;;; Serializers +;;; +(define (strip-trailing-?-character field-name) + "Drop rightmost '?' character" + (let ((str (symbol->string field-name))) + (if (string-suffix? "?" str) + (string->symbol (string-drop-right str 1)) + field-name))) + +(define* (serialize-string field-name value #:key section) + (list section field-name value)) + +(define* (serialize-boolean field-name value #:key section) + (list section (strip-trailing-?-character field-name) + (if value "true" "false"))) + + +;;; +;;; Record-type definition +;;; + +(define-configuration foo-configuration + (album + (string "Creaith Anthem") + "Lorem Ipsum …" + (serializer-kwargs '(#:section featured))) + + (artist + (string "Magistina Saga") + "Lorem Ipsum …" + (serializer-kwargs '(#:section featured))) + + (track + (string "Deep affection") + "Lorem Ipsum …" + (serializer-kwargs '(#:section featured))) + + (favourite? + (boolean #t) + "Lorem Ipsum …" + (serializer-kwargs '(#:section featured))) + + (enabled? + (boolean #t) + "Lorem Ipsum …" + (serializer-kwargs '(#:section main)))) + +(test-equal "Well-formed INI output from serialize-ini" + expected-output + ;; Serialize the above into a string, properly resolving any potential + ;; nested G-Exps as well. + (let* ((serialized-ini + (serialize-ini-configuration (foo-configuration) + foo-configuration-fields)) + (lowered conn (with-store store + ((lower-gexp serialized-ini) store)))) + (eval (lowered-gexp-sexp lowered) (current-module)))) + +(test-end)