From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id ePeOFalqHGRTHwEASxT56A (envelope-from ) for ; Thu, 23 Mar 2023 16:05:13 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id kAk4FalqHGQyFgEAauVa8A (envelope-from ) for ; Thu, 23 Mar 2023 16:05:13 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 005FA1B3E7 for ; Thu, 23 Mar 2023 16:05:12 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pfMUy-0003cy-Ne; Thu, 23 Mar 2023 11:05: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 1pfMUx-0003cN-79 for guix-patches@gnu.org; Thu, 23 Mar 2023 11:05: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 1pfMUw-0001qD-PP for guix-patches@gnu.org; Thu, 23 Mar 2023 11:05:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pfMUw-0001hy-Cl for guix-patches@gnu.org; Thu, 23 Mar 2023 11:05:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#62298] [PATCH v2 2/8] services: replace bare serializers with (serializer ...) Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 23 Mar 2023 15:05:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62298 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62298@debbugs.gnu.org Cc: ludo@gnu.org, Bruno Victal , liliana.prikler@gmail.com, maxim.cournoyer@gmail.com Received: via spool by 62298-submit@debbugs.gnu.org id=B62298.16795838586461 (code B ref 62298); Thu, 23 Mar 2023 15:05:02 +0000 Received: (at 62298) by debbugs.gnu.org; 23 Mar 2023 15:04:18 +0000 Received: from localhost ([127.0.0.1]:39102 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfMU9-0001fp-TJ for submit@debbugs.gnu.org; Thu, 23 Mar 2023 11:04:17 -0400 Received: from smtpmciv2.myservices.hosting ([185.26.107.238]:48980) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfMU4-0001fa-KR for 62298@debbugs.gnu.org; Thu, 23 Mar 2023 11:04:13 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpmciv2.myservices.hosting (Postfix) with ESMTP id 3449B20D6B; Thu, 23 Mar 2023 16:04:06 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id C85E0800AD; Thu, 23 Mar 2023 16:04:06 +0100 (CET) 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 cgueMhxCQalA; Thu, 23 Mar 2023 16:04:06 +0100 (CET) Received: from guix-nuc.home.arpa (bl9-119-177.dsl.telepac.pt [85.242.119.177]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id D0DCD800AB; Thu, 23 Mar 2023 16:04:05 +0100 (CET) From: Bruno Victal Date: Thu, 23 Mar 2023 15:02:12 +0000 Message-Id: X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1679583913; a=rsa-sha256; cv=none; b=Wd8+QvrIgrgyzx9XLFzHLSEamSCVmqsy+LKIn4h3IfukGPYn8QT1y028nNILQLTZjaeJvO JqZWQgo/4HrInvR84N/HxqNVEFoAoT/SWjKSZqga4OS1FVtkSPPQYzvv08o6ls/GyX8Xwu gfuisKfaK3HMF0I0bjFHESq4oORJ+fVct9MQzxXK6Z/AHEmKnifpHM8BI+NGvVAIdIWahL 9v/rJsC29qa8w626Rij7YEDwlArveU1MGEZpPXUozXvwyF+HSFlRS+n+qFZ+D8STbXwoQp HFvY7jYYUVg4vPAIArAKJaX0ZkXF+U8+3Uh7fQ2cRXzqLLtODvHmCIDs5re1PA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1679583913; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=LTFta/Dhej7pZhvTPQ6E9gzn/gF9oUGy5NtOeMixPnM=; b=C9RGNdSqB6Ryl8a5Vtqcndj8fQrEGPNqqUdnS7wUolbtKBmGU2V0oL+xDy6HyDN7JFWuUU aL5hNcS0W8t5BBr/MdHKLNk4kY1oqrS+QamWnjsptvwT7+lPpQ5EttPcMCUVsRl/wxEB8i io0jxUwviem2nb1EkNOqhmHiQqBErlfIhYyF6o8YZnNfA7LcE7Bb/xAx0V27vp1CJJk7iW JoTet/nluDLExdnUtfsNau88WErTeVz1xTGJ04IU7oeGkBJV6feWRCcJFFwumqfmM3z6cs qbrl6gqwoHn1ozgK3yp/tbfONqncRK9uwTYBLQE0X7Pt3svR2kqhYw6cLOvUCA== Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Scanner: scn1.migadu.com X-Migadu-Spam-Score: 1.25 X-Spam-Score: 1.25 X-Migadu-Queue-Id: 005FA1B3E7 X-TUID: uf8STJmvb61M * 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/linux.scm (fstrim-configuration)[extra-arguments]: 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/linux.scm | 7 ++--- gnu/services/security.scm | 6 ++--- tests/services/configuration.scm | 11 +++++++- 5 files changed, 45 insertions(+), 35 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/linux.scm b/gnu/services/linux.scm index d085b375a2..229220eeb1 100644 --- a/gnu/services/linux.scm +++ b/gnu/services/linux.scm @@ -213,9 +213,10 @@ (define-configuration fstrim-configuration maybe-list-of-strings "Extra options to append to @command{fstrim} (run @samp{man fstrim} for more information)." - (lambda (_ value) - (if (maybe-value-set? value) - value '()))) + (serializer + (lambda (_ value) + (if (maybe-value-set? value) + value '())))) (prefix fstrim-)) (define (serialize-fstrim-configuration config) 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 64b7bb1543..20952acb79 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