From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 0AlvJdUEGGJDdwAAgWs5BA (envelope-from ) for ; Thu, 24 Feb 2022 23:21:09 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id GNbaItUEGGKwowAA9RJhRA (envelope-from ) for ; Thu, 24 Feb 2022 23:21:09 +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 27F2D410E7 for ; Thu, 24 Feb 2022 23:21:09 +0100 (CET) Received: from localhost ([::1]:56592 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nNMU0-0002SR-8R for larch@yhetil.org; Thu, 24 Feb 2022 17:21:08 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50644) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nNMTu-0002Qd-9T for guix-patches@gnu.org; Thu, 24 Feb 2022 17:21:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:56769) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nNMTt-0000AU-WC for guix-patches@gnu.org; Thu, 24 Feb 2022 17:21:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nNMTt-0007gf-Se for guix-patches@gnu.org; Thu, 24 Feb 2022 17:21:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53676] [PATCH v2 3/4] 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 22:21: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: Maxime Devos Cc: 53676@debbugs.gnu.org Received: via spool by 53676-submit@debbugs.gnu.org id=B53676.164574125829520 (code B ref 53676); Thu, 24 Feb 2022 22:21:01 +0000 Received: (at 53676) by debbugs.gnu.org; 24 Feb 2022 22:20:58 +0000 Received: from localhost ([127.0.0.1]:50666 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nNMTq-0007g4-Hw for submit@debbugs.gnu.org; Thu, 24 Feb 2022 17:20:58 -0500 Received: from mail-qk1-f172.google.com ([209.85.222.172]:33417) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nNMTn-0007fl-Vw for 53676@debbugs.gnu.org; Thu, 24 Feb 2022 17:20:57 -0500 Received: by mail-qk1-f172.google.com with SMTP id bm39so3123611qkb.0 for <53676@debbugs.gnu.org>; Thu, 24 Feb 2022 14:20:56 -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=dqOmnj24gb45Kdgakg/HScFlnC9/SBhfz1UAmZi0dLA=; b=QQ36BIxmvWdrrmQwNkNGpHLzgowU2aOl5/sjEku4WdIMi/67c2G9SFNLnkgyXMwle2 BLS2AtLl02OXzO7MdRn5HEaCR+fAcQcZ8Z40vpTIkDpbgeP9pTtZsX7/YE3wqgEhryCV tKynarxDUBu0oc+cy/wtppCmpYI6mhT13uNvbfZ1zkjCQAaoJcxwci0QgEHtLj47iJRm GPpAiu+MKmDIBznibl0Z7XmFLXIq+Q0vABtDODgl/osKr9UKjcnGR1xwTXRPZCiTOoNj 9GVSN4tjT89/Do+Efcy9cuVrFKY2ukLQd3jIyWHUqb8qpcrLQuUXYSm9WJrvdfSl+aYz xnSQ== 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=dqOmnj24gb45Kdgakg/HScFlnC9/SBhfz1UAmZi0dLA=; b=hmC7fTKmXFw7FTAZN8ZcEUTqLxMCqFUMM1V1lcj4K9kf2w9vXPrYcoX1tr+5RVbt3R FcA0EK3dzGgiTh7XHaSzupS/nuUSP6OIBNHEmPNG2lNYcO+UwzE7x00Zy2ROcucrbctz Ycg26sYpG468gopQYVnLyDCaY2wqaweusSWSUiBZkA1wtFmM6ffZl3qwYnLeEGkpJlP+ 0pLLnlJ4le/scpgIl/iKZmJyYBM1ThlepgbrB3/YfW+ckxyVUDYQa8aW5d6GNum/v894 QNKxcB2n7fVUVfhN1whPesm/4tQT/Ljfzlw6o1B+NECZbBRv0OAghxZnjeigw98jDklh VOsA== X-Gm-Message-State: AOAM533A3GkEsZaNO00Ib0oTgTn4XvH/zPoR3DwCfNx5MXo0nBlybXOA qE0hyjL5uIASWkJMqx/WBZ+RiLMuIRtb5g== X-Google-Smtp-Source: ABdhPJytF665nm9xD/gGI+wqH2PhlQ6A8FEHkP8NSA/TTnESF7OqkvewbXMMeL49cWOeb+nlZ2QXRA== X-Received: by 2002:a05:620a:2812:b0:649:63d5:6151 with SMTP id f18-20020a05620a281200b0064963d56151mr2827960qkp.277.1645741250265; Thu, 24 Feb 2022 14:20:50 -0800 (PST) Received: from hurd (dsl-156-1.b2b2c.ca. [66.158.156.1]) by smtp.gmail.com with ESMTPSA id b6-20020ac87fc6000000b002dea65d1c7dsm401899qtk.47.2022.02.24.14.20.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Feb 2022 14:20:49 -0800 (PST) From: Maxim Cournoyer References: <20220224163828.11330-1-maxim.cournoyer@gmail.com> <20220224163828.11330-3-maxim.cournoyer@gmail.com> <27655b0c24666a93d23800ee74837ea032667432.camel@telenet.be> Date: Thu, 24 Feb 2022 17:20:48 -0500 In-Reply-To: <27655b0c24666a93d23800ee74837ea032667432.camel@telenet.be> (Maxime Devos's message of "Thu, 24 Feb 2022 19:53:34 +0100") Message-ID: <87zgmfzz27.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=1645741269; 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=dqOmnj24gb45Kdgakg/HScFlnC9/SBhfz1UAmZi0dLA=; b=KhRWBSiNkVuLPGcN1HPcgiuEldzoZ/MHu/D8EtZAv/tzD4grjTLwWUqzFYP8aRwMFeR0bG 6f73auAavnhaNccVMtj6d+ME7hBCOrqyQFRd4fsKC31+i1I9nHwNrqPd6WygLIolU4CojZ xC7f6jXH9FEKHlk8SAuYiOAlzQRtQz3tsIHyvOi7ADxf8zgvz5ZyV54OaK+Mr+a4rHVak1 qdB1CbaGlVudE479wq4ABt4oTunM/KRGrMl/MVMkWNzg5w/nIZBqWk+DKwzqAe+Ldah2E0 VM6UZhLUrHzCw1kP1nGy3WI2MZXYp9PV62ccTTkUbslD3myrZXKpUCHoVvMBmQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1645741269; a=rsa-sha256; cv=none; b=sOmylYLc+Nn0MdbZENM7EyRypXIl+FRWM5eVxdF5ibq2lDxTWj2XL29wR9LGpU2fJoSfZg VjUSekYA0nFxjsL44Nnw4hkoz4PZC9KxkAd7OIH3LDVzoLppBemZ7w7ON7ILLkc8RiiZFL Ls9hCDbETjv75VZ4IhcGs2jc93Gq/ktQY13sIJofd1UazvLXVlxKSIMe8RMYqhiLM4wc6p rrMs35H3yVr2MpxLPlznu30xGKReiNE6SnpXgCdGJ6ZOTNqCbGw8XZgbAcN9zmLYXo9+hB 9zf5IuTGLKdk+ExfaMMx2x91wT/HaBGmlO+blt2ASW3ANcvjijM1d8pG5TnUZg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=QQ36BIxm; 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=QQ36BIxm; 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: 27F2D410E7 X-Spam-Score: -2.03 X-Migadu-Scanner: scn1.migadu.com X-TUID: k54sxq1mLNWR Hi Maxime, Maxime Devos writes: > Maxim Cournoyer schreef op do 24-02-2022 om 11:38 [-0500]: >> +=C2=A0 (define (file-like->name file) >> +=C2=A0=C2=A0=C2=A0 (match file >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ((? local-file?) >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (local-file-name file)) >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ((? plain-file?) >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (plain-file-name file)) >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ((? computed-file?) >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (computed-file-name file)) >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (_ (leave (G_ "~a is not a local-file, p= lain-file or \ >> +computed-file object~%") file)))) > > This would not work with things like '(file-append ...)'. > Perhaps 'extra-script-files->file-union' can be made more general > by creating a variant of 'file-union' for this use case? > Maybe something like (untested): > > ;; Based on 'file-union' > (define* (file-directory . files) > ; files: (file-like1 file-like2 ...) > (computed-file name > (with-imported-modules '((guix build utils)) > (gexp > (begin > (use-modules (guix build utils)) > > (mkdir (ungexp output)) > (chdir (ungexp output)) > (ungexp-splicing > (map (lambda (source) > (gexp > (let ((target (basename source)) > ;; Stat the source to abort early if it = does > ;; not exist. > (stat (ungexp source)) > (symlink (ungexp source) (ungexp target)= )))) > files))))))) Not a bad idea, but it steers a bit on the too-complicated side of things for my taste; for one thing, I wouldn't know how to do the validation of the file name anymore (it needs to end by ".pa"). It could be done inside that procedure, but it'd become more tangled. The simple file-like->name procedure above will error with an accurate message telling the users about its limits (that it only accepts local-file, plain-file or computed-file). G-Exp wizards can still opt the mixed-text-file + any G-Exp transformation they wish via the 'script-file' field. Thanks, Maxim