From patchwork Fri Dec 15 21:02:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruno Victal X-Patchwork-Id: 57621 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 64FEA27BBEA; Fri, 15 Dec 2023 21:03:16 +0000 (GMT) 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 E572C27BBE2 for ; Fri, 15 Dec 2023 21:03:15 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rEFKu-0000rq-8c; Fri, 15 Dec 2023 16:03:09 -0500 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 1rEFKo-0000rL-5R for guix-patches@gnu.org; Fri, 15 Dec 2023 16:03:02 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rEFKn-0006Ib-T8 for guix-patches@gnu.org; Fri, 15 Dec 2023 16:03:01 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rEFKn-0003U7-VF for guix-patches@gnu.org; Fri, 15 Dec 2023 16:03:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#67842] [PATCH 1/4] doc: Remove missed hunk of revert commit for MPD service. Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 15 Dec 2023 21:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67842 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 67842@debbugs.gnu.org Cc: Bruno Victal Received: via spool by 67842-submit@debbugs.gnu.org id=B67842.170267416813338 (code B ref 67842); Fri, 15 Dec 2023 21:03:01 +0000 Received: (at 67842) by debbugs.gnu.org; 15 Dec 2023 21:02:48 +0000 Received: from localhost ([127.0.0.1]:53637 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rEFKa-0003T4-1p for submit@debbugs.gnu.org; Fri, 15 Dec 2023 16:02:48 -0500 Received: from smtpmciv4.myservices.hosting ([185.26.107.240]:48556) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rEFKZ-0003Sv-0E for 67842@debbugs.gnu.org; Fri, 15 Dec 2023 16:02:47 -0500 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpmciv4.myservices.hosting (Postfix) with ESMTP id 3F57A2077F for <67842@debbugs.gnu.org>; Fri, 15 Dec 2023 22:02:45 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id 9C1CE80095; Fri, 15 Dec 2023 22:02:45 +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 42vnNqQYYG2q; Fri, 15 Dec 2023 22:02:45 +0100 (CET) Received: from guix-nuc.home.arpa (unknown [10.192.1.83]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id 303DC80067; Fri, 15 Dec 2023 22:02:45 +0100 (CET) From: Bruno Victal Date: Fri, 15 Dec 2023 21:02:36 +0000 Message-ID: <00b00466d2660fec8a141724285c3d0339df7ad0.1702663151.git.mirai@makinata.eu> X-Mailer: git-send-email 2.41.0 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 Introduced with e1070ee16036f6dfb84c44aea4119e4db770356b and missed in the c7e45139faa27b60f2c7d0a4bc140f9793d97d47 revert. * doc/guix.texi (Audio Services): Remove missed hunk of revert commit c7e45139faa27b60f2c7d0a4bc140f9793d97d47. Change-Id: Ibbf0fa4e6a3a378d2981f03ffa5d1ca9c0e3f797 --- doc/guix.texi | 7 ------- 1 file changed, 7 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index e61a893af9..3659d57361 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -34718,13 +34718,6 @@ Audio Services by default. @end quotation -Most MPD clients will trigger a database update upon connecting, but you -can also use the @code{update} action do to so: - -@example -herd update mpd -@end example - All the MPD configuration fields are documented below, and a more complex example follows. From patchwork Fri Dec 15 21:02:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bruno Victal X-Patchwork-Id: 57622 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 40C3A27BBEA; Fri, 15 Dec 2023 21:03:31 +0000 (GMT) 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 963FB27BBE2 for ; Fri, 15 Dec 2023 21:03:30 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rEFKz-0000sn-Lz; Fri, 15 Dec 2023 16:03:15 -0500 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 1rEFKo-0000rP-SR for guix-patches@gnu.org; Fri, 15 Dec 2023 16:03:03 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rEFKo-0006KR-HY for guix-patches@gnu.org; Fri, 15 Dec 2023 16:03:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rEFKo-0003UK-IH for guix-patches@gnu.org; Fri, 15 Dec 2023 16:03:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#67842] [PATCH 2/4] tests: mympd: Simplify test. Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 15 Dec 2023 21:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67842 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 67842@debbugs.gnu.org Cc: Bruno Victal Received: via spool by 67842-submit@debbugs.gnu.org id=B67842.170267417213356 (code B ref 67842); Fri, 15 Dec 2023 21:03:02 +0000 Received: (at 67842) by debbugs.gnu.org; 15 Dec 2023 21:02:52 +0000 Received: from localhost ([127.0.0.1]:53640 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rEFKe-0003TM-AB for submit@debbugs.gnu.org; Fri, 15 Dec 2023 16:02:52 -0500 Received: from smtpmciv5.myservices.hosting ([185.26.107.241]:55370) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rEFKc-0003TD-Ha for 67842@debbugs.gnu.org; Fri, 15 Dec 2023 16:02:51 -0500 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpmciv5.myservices.hosting (Postfix) with ESMTP id 65B4720D7F for <67842@debbugs.gnu.org>; Fri, 15 Dec 2023 22:02:49 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id CCEA880098; Fri, 15 Dec 2023 22:02:48 +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 MyBZJJT7QwtP; Fri, 15 Dec 2023 22:02:48 +0100 (CET) Received: from guix-nuc.home.arpa (unknown [10.192.1.83]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id 29FF280067; Fri, 15 Dec 2023 22:02:48 +0100 (CET) From: Bruno Victal Date: Fri, 15 Dec 2023 21:02:37 +0000 Message-ID: X-Mailer: git-send-email 2.41.0 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/tests/audio.scm: (run-mympd-test): Restyle. Remove dhcp-client-service-type. Remove port-forwards and refactor http-head test to happen within the VM instead of the host. --- gnu/tests/audio.scm | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/gnu/tests/audio.scm b/gnu/tests/audio.scm index acb91293e8..a0ab54da2a 100644 --- a/gnu/tests/audio.scm +++ b/gnu/tests/audio.scm @@ -1,6 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2017 Peter Mikkelsen -;;; Copyright © 2022 Bruno Victal +;;; Copyright © 2022⁠–⁠2023 Bruno Victal ;;; ;;; This file is part of GNU Guix. ;;; @@ -81,23 +81,17 @@ (define %test-mpd (value (run-mpd-test)))) (define (run-mympd-test) - (define os (marionette-operating-system - (simple-operating-system (service dhcp-client-service-type) - (service mympd-service-type)) - #:imported-modules '((gnu services herd)))) + (define os + (marionette-operating-system + (simple-operating-system (service mympd-service-type)) + #:imported-modules '((gnu services herd)))) - (define vm - (virtual-machine - (operating-system os) - (port-forwardings '((8080 . 80))))) + (define vm (virtual-machine os)) (define test (with-imported-modules '((gnu build marionette)) #~(begin (use-modules (srfi srfi-64) - (srfi srfi-8) - (web client) - (web response) (gnu build marionette)) (define marionette @@ -106,18 +100,23 @@ (define (run-mympd-test) (test-runner-current (system-test-runner #$output)) (test-begin "mympd") (test-assert "service is running" - (marionette-eval '(begin - (use-modules (gnu services herd)) - - (start-service 'mympd)) - marionette)) + (marionette-eval + '(begin + (use-modules (gnu services herd)) + (start-service 'mympd)) + marionette)) (test-assert "HTTP port ready" (wait-for-tcp-port 80 marionette)) (test-equal "http-head" 200 - (receive (x _) (http-head "http://localhost:8080") (response-code x))) + (marionette-eval + '(begin + (use-modules (web client) + (web response)) + (response-code (http-head "http://localhost"))) + marionette)) (test-end)))) (gexp->derivation "mympd-test" test)) From patchwork Fri Dec 15 21:02:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruno Victal X-Patchwork-Id: 57623 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 8E17F27BBEA; Fri, 15 Dec 2023 21:03:36 +0000 (GMT) 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 218DB27BBE2 for ; Fri, 15 Dec 2023 21:03:35 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rEFL5-0000uh-Vd; Fri, 15 Dec 2023 16:03:20 -0500 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 1rEFKq-0000re-Kk for guix-patches@gnu.org; Fri, 15 Dec 2023 16:03:05 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rEFKp-0006NC-B4 for guix-patches@gnu.org; Fri, 15 Dec 2023 16:03:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rEFKp-0003US-2j for guix-patches@gnu.org; Fri, 15 Dec 2023 16:03:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#67842] [PATCH 3/4] services: mympd: Fix syslog logging and missing service destructor. Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 15 Dec 2023 21:03:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67842 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 67842@debbugs.gnu.org Cc: Bruno Victal Received: via spool by 67842-submit@debbugs.gnu.org id=B67842.170267417813383 (code B ref 67842); Fri, 15 Dec 2023 21:03:03 +0000 Received: (at 67842) by debbugs.gnu.org; 15 Dec 2023 21:02:58 +0000 Received: from localhost ([127.0.0.1]:53644 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rEFKj-0003Ti-O6 for submit@debbugs.gnu.org; Fri, 15 Dec 2023 16:02:58 -0500 Received: from smtpm2.myservices.hosting ([185.26.105.233]:44112) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rEFKh-0003TX-UZ for 67842@debbugs.gnu.org; Fri, 15 Dec 2023 16:02:56 -0500 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpm2.myservices.hosting (Postfix) with ESMTP id 9410620E87 for <67842@debbugs.gnu.org>; Fri, 15 Dec 2023 22:02:54 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id CCD7F80098; Fri, 15 Dec 2023 22:02:50 +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 1Yf0Wc3-Lfp5; Fri, 15 Dec 2023 22:02:50 +0100 (CET) Received: from guix-nuc.home.arpa (unknown [10.192.1.83]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id 63B3D80067; Fri, 15 Dec 2023 22:02:50 +0100 (CET) From: Bruno Victal Date: Fri, 15 Dec 2023 21:02:38 +0000 Message-ID: X-Mailer: git-send-email 2.41.0 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/audio.scm: (mympd-shepherd-service): Fix syslog logging and missing service destructor. Prefer list over quasiquote. --- gnu/services/audio.scm | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm index ae991ced4d..4fcfcc13ea 100644 --- a/gnu/services/audio.scm +++ b/gnu/services/audio.scm @@ -938,14 +938,15 @@ (define (mympd-shepherd-service config) cache-directory))))) (make-forkexec-constructor - `(#$(file-append package "/bin/mympd") - "--user" #$username - #$@(if (eq? log-to 'syslog) '("--syslog") '()) - "--workdir" #$work-directory - "--cachedir" #$cache-directory) + (list #$(file-append package "/bin/mympd") + "--user" #$username + #$@(if (maybe-value-set? log-to) '() '("--syslog")) + "--workdir" #$work-directory + "--cachedir" #$cache-directory) #:environment-variables (list #$(format #f "MYMPD_LOGLEVEL=~a" log-level)) - #:log-file #$(maybe-value log-to))))))))) + #:log-file #$(maybe-value log-to)))))) + (stop #~(make-kill-destructor))))) (define (mympd-accounts config) (match-record config (user group) From patchwork Fri Dec 15 21:02:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bruno Victal X-Patchwork-Id: 57624 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 E10FE27BBE2; Fri, 15 Dec 2023 21:03:36 +0000 (GMT) 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 AAC0B27BBE9 for ; Fri, 15 Dec 2023 21:03:35 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rEFL2-0000tp-Ku; Fri, 15 Dec 2023 16:03:17 -0500 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 1rEFKq-0000rf-LK for guix-patches@gnu.org; Fri, 15 Dec 2023 16:03:05 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rEFKp-0006NL-Cm for guix-patches@gnu.org; Fri, 15 Dec 2023 16:03:04 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rEFKp-0003UZ-Ez for guix-patches@gnu.org; Fri, 15 Dec 2023 16:03:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#67842] [PATCH 4/4] services: mympd: Refactor serialization process. Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 15 Dec 2023 21:03:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67842 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 67842@debbugs.gnu.org Cc: Bruno Victal Received: via spool by 67842-submit@debbugs.gnu.org id=B67842.170267418213408 (code B ref 67842); Fri, 15 Dec 2023 21:03:03 +0000 Received: (at 67842) by debbugs.gnu.org; 15 Dec 2023 21:03:02 +0000 Received: from localhost ([127.0.0.1]:53646 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rEFKn-0003Ty-2w for submit@debbugs.gnu.org; Fri, 15 Dec 2023 16:03:02 -0500 Received: from smtpmciv4.myservices.hosting ([185.26.107.240]:48588) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rEFKi-0003Ta-Tp for 67842@debbugs.gnu.org; Fri, 15 Dec 2023 16:02:57 -0500 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpmciv4.myservices.hosting (Postfix) with ESMTP id 2B91E2077F for <67842@debbugs.gnu.org>; Fri, 15 Dec 2023 22:02:55 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id 64DD480095; Fri, 15 Dec 2023 22:02:52 +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 cFhOTOqV3X48; Fri, 15 Dec 2023 22:02:51 +0100 (CET) Received: from guix-nuc.home.arpa (unknown [10.192.1.83]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id A7C6A80067; Fri, 15 Dec 2023 22:02:51 +0100 (CET) From: Bruno Victal Date: Fri, 15 Dec 2023 21:02:39 +0000 Message-ID: X-Mailer: git-send-email 2.41.0 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/audio.scm: (string-or-symbol?): Remove unused predicate. [acl, covercache-ttl, http?, host, log-to, uri, script-acl, ssl?, ssl-port, ssl-cert, ssl-key, pin-hash, save-caches?]: Pass file-names via custom serializer procedure. [port, log-level, ssl-port]: Use exact-integer (resp. maybe-exact-integer). (mympd-field-serializer): New procedure, extracted from … (mympd-serialize-configuration): … this. Refactor and rename it to (mympd-configuration->files): … this. (mympd-log-rotation): Restyle. (mympd-service-type): Adjust service-extension to renamed procedure. Use @acronym for description. * doc/guix.texi: Update it. --- doc/guix.texi | 8 +-- gnu/services/audio.scm | 153 ++++++++++++++++++++--------------------- 2 files changed, 78 insertions(+), 83 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 3659d57361..b02a2ad498 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -35013,7 +35013,7 @@ Audio Services @item @code{acl} (type: maybe-mympd-ip-acl) ACL to access the myMPD webserver. -@item @code{covercache-ttl} (default: @code{31}) (type: maybe-integer) +@item @code{covercache-ttl} (default: @code{31}) (type: maybe-exact-integer) How long to keep cached covers, @code{0} disables cover caching. @item @code{http?} (default: @code{#t}) (type: boolean) @@ -35022,10 +35022,10 @@ Audio Services @item @code{host} (default: @code{"[::]"}) (type: string) Host name to listen on. -@item @code{port} (default: @code{80}) (type: maybe-port) +@item @code{port} (default: @code{80}) (type: maybe-exact-integer) HTTP port to listen on. -@item @code{log-level} (default: @code{5}) (type: integer) +@item @code{log-level} (default: @code{5}) (type: exact-integer) How much detail to include in logs, possible values: @code{0} to @code{7}. @@ -35048,7 +35048,7 @@ Audio Services @item @code{ssl?} (default: @code{#f}) (type: boolean) SSL/TLS support. -@item @code{ssl-port} (default: @code{443}) (type: maybe-port) +@item @code{ssl-port} (default: @code{443}) (type: maybe-exact-integer) Port to listen for HTTPS. @item @code{ssl-cert} (type: maybe-string) diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm index 4fcfcc13ea..2a6e1b90df 100644 --- a/gnu/services/audio.scm +++ b/gnu/services/audio.scm @@ -39,6 +39,7 @@ (define-module (gnu services audio) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) #:use-module (srfi srfi-71) + #:use-module (srfi srfi-171) #:export (mpd-output mpd-output? mpd-output-name @@ -686,9 +687,6 @@ (define mpd-service-type ;;; myMPD ;;; -(define (string-or-symbol? x) - (or (symbol? x) (string? x))) - (define-configuration/no-serialization mympd-ip-acl (allow (list-of-strings '()) @@ -698,7 +696,7 @@ (define-configuration/no-serialization mympd-ip-acl (list-of-strings '()) "Disallowed IP addresses.")) -(define-maybe/no-serialization integer) +(define-maybe/no-serialization exact-integer) (define-maybe/no-serialization mympd-ip-acl) (define %mympd-user @@ -749,11 +747,28 @@ (define (mympd-log-to-sanitizer value) value) (_ (configuration-field-error #f 'log-to value)))) -;; XXX: The serialization procedures are insufficient since we require -;; access to multiple fields at once. -;; Fields marked with empty-serializer are never serialized and are -;; used for command-line arguments or by the service definition. -(define-configuration/no-serialization mympd-configuration +(define (mympd-field-serializer file-name) + "Return a procedure that partially serializes the fields of +mympd-configuration as pairs of file-names and file-like objects whose +contents are the serialized values of the fields." + (define serialize-value + (match-lambda + ((? boolean? val) (if val "true" "false")) + ((? integer? val) (number->string val)) + ((? mympd-ip-acl? val) (ip-acl-serialize-configuration val)) + ((? string? val) val))) + + (define (ip-acl-serialize-configuration config) + (string-join + (append + (map (cut string-append "+" <>) (mympd-ip-acl-allow config)) + (map (cut string-append "-" <>) (mympd-ip-acl-deny config))) ",")) + + (lambda (_ field-value) + (cons file-name + (plain-file file-name (serialize-value field-value))))) + +(define-configuration mympd-configuration (package (file-like mympd) "The package object of the myMPD server." @@ -789,27 +804,33 @@ (define-configuration/no-serialization mympd-configuration (acl maybe-mympd-ip-acl - "ACL to access the myMPD webserver.") + "ACL to access the myMPD webserver." + (serializer (mympd-field-serializer "acl"))) (covercache-ttl - (maybe-integer 31) - "How long to keep cached covers, @code{0} disables cover caching.") + (maybe-exact-integer 31) + "How long to keep cached covers, @code{0} disables cover caching." + (serializer (mympd-field-serializer "covercache_keep_days"))) (http? (boolean #t) - "HTTP support.") + "HTTP support." + (serializer (mympd-field-serializer "http"))) (host (string "[::]") - "Host name to listen on.") + "Host name to listen on." + (serializer (mympd-field-serializer "http_host"))) (port - (maybe-port 80) - "HTTP port to listen on.") + (maybe-exact-integer 80) + "HTTP port to listen on." + (serializer (mympd-field-serializer "http_port"))) (log-level - (integer 5) - "How much detail to include in logs, possible values: @code{0} to @code{7}.") + (exact-integer 5) + "How much detail to include in logs, possible values: @code{0} to @code{7}." + (serializer (mympd-field-serializer "loglevel"))) (log-to maybe-string @@ -822,89 +843,64 @@ (define-configuration/no-serialization mympd-configuration (lualibs (maybe-string "all") "See -@url{https://jcorporation.github.io/myMPD/scripting/#lua-standard-libraries}.") +@url{https://jcorporation.github.io/myMPD/scripting/#lua-standard-libraries}." + (serializer (mympd-field-serializer "lualibs"))) (uri maybe-string "Override URI to myMPD. -See @url{https://github.com/jcorporation/myMPD/issues/950}.") +See @url{https://github.com/jcorporation/myMPD/issues/950}." + (serializer (mympd-field-serializer "mympd_uri"))) (script-acl (maybe-mympd-ip-acl (mympd-ip-acl (allow '("127.0.0.1")))) - "ACL to access the myMPD script backend.") + "ACL to access the myMPD script backend." + (serializer (mympd-field-serializer "scriptacl"))) (ssl? (boolean #f) - "SSL/TLS support.") + "SSL/TLS support." + (serializer (mympd-field-serializer "ssl"))) (ssl-port - (maybe-port 443) - "Port to listen for HTTPS.") + (maybe-exact-integer 443) + "Port to listen for HTTPS." + (serializer (mympd-field-serializer "ssl_port"))) (ssl-cert maybe-string - "Path to PEM encoded X.509 SSL/TLS certificate (public key).") + "Path to PEM encoded X.509 SSL/TLS certificate (public key)." + (serializer (mympd-field-serializer "ssl_cert"))) (ssl-key maybe-string - "Path to PEM encoded SSL/TLS private key.") + "Path to PEM encoded SSL/TLS private key." + (serializer (mympd-field-serializer "ssl_key"))) (pin-hash maybe-string "SHA-256 hashed pin used by myMPD to control settings access by -prompting a pin from the user.") +prompting a pin from the user." + (serializer (mympd-field-serializer "pin_hash"))) (save-caches? maybe-boolean - "Whether to preserve caches between service restarts.")) - -(define (mympd-serialize-configuration config) - (define serialize-value - (match-lambda - ((? boolean? val) (if val "true" "false")) - ((? integer? val) (number->string val)) - ((? mympd-ip-acl? val) (ip-acl-serialize-configuration val)) - ((? string? val) val))) - - (define (ip-acl-serialize-configuration config) - (define (serialize-list-of-strings prefix lst) - (map (cut format #f "~a~a" prefix <>) lst)) - (string-join - (append - (serialize-list-of-strings "+" (mympd-ip-acl-allow config)) - (serialize-list-of-strings "-" (mympd-ip-acl-deny config))) ",")) - - ;; myMPD configuration fields are serialized as individual files under - ;; /config/. - (match-record config (work-directory acl - covercache-ttl http? host port - log-level lualibs uri script-acl - ssl? ssl-port ssl-cert ssl-key - pin-hash save-caches?) - (define (serialize-field filename value) - (when (maybe-value-set? value) - (list (format #f "~a/config/~a" work-directory filename) - (mixed-text-file filename (serialize-value value))))) - - (let ((filename-to-field `(("acl" . ,acl) - ("covercache_keep_days" . ,covercache-ttl) - ("http" . ,http?) - ("http_host" . ,host) - ("http_port" . ,port) - ("loglevel" . ,log-level) - ("lualibs" . ,lualibs) - ("mympd_uri" . ,uri) - ("scriptacl" . ,script-acl) - ("ssl" . ,ssl?) - ("ssl_port" . ,ssl-port) - ("ssl_cert" . ,ssl-cert) - ("ssl_key" . ,ssl-key) - ("pin_hash" . ,pin-hash) - ("save_caches" . ,save-caches?)))) - (filter list? - (generic-serialize-alist list serialize-field - filename-to-field))))) + "Whether to preserve caches between service restarts." + (serializer (mympd-field-serializer "save_caches")))) + +(define (mympd-configuration->files config) + (match-record config (work-directory) + (list-transduce + (compose (base-transducer config) + (tmap (match-lambda + ((file-name . file) + ;; myMPD configuration fields are serialized as + ;; individual files under /config/…. + (list (string-append work-directory "/config/" + file-name) + file))))) + rcons mympd-configuration-fields))) (define (mympd-shepherd-service config) (match-record config @@ -957,8 +953,7 @@ (define (mympd-accounts config) (list user group)))) (define (mympd-log-rotation config) - (match-record config - (log-to) + (match-record config (log-to) (if (maybe-value-set? log-to) (list (log-rotation (files (list log-to)))) @@ -973,8 +968,8 @@ (define mympd-service-type (service-extension account-service-type mympd-accounts) (service-extension special-files-service-type - mympd-serialize-configuration) + mympd-configuration->files) (service-extension rottlog-service-type mympd-log-rotation))) - (description "Run myMPD, a frontend for MPD. (Music Player Daemon)") + (description "Run myMPD, a frontend for @acronym{MPD, Music Player Daemon}.") (default-value (mympd-configuration))))