From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id CH8NBwiyF2I/MAEAgWs5BA (envelope-from ) for ; Thu, 24 Feb 2022 17:27:52 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id MEFxOweyF2JQ5wAAG6o9tA (envelope-from ) for ; Thu, 24 Feb 2022 17:27:51 +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 63DA02A636 for ; Thu, 24 Feb 2022 17:27:51 +0100 (CET) Received: from localhost ([::1]:33226 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nNGy6-0001Cp-GH for larch@yhetil.org; Thu, 24 Feb 2022 11:27:50 -0500 Received: from eggs.gnu.org ([209.51.188.92]:51010) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nNGwM-00085p-8u for guix-patches@gnu.org; Thu, 24 Feb 2022 11:26:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:56336) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nNGwL-0006lI-Uu for guix-patches@gnu.org; Thu, 24 Feb 2022 11:26:01 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nNGwL-0002V8-OU for guix-patches@gnu.org; Thu, 24 Feb 2022 11:26:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53676] [PATCH 4/5] services: pulseaudio: Add an extra-script-files configuration field. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 24 Feb 2022 16:26:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53676 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Liliana Marie Prikler Cc: 53676@debbugs.gnu.org Received: via spool by 53676-submit@debbugs.gnu.org id=B53676.16457199139552 (code B ref 53676); Thu, 24 Feb 2022 16:26:01 +0000 Received: (at 53676) by debbugs.gnu.org; 24 Feb 2022 16:25:13 +0000 Received: from localhost ([127.0.0.1]:50233 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nNGvY-0002U0-Tr for submit@debbugs.gnu.org; Thu, 24 Feb 2022 11:25:13 -0500 Received: from mail-qv1-f50.google.com ([209.85.219.50]:35687) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nNGvX-0002Tg-3g for 53676@debbugs.gnu.org; Thu, 24 Feb 2022 11:25:11 -0500 Received: by mail-qv1-f50.google.com with SMTP id 8so4495729qvf.2 for <53676@debbugs.gnu.org>; Thu, 24 Feb 2022 08:25:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=y/nicHGhJRl9eRolkeLC27HQVxzu8HBQYLFGePJcqiA=; b=XebcqwGxXyJo3o/6RymZMOnNfRHCvA0QW+LSVIenIHQ8QjXx6QD9XmZE+lXbUFditG ml90ckq92nacDat+hbY+XciEi8u01wQ54xyLhXDaSMOfwWy80uHqORCJ0znhNGMpxptd 5nWd7zP0KzvW1UbeRnhfhCRHEelrUygZPr95cvLs3uNdu2MzxPbGyAl1/LU84CBBnqNm vuAyoI1HdwhG+RM5y7DJ8TAoH7pl7/pnmDjdB0vpoX790PzDDoY27BtPZxAVQuw+Uujw pUcye6/ewKbMkCneVdrNiJlF7oBsW8t4deeERV9B5Y16UlZ1zSGL2rST25hgChmGkMN+ x6kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=y/nicHGhJRl9eRolkeLC27HQVxzu8HBQYLFGePJcqiA=; b=xW+kVemgS4cpOdHFlRg9WiGQzpr+Z/p9xCnwTSFMSpvtVl/QHRpphGLTOvf/yFpMet bBkRfnYJ4BCgoFOK7AnxlhhuvphQyHr4k9VvBfXhbHWbjGA0HhIXShg71Y49T4TTqAEn Nfi6QSzgV/inbKkNlUAsYwXGXwcyStwEtdmgCh+cAMbC3PGic/6KBKT7RkrNQMcjLeOZ mbT2Hj7tBvsQWYWwFKm3Vy7oN1UG3KF073Tr3JoiffZkKMxI4ZbQkzWYCS3lPkBJg6OO 9KylACOjaJdz4VaamaVYve1apYSBGMB9nKUHQAYim4dnazmw6P/+CRu2fkjPP3bq+ONs eUQA== X-Gm-Message-State: AOAM533t8OVMl9KXmN4OwDPVumRXApudxZzTkw4pe/K6TrvFqJNMzxli /JxK7fxaoqYJVfWBIwyRM40KAXAZYaYpWQ== X-Google-Smtp-Source: ABdhPJzOEG/g6OrElnlGnWtSgQqW/8DUO7fPS7+vpGr6rYQ6QZXuk7jGuhnjhRyhvR+r+7RVf8MSeA== X-Received: by 2002:ad4:564b:0:b0:42c:3cdb:16c7 with SMTP id bl11-20020ad4564b000000b0042c3cdb16c7mr2693321qvb.86.1645719905093; Thu, 24 Feb 2022 08:25:05 -0800 (PST) Received: from hurd (dsl-156-1.b2b2c.ca. [66.158.156.1]) by smtp.gmail.com with ESMTPSA id c7sm1615135qtp.61.2022.02.24.08.25.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Feb 2022 08:25:04 -0800 (PST) From: Maxim Cournoyer References: <20220201041933.16603-1-maxim.cournoyer@gmail.com> <20220201041933.16603-4-maxim.cournoyer@gmail.com> <97111754acacc576aec4eb55889a32474fe71f95.camel@gmail.com> <871r0m1gdy.fsf@gmail.com> <3c9845d7b893dddcd44be41d2ee475c29d9f5a85.camel@gmail.com> <87o83qyltg.fsf@gmail.com> <2b8017576ee2570fd38ab61729556e31694b2552.camel@gmail.com> <87czk01mp8.fsf@gmail.com> Date: Thu, 24 Feb 2022 11:25:03 -0500 In-Reply-To: (Liliana Marie Prikler's message of "Sun, 06 Feb 2022 09:02:22 +0100") Message-ID: <874k4ojkps.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1645720071; 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:dkim-signature; bh=y/nicHGhJRl9eRolkeLC27HQVxzu8HBQYLFGePJcqiA=; b=rlYEtIjg8yiwryUVTaQ88f7feDoAQRXDN8/DBJUJJZY/UXgi9rxI5PYFLedYNNYQOePFU3 QKwQkB3vFHSBF7VVxiflZ442XOQYzi/iMxyi1ibjaDmQHlUeVDEdaPu6Vs3/tu4eRZKt/K wRYlVtKXqd3O46c2dlmfDmcoidGWZ5HxocSI5a8BdlsNToAjOmBTr7kyqWy+oZ7Kckt2c2 24mR4uAXWvNxUXkDXjV1naSM7vYE5MPcfDQ5oKYCAxGflSdSRGu7CtTXIvcVxsHb/aamEN CtVT5G0dBz+88YKna0KiCyjKRSmVpOsjIk1huzoxocOWOfFaSXVppiJcUwX7ZA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1645720071; a=rsa-sha256; cv=none; b=nA5Hz9i1bv6CG27nHfg3ZBo46CTsjowa2O7ILerT4emgIXlOxoT1fvh6mJXiyFGE8zD5JZ LBxPSQOwJMsC/L19gxYJd1A6rjV3XirSX9aO9eXR4QMu7FbohuC1HN9Sbe9IQmJoAbzNrW I4LP+lXiQn3bYN8IS5Y4mzA17j0HmFkmsuJB9//Pf7kOIcPDOAM8GKHYu1reJSGtYCSVsd iCr8IrQyXmwqJbjTwYkkJDehTZdC6CacQUR5hMIMyMGBvA4bkO4XtZ5SMw88tM8p9qFsMM ig9wkIbGYBOX7oQAlNzuPnBOpNvmwkMb78VdbOPAMZAat5Rqv6AtvcKwDIS4hg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=XebcqwGx; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=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-Spam-Score: -2.03 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=XebcqwGx; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=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-Queue-Id: 63DA02A636 X-Spam-Score: -2.03 X-Migadu-Scanner: scn0.migadu.com X-TUID: oZkbhaelM6t+ Hi Liliana, Liliana Marie Prikler writes: [...] > Note that file-like->name serves multiple duties here. In my opinion > it'd be better to > > (define (file-like-name file) > ((match file > ((? local-file?) local-file-name) > =C2=A0((? plain-file?) plain-file-name) > =C2=A0((? computed-file?) computed-file-name) > [...] > (_ (const #f))) ; alternatively raise an error > file)) > > That at least decouples it from the burden of having to check whether > it is a valid pulseaudio script file name, which makes it reusable > elsewhere. I've modified it like so: --8<---------------cut here---------------start------------->8--- modified gnu/services/sound.scm @@ -154,21 +154,24 @@ (define (extra-script-files->file-union extra-script-= files) "Return a G-exp obtained by processing EXTRA-SCRIPT-FILES with FILE-UNIO= N." (define (file-like->name file) - (let ((name (match file - ((? local-file?) - (local-file-name file)) - ((? plain-file?) - (plain-file-name file)) - ((? computed-file?) - (computed-file-name file)) - (_ (leave (G_ "~a is not a local-file, plain-file or \ -computed-file object~%") file))))) - (unless (string-suffix? ".pa" name) - (leave (G_ "`~a' lacks the required `.pa' file name extension~%") - name)) - name)) - - (let ((labels (map file-like->name extra-script-files))) + (match file + ((? local-file?) + (local-file-name file)) + ((? plain-file?) + (plain-file-name file)) + ((? computed-file?) + (computed-file-name file)) + (_ (leave (G_ "~a is not a local-file, plain-file or \ +computed-file object~%") file)))) + + (define (assert-pulseaudio-script-file-name name) + (unless (string-suffix? ".pa" name) + (leave (G_ "`~a' lacks the required `.pa' file name extension~%") na= me)) + name) + + (let ((labels (map (compose assert-pulseaudio-script-file-name) + file-like->name + extra-script-files))) (file-union "default.pa.d" (zip labels extra-script-files)))) --8<---------------cut here---------------end--------------->8--- Thanks for the suggestion. I'll be sending a v2 series soon. Maxim