guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: services: configuration: Fix interpose implementa


From: guix-commits
Subject: branch master updated: services: configuration: Fix interpose implementation.
Date: Mon, 01 Nov 2021 10:47:01 -0400

This is an automated email from the git hooks/post-receive script.

wigust pushed a commit to branch master
in repository guix.

The following commit(s) were added to refs/heads/master by this push:
     new 7af3b82  services: configuration: Fix interpose implementation.
7af3b82 is described below

commit 7af3b822178782d6598865e1d6a780a756dd0cb3
Author: Andrew Tropin <andrew@trop.in>
AuthorDate: Mon Nov 1 10:43:12 2021 +0300

    services: configuration: Fix interpose implementation.
    
    * gnu/services/configuration.scm (interpose, serialize-text-config): Fix
    interpose implementation, move file-like object code to
    serialize-text-config.
    
    Signed-off-by: Oleg Pykhalov <go.wigust@gmail.com>
---
 gnu/services/configuration.scm | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/gnu/services/configuration.scm b/gnu/services/configuration.scm
index e8c55b6..0de350a 100644
--- a/gnu/services/configuration.scm
+++ b/gnu/services/configuration.scm
@@ -359,10 +359,7 @@ DELIMITER interposed LS.  Support 'infix and 'suffix 
GRAMMAR values."
       (G_ "The GRAMMAR value must be 'infix or 'suffix, but ~a provided.")
       grammar)))
   (fold-right (lambda (e acc)
-                (cons #~(begin
-                          (use-modules (ice-9 rdelim))
-                          (with-fluids ((%default-port-encoding "UTF-8"))
-                            (with-input-from-file #$e read-string)))
+                (cons e
                       (if (and (null? acc) (eq? grammar 'infix))
                           acc
                           (cons delimiter acc))))
@@ -387,7 +384,16 @@ the list result in @code{#t} when applying PRED? on them."
 (define (text-config? config)
   (list-of file-like?))
 (define (serialize-text-config field-name val)
-  #~(string-append #$@(interpose val "\n" 'suffix)))
+  #~(string-append
+     #$@(interpose
+         (map
+          (lambda (e)
+            #~(begin
+                (use-modules (ice-9 rdelim))
+                (with-fluids ((%default-port-encoding "UTF-8"))
+                  (with-input-from-file #$e read-string))))
+          val)
+         "\n" 'suffix)))
 
 (define ((generic-serialize-alist-entry serialize-field) entry)
   "Apply the SERIALIZE-FIELD procedure on the field and value of ENTRY."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]