From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.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 ENBRFCcLmmTrNAEASxT56A (envelope-from ) for ; Tue, 27 Jun 2023 00:03:19 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id sOY7FCcLmmTx9QAA9RJhRA (envelope-from ) for ; Tue, 27 Jun 2023 00:03:19 +0200 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 1AC4B39C85 for ; Tue, 27 Jun 2023 00:03:19 +0200 (CEST) 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1687816999; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: 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=2E960RUb3jm3ECHzpoqCGqoPfZYweR5fPXC1iVSoTbw=; b=gNPPfGoWbYdVdVEPR23yyUOEFtAK+WMNAoNo95ghpkOx0QADKS+wtdP+ECAO1jNMZi3++s 6fz86lES4FvzOC7QN7GknAF5rvNwprsVPW4moiPeHaN9Qt3IQmFoiN+WIapKhOuQ64FV3+ q0k6ouhVzBq/qNe9Lo7kOV9umoMTP/s8Xq4A53a9rSfQSINezAg54TmvD/C4J6xoL/wAJn TznmzrZyNq122/O4z1SV+6oBQOS/Wp+GVMbSXTrTEoDAaE+ifEQvauRCqWaF3RB2xHJ/EU r21N3FBPxttv1cD1LAgS3peevCMMxaCri9JdlUDMA12ljXDoLZjYyPR3Sz8+/w== 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-Seal: i=1; s=key1; d=yhetil.org; t=1687816999; a=rsa-sha256; cv=none; b=rUUVPZ0PaGXi/iG+QvivZP/PdzwtIt/m/RvmqeeMu3dnh2axlBqxX0eEdU7FHpw2uncshw KiWY256a4M4RsJU3BYV5d6Ol04+TkPvAO2tspovZll8JdT2iJ9rqPh39ysFWdKe499+0Uu sabMHjhDFIcDlfsfuEtAfs5o+0iw2KKj0nM4aGpCU+bf34lk8+6jdlzwtYMPP9FL4imetq bR5XlS3LajSpmk3Y5wurvkmzzbiCRFpNLsGA7P5SFmYsIAtJxh1fG6Uka2mHk492nHXmZe 9W6B7VziXPEp34mZ1C9hq+zqR/167GFB3PhK+9es6FwRhrLUK/9wvYjJnJLypg== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qDuGn-0005E9-LU; Mon, 26 Jun 2023 18:01:13 -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 1qDuGi-00051q-8y for guix-patches@gnu.org; Mon, 26 Jun 2023 18:01:10 -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 1qDuGd-0005X8-Fo for guix-patches@gnu.org; Mon, 26 Jun 2023 18:01:05 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qDuGd-0008Sg-7K for guix-patches@gnu.org; Mon, 26 Jun 2023 18:01:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#63985] [PATCH v3 07/11] services: configuration: Add some commonly used predicates. Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 26 Jun 2023 22:01:03 +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.168781682932386 (code B ref 63985); Mon, 26 Jun 2023 22:01:03 +0000 Received: (at 63985) by debbugs.gnu.org; 26 Jun 2023 22:00:29 +0000 Received: from localhost ([127.0.0.1]:47177 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qDuG4-0008QH-IL for submit@debbugs.gnu.org; Mon, 26 Jun 2023 18:00:29 -0400 Received: from smtpm1.myservices.hosting ([185.26.105.232]:58444) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qDuFx-0008Pt-7k for 63985@debbugs.gnu.org; Mon, 26 Jun 2023 18:00:22 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpm1.myservices.hosting (Postfix) with ESMTP id A97D520512 for <63985@debbugs.gnu.org>; Tue, 27 Jun 2023 00:00:20 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id 0CCB88009B; Tue, 27 Jun 2023 00:00:20 +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 2l1PFbt-_Fo0; Tue, 27 Jun 2023 00:00:19 +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 3BF1D8009A; Tue, 27 Jun 2023 00:00:19 +0200 (CEST) From: Bruno Victal Date: Mon, 26 Jun 2023 22:59:33 +0100 Message-Id: X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 X-Migadu-Scanner: scn0.migadu.com X-Migadu-Spam-Score: -3.35 X-Spam-Score: -3.35 X-Migadu-Queue-Id: 1AC4B39C85 X-TUID: cpByKlHOTlQ3 * gnu/services/configuration.scm (list-of-packages?, list-of-symbols?): New predicate. * gnu/services/audio.scm (list-of-symbol?): Remove. * gnu/services/telephony.scm (string-list?): Remove. (serialize-string-list): Rename to … (serialize-list-of-strings): … this. (account-fingerprint-list?, jami-account-list?): Use list-of. * doc/guix.texi: Update it. --- doc/guix.texi | 4 ++-- gnu/services/audio.scm | 7 ++----- gnu/services/configuration.scm | 16 ++++++++++++++++ gnu/services/telephony.scm | 20 +++++++------------- 4 files changed, 27 insertions(+), 20 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 14802e9366..2f7e734874 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -27850,7 +27850,7 @@ Telephony Services connection to the Internet has been lost. When left unspecified, the value from the account archive prevails. -@item @code{bootstrap-hostnames} (type: maybe-string-list) +@item @code{bootstrap-hostnames} (type: maybe-list-of-strings) A list of hostnames or IPs pointing to OpenDHT nodes, that should be used to initially join the OpenDHT network. When left unspecified, the value from the account archive prevails. @@ -34244,7 +34244,7 @@ Audio Services The group to run mpd as. The default @code{%mpd-group} is a system group with name ``mpd''. -@item @code{shepherd-requirement} (default: @code{'()}) (type: list-of-symbol) +@item @code{shepherd-requirement} (default: @code{'()}) (type: list-of-symbols) A list of symbols naming Shepherd services that this service will depend on. diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm index 690409b7a1..89ab9c51c6 100644 --- a/gnu/services/audio.scm +++ b/gnu/services/audio.scm @@ -137,9 +137,6 @@ (define (uglify-field-name field-name) str) #\-) "_"))) -(define list-of-symbol? - (list-of symbol?)) - ;; Helpers for deprecated field types, to be removed later. (define %lazy-group (make-symbol "%lazy-group")) @@ -413,7 +410,7 @@ (define-configuration mpd-configuration (sanitizer mpd-group-sanitizer)) (shepherd-requirement - (list-of-symbol '()) + (list-of-symbols '()) "This is a list of symbols naming Shepherd services that this service will depend on." empty-serializer) @@ -711,7 +708,7 @@ (define-configuration/no-serialization mympd-configuration empty-serializer) (shepherd-requirement - (list-of-symbol '()) + (list-of-symbols '()) "This is a list of symbols naming Shepherd services that this service will depend on." empty-serializer) diff --git a/gnu/services/configuration.scm b/gnu/services/configuration.scm index 4eee5a26c2..fd9130b1ea 100644 --- a/gnu/services/configuration.scm +++ b/gnu/services/configuration.scm @@ -81,7 +81,9 @@ (define-module (gnu services configuration) interpose list-of + list-of-packages? list-of-strings? + list-of-symbols? alist? serialize-file-like text-config? @@ -508,6 +510,10 @@ (define* (interpose ls #:optional (delimiter "\n") (grammar 'infix)) (cons delimiter acc)))) '() ls)) + +;;; +;;; Commonly used predicates + (define (list-of pred?) "Return a procedure that takes a list and check if all the elements of the list result in @code{#t} when applying PRED? on them." @@ -516,10 +522,20 @@ (define (list-of pred?) (every pred? x) #f))) +(define list-of-packages? + (list-of package?)) (define list-of-strings? (list-of string?)) +(define list-of-symbols? + (list-of symbol?)) + + +;;; +;;; Special serializers +;;; + (define alist? (list-of pair?)) diff --git a/gnu/services/telephony.scm b/gnu/services/telephony.scm index 56b7772f58..c9b5d6cd99 100644 --- a/gnu/services/telephony.scm +++ b/gnu/services/telephony.scm @@ -117,15 +117,10 @@ (define (string-or-computed-file? val) (or (string? val) (computed-file? val))) -(define (string-list? val) - (and (list? val) - (and-map string? val))) +(define account-fingerprint-list? + (list-of account-fingerprint?)) -(define (account-fingerprint-list? val) - (and (list? val) - (and-map account-fingerprint? val))) - -(define-maybe string-list) +(define-maybe list-of-strings) (define-maybe/no-serialization account-fingerprint-list) @@ -135,7 +130,7 @@ (define-maybe string) ;;; The following serializers are used to derive an account details alist from ;;; a record. -(define (serialize-string-list _ val) +(define (serialize-list-of-strings _ val) (string-join val ";")) (define (serialize-boolean _ val) @@ -188,7 +183,7 @@ (define-configuration jami-account connection to the the Internet has been lost. When left unspecified, the value from the account archive prevails.") (bootstrap-hostnames - maybe-string-list + maybe-list-of-strings "A list of hostnames or IPs pointing to OpenDHT nodes, that should be used to initially join the OpenDHT network. When left unspecified, the value from the account archive prevails.") @@ -220,9 +215,8 @@ (define (jami-account->alist jami-account-object) (list-transduce jami-account-transducer rcons jami-account-fields)) -(define (jami-account-list? val) - (and (list? val) - (and-map jami-account? val))) +(define jami-account-list? + (list-of jami-account?)) (define-maybe/no-serialization jami-account-list) -- 2.39.2