From: Bruno Victal <mirai@makinata.eu>
To: 62298@debbugs.gnu.org
Cc: ludo@gnu.org, Bruno Victal <mirai@makinata.eu>,
liliana.prikler@gmail.com, maxim.cournoyer@gmail.com
Subject: [bug#62298] [PATCH 2/8] services: replace bare serializers with (serializer ...)
Date: Mon, 20 Mar 2023 17:07:07 +0000 [thread overview]
Message-ID: <1eed557ccb219d63cac51db502e20bdec9662741.1679332019.git.mirai@makinata.eu> (raw)
In-Reply-To: <cover.1679329773.git.mirai@makinata.eu>
* gnu/home/services/shells.scm (home-zsh-configuration)[environment-variables]: Use (serializer ...).
(home-bash-configuration)[aliases, environment-variables]: Ditto.
(home-fish-configuration)[abbreviations, aliases, environment-variables]: Ditto.
* gnu/services/audio.scm (mpd-configuration)[music-dir, playlist-dir, endpoints]
[address, inputs, archive-plugins, input-cache-size, decoders, filters, playlist-plugins]: Ditto.
* gnu/services/security.scm (fail2ban-jail-configuration)[backend, log-encoding, extra-content]: Ditto.
* tests/services/configuration.scm: Update tests. Add test for deprecated bare serializers.
---
gnu/home/services/shells.scm | 12 ++++-----
gnu/services/audio.scm | 44 ++++++++++++++++----------------
gnu/services/security.scm | 6 ++---
tests/services/configuration.scm | 11 +++++++-
4 files changed, 41 insertions(+), 32 deletions(-)
diff --git a/gnu/home/services/shells.scm b/gnu/home/services/shells.scm
index 3326eb37f4..f05f2221d6 100644
--- a/gnu/home/services/shells.scm
+++ b/gnu/home/services/shells.scm
@@ -133,7 +133,7 @@ (define-configuration home-zsh-configuration
(environment-variables
(alist '())
"Association list of environment variables to set for the Zsh session."
- serialize-posix-env-vars)
+ (serializer serialize-posix-env-vars))
(zshenv
(text-config '())
"List of file-like objects, which will be added to @file{.zshenv}.
@@ -334,7 +334,7 @@ (define-configuration home-bash-configuration
rules for the @code{home-environment-variables-service-type} apply
here (@pxref{Essential Home Services}). The contents of this field will be
added after the contents of the @code{bash-profile} field."
- serialize-posix-env-vars)
+ (serializer serialize-posix-env-vars))
(aliases
(alist '())
"Association list of aliases to set for the Bash session. The aliases will be
@@ -351,7 +351,7 @@ (define-configuration home-bash-configuration
@example
alias ls=\"ls -alF\"
@end example"
- bash-serialize-aliases)
+ (serializer bash-serialize-aliases))
(bash-profile
(text-config '())
"List of file-like objects, which will be added to @file{.bash_profile}.
@@ -536,19 +536,19 @@ (define-configuration home-fish-configuration
(environment-variables
(alist '())
"Association list of environment variables to set in Fish."
- serialize-fish-env-vars)
+ (serializer serialize-fish-env-vars))
(aliases
(alist '())
"Association list of aliases for Fish, both the key and the value
should be a string. An alias is just a simple function that wraps a
command, If you want something more akin to @dfn{aliases} in POSIX
shells, see the @code{abbreviations} field."
- serialize-fish-aliases)
+ (serializer serialize-fish-aliases))
(abbreviations
(alist '())
"Association list of abbreviations for Fish. These are words that,
when typed in the shell, will automatically expand to the full text."
- serialize-fish-abbreviations))
+ (serializer serialize-fish-abbreviations)))
(define (fish-files-service config)
`(("fish/config.fish"
diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm
index d55b804ba9..5f341fac0f 100644
--- a/gnu/services/audio.scm
+++ b/gnu/services/audio.scm
@@ -372,7 +372,7 @@ (define-configuration mpd-configuration
(music-dir ; TODO: deprecated, remove later
maybe-string
"The directory to scan for music files."
- mpd-serialize-deprecated-field)
+ (serializer mpd-serialize-deprecated-field))
(playlist-directory
maybe-string
@@ -381,7 +381,7 @@ (define-configuration mpd-configuration
(playlist-dir ; TODO: deprecated, remove later
maybe-string
"The directory to store playlists."
- mpd-serialize-deprecated-field)
+ (serializer mpd-serialize-deprecated-field))
(db-file
maybe-string
@@ -407,16 +407,16 @@ (define-configuration mpd-configuration
port is used.
To use a Unix domain socket, an absolute path or a path starting with @code{~}
can be specified here."
- (lambda (_ endpoints)
- (if (maybe-value-set? endpoints)
- (mpd-serialize-list-of-string "bind_to_address" endpoints)
- "")))
+ (serializer (lambda (_ endpoints)
+ (if (maybe-value-set? endpoints)
+ (mpd-serialize-list-of-string "bind_to_address" endpoints)
+ ""))))
(address ; TODO: deprecated, remove later
maybe-string
"The address that mpd will bind to.
To use a Unix domain socket, an absolute path can be specified here."
- mpd-serialize-deprecated-field)
+ (serializer mpd-serialize-deprecated-field))
(database
maybe-mpd-plugin
@@ -433,29 +433,29 @@ (define-configuration mpd-configuration
(inputs
(list-of-mpd-plugin '())
"List of MPD input plugin configurations."
- (lambda (_ x)
- (mpd-serialize-list-of-mpd-plugin "input" x)))
+ (serializer (lambda (_ x)
+ (mpd-serialize-list-of-mpd-plugin "input" x))))
(archive-plugins
(list-of-mpd-plugin '())
"List of MPD archive plugin configurations."
- (lambda (_ x)
- (mpd-serialize-list-of-mpd-plugin "archive_plugin" x)))
+ (serializer (lambda (_ x)
+ (mpd-serialize-list-of-mpd-plugin "archive_plugin" x))))
(input-cache-size
maybe-string
"MPD input cache size."
- (lambda (_ x)
- (if (maybe-value-set? x)
- #~(string-append "\ninput_cache {\n"
- #$(mpd-serialize-string "size" x)
- "}\n") "")))
+ (serializer (lambda (_ x)
+ (if (maybe-value-set? x)
+ #~(string-append "\ninput_cache {\n"
+ #$(mpd-serialize-string "size" x)
+ "}\n") ""))))
(decoders
(list-of-mpd-plugin '())
"List of MPD decoder plugin configurations."
- (lambda (_ x)
- (mpd-serialize-list-of-mpd-plugin "decoder" x)))
+ (serializer (lambda (_ x)
+ (mpd-serialize-list-of-mpd-plugin "decoder" x))))
(resampler
maybe-mpd-plugin
@@ -464,8 +464,8 @@ (define-configuration mpd-configuration
(filters
(list-of-mpd-plugin '())
"List of MPD filter plugin configurations."
- (lambda (_ x)
- (mpd-serialize-list-of-mpd-plugin "filter" x)))
+ (serializer (lambda (_ x)
+ (mpd-serialize-list-of-mpd-plugin "filter" x))))
(outputs
(list-of-mpd-plugin-or-output (list (mpd-output)))
@@ -475,8 +475,8 @@ (define-configuration mpd-configuration
(playlist-plugins
(list-of-mpd-plugin '())
"List of MPD playlist plugin configurations."
- (lambda (_ x)
- (mpd-serialize-list-of-mpd-plugin "playlist_plugin" x)))
+ (serializer (lambda (_ x)
+ (mpd-serialize-list-of-mpd-plugin "playlist_plugin" x))))
(extra-options
(alist '())
diff --git a/gnu/services/security.scm b/gnu/services/security.scm
index 8116072920..e750bb468b 100644
--- a/gnu/services/security.scm
+++ b/gnu/services/security.scm
@@ -200,7 +200,7 @@ (define-configuration fail2ban-jail-configuration
"Backend to use to detect changes in the @code{log-path}. The default is
'auto. To consult the defaults of the jail configuration, refer to the
@file{/etc/fail2ban/jail.conf} file of the @code{fail2ban} package."
- fail2ban-jail-configuration-serialize-backend)
+ (serializer fail2ban-jail-configuration-serialize-backend))
(max-retry
maybe-integer
"The number of failures before a host get banned
@@ -269,7 +269,7 @@ (define-configuration fail2ban-jail-configuration
maybe-symbol
"The encoding of the log files handled by the jail.
Possible values are: @code{'ascii}, @code{'utf-8} and @code{'auto}."
- fail2ban-jail-configuration-serialize-log-encoding)
+ (serializer fail2ban-jail-configuration-serialize-log-encoding))
(log-path
(list-of-strings '())
"The file names of the log files to be monitored.")
@@ -280,7 +280,7 @@ (define-configuration fail2ban-jail-configuration
(text-config '())
"Extra content for the jail configuration, provided as a list of file-like
objects."
- serialize-text-config)
+ (serializer serialize-text-config))
(prefix fail2ban-jail-configuration-))
(define list-of-fail2ban-jail-configurations?
diff --git a/tests/services/configuration.scm b/tests/services/configuration.scm
index c5569a9e50..6abab2832f 100644
--- a/tests/services/configuration.scm
+++ b/tests/services/configuration.scm
@@ -82,6 +82,9 @@ (define (custom-number-serializer name value)
(format #f "~a = ~a;" name value))
(define-configuration serializable-configuration
+ (port (number 80) "The port number." (serializer custom-number-serializer)))
+
+(define-configuration serializable-configuration-deprecated
(port (number 80) "The port number." custom-number-serializer))
(test-assert "serialize-configuration"
@@ -89,8 +92,14 @@ (define-configuration serializable-configuration
(let ((config (serializable-configuration)))
(serialize-configuration config serializable-configuration-fields))))
+(test-assert "serialize-configuration [deprecated]"
+ (gexp?
+ (let ((config (serializable-configuration-deprecated)))
+ (serialize-configuration
+ config serializable-configuration-deprecated-fields))))
+
(define-configuration serializable-configuration
- (port (number 80) "The port number." custom-number-serializer)
+ (port (number 80) "The port number." (serializer custom-number-serializer))
(no-serialization))
(test-assert "serialize-configuration with no-serialization"
--
2.39.1
next prev parent reply other threads:[~2023-03-20 17:08 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-20 16:45 [bug#62298] [PATCH 0/8] Extensible define-configuration & mpd/mympd service fixes Bruno Victal
2023-03-20 17:07 ` [bug#62298] [PATCH 1/8] services: configuration: Add user-defined sanitizer support Bruno Victal
2023-03-20 19:43 ` Liliana Marie Prikler
2023-03-20 17:07 ` Bruno Victal [this message]
2023-03-20 17:07 ` [bug#62298] [PATCH 3/8] services: audio: remove redundant list-of-string? predicate Bruno Victal
2023-03-20 17:07 ` [bug#62298] [PATCH 4/8] services: mympd: Require 'syslog service when configured to log to syslog Bruno Victal
2023-03-20 17:07 ` [bug#62298] [PATCH 5/8] services: mpd: Fix unintentional API breakage for mixer-type field Bruno Victal
2023-03-20 17:07 ` [bug#62298] [PATCH 6/8] services: mpd: Set PulseAudio related variables as default value for environment-variables field Bruno Victal
2023-03-20 17:07 ` [bug#62298] [PATCH 7/8] services: mpd: Use user-account (resp. user-group) for user (resp. group) fields Bruno Victal
2023-03-20 19:33 ` Liliana Marie Prikler
2023-03-21 2:10 ` Bruno Victal
2023-03-21 5:30 ` Liliana Marie Prikler
2023-03-20 17:07 ` [bug#62298] [PATCH 8/8] services: mympd: " Bruno Victal
2023-03-20 19:33 ` Liliana Marie Prikler
2023-03-23 15:02 ` [bug#62298] [PATCH v2 1/8] services: configuration: Add user-defined sanitizer support Bruno Victal
2023-03-23 15:02 ` [bug#62298] [PATCH v2 2/8] services: replace bare serializers with (serializer ...) Bruno Victal
2023-03-24 14:28 ` Maxim Cournoyer
2023-03-23 15:02 ` [bug#62298] [PATCH v2 3/8] services: audio: remove redundant list-of-string? predicate Bruno Victal
2023-03-23 15:02 ` [bug#62298] [PATCH v2 4/8] services: mympd: Require 'syslog service when configured to log to syslog Bruno Victal
2023-03-24 14:32 ` Maxim Cournoyer
2023-03-23 15:02 ` [bug#62298] [PATCH v2 5/8] services: mpd: Fix unintentional API breakage for mixer-type field Bruno Victal
2023-03-23 15:02 ` [bug#62298] [PATCH v2 6/8] services: mpd: Set PulseAudio related variables as default value for environment-variables field Bruno Victal
2023-03-24 18:10 ` bug#62298: " Maxim Cournoyer
2023-03-23 15:02 ` [bug#62298] [PATCH v2 7/8] services: mpd: Use user-account (resp. user-group) for user (resp. group) fields Bruno Victal
2023-03-23 18:03 ` Liliana Marie Prikler
2023-03-24 15:31 ` Maxim Cournoyer
2023-03-23 15:02 ` [bug#62298] [PATCH v2 8/8] services: mympd: " Bruno Victal
2023-03-23 19:19 ` Liliana Marie Prikler
2023-03-25 0:39 ` Bruno Victal
2023-03-24 16:03 ` Maxim Cournoyer
2023-03-25 0:33 ` Bruno Victal
2023-03-25 5:21 ` Liliana Marie Prikler
2023-03-23 19:47 ` [bug#62298] [PATCH v2 1/8] services: configuration: Add user-defined sanitizer support Liliana Marie Prikler
2023-03-24 14:25 ` Maxim Cournoyer
2023-03-24 18:03 ` Liliana Marie Prikler
2023-03-26 2:01 ` Maxim Cournoyer
2023-03-25 0:46 ` [bug#62298] [PATCH v3 1/5] " Bruno Victal
2023-03-25 0:46 ` [bug#62298] [PATCH v3 2/5] services: replace bare serializers with (serializer ...) Bruno Victal
2023-03-25 0:46 ` [bug#62298] [PATCH v3 3/5] services: mpd: Fix unintentional API breakage for mixer-type field Bruno Victal
2023-03-25 0:46 ` [bug#62298] [PATCH v3 4/5] services: mpd: Use user-account (resp. user-group) for user (resp. group) fields Bruno Victal
2023-03-25 0:46 ` [bug#62298] [PATCH v3 5/5] services: mympd: " Bruno Victal
2023-03-26 18:41 ` [bug#62298] [PATCH v4 1/5] services: configuration: Add user-defined sanitizer support Bruno Victal
2023-03-26 18:41 ` [bug#62298] [PATCH v4 2/5] services: replace bare serializers with (serializer ...) Bruno Victal
2023-03-26 18:41 ` [bug#62298] [PATCH v4 3/5] services: mpd: Fix unintentional API breakage for mixer-type field Bruno Victal
2023-03-26 18:41 ` [bug#62298] [PATCH v4 4/5] services: mpd: Use user-account (resp. user-group) for user (resp. group) fields Bruno Victal
2023-03-26 18:41 ` [bug#62298] [PATCH v4 5/5] services: mympd: " Bruno Victal
2023-04-02 10:46 ` bug#62298: [PATCH v4 1/5] services: configuration: Add user-defined sanitizer support Liliana Marie Prikler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1eed557ccb219d63cac51db502e20bdec9662741.1679332019.git.mirai@makinata.eu \
--to=mirai@makinata.eu \
--cc=62298@debbugs.gnu.org \
--cc=liliana.prikler@gmail.com \
--cc=ludo@gnu.org \
--cc=maxim.cournoyer@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.