From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id sLqCOrdEIGXPQQEA9RJhRA:P1 (envelope-from ) for ; Fri, 06 Oct 2023 19:32:40 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id sLqCOrdEIGXPQQEA9RJhRA (envelope-from ) for ; Fri, 06 Oct 2023 19:32:40 +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 B523E5F1E5 for ; Fri, 6 Oct 2023 19:32:39 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=planete-kraus.eu header.s=albinoniB header.b="Y /pxeos"; 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"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1696613559; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: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=NuUfw0w0nh23COaWAqFK6M82jB2Jrza0ckM76f9Lifc=; b=ofir2lg6ytzTR6ihvYkQIS+eOZddLCzeSmdMIVhIQQvD8Y2PuASj/GDWns//sl2+g2IOMn jwb+PCN+ErNFujgKD5RaK2W54ftx6xo9juz4pnDqTW7Rl1l1eSkwJoXSoRJK5HUUN1wtEl 9J3UhO5P1GZZGf/qPGRMfoda6IfZMm8S9g4seyNLFy3xdqvXp3DiBTdNKCqpg5udp1xHEZ u3C+VYmDPpetRfNn4b1KVcEjbaj3Pz1vMDrvlKL5dRbDLBPJv7idAluxKRuk/l5HlTep6v N8caV3qiz32HoOpus+PpYo1uhfsocMyHp6cfmFAf6NMDXax2+HEcx/Qm+QKBgg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=planete-kraus.eu header.s=albinoniB header.b="Y /pxeos"; 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"; dmarc=pass (policy=none) header.from=gnu.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1696613559; a=rsa-sha256; cv=none; b=KVVuzKSURbAlPhCNEP2Fhst99xRSgEEJh9m+HmxHoDkCAUkJKYUvY7QkJ+WrQX+zHIHyyq dM5ecRLpCd5ZSAUr27+ekXZZnrL5CdXKupamfqEpbjTVNjNMCZJabtu/u3lf+i52hDXbCV pDnDb3JXKpDtYnK2vNtldNervLxyvH3uHDKjpsdVvQMVri2Q7oTy2tbVKJ+OHKn+OxPGsq Y/oAnHnqlO0rFjb0K9SuE1IEIma+j4FCQQGqPU2x9HDLhIaPTFVN5WcWfQvyIn9FD+zBRK ibNm94bxsKZlDNfnfpUFVSVDFkFXl8zRLx2JYdw5retF1PMgDnecS57oC8LTnQ== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qoogK-0006rC-QU; Fri, 06 Oct 2023 13:32:08 -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 1qoofx-0006l7-AS for guix-patches@gnu.org; Fri, 06 Oct 2023 13:31:45 -0400 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 1qoofx-0006YY-1o for guix-patches@gnu.org; Fri, 06 Oct 2023 13:31:45 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qoogF-0000Wr-Uk for guix-patches@gnu.org; Fri, 06 Oct 2023 13:32:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#66099] [PATCH gnome-team v8 3/6] services: udev: Make udev-rule helper functions generic. Resent-From: Vivien Kraus Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 06 Oct 2023 17:32:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66099 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Liliana Marie Prikler , Maxim Cournoyer , 66099@debbugs.gnu.org Cc: rg@raghavgururajan.name Received: via spool by 66099-submit@debbugs.gnu.org id=B66099.16966135071965 (code B ref 66099); Fri, 06 Oct 2023 17:32:03 +0000 Received: (at 66099) by debbugs.gnu.org; 6 Oct 2023 17:31:47 +0000 Received: from localhost ([127.0.0.1]:52571 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qoofy-0000Vc-DO for submit@debbugs.gnu.org; Fri, 06 Oct 2023 13:31:46 -0400 Received: from planete-kraus.eu ([89.234.140.182]:43846) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qoofv-0000UU-Tg for 66099@debbugs.gnu.org; Fri, 06 Oct 2023 13:31:44 -0400 Received: from planete-kraus.eu (localhost.lan [127.0.0.1]) by planete-kraus.eu (OpenSMTPD) with ESMTP id 9f195b6a; Fri, 6 Oct 2023 17:31:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=planete-kraus.eu; h= message-id:in-reply-to:references:from:date:subject:to:cc :mime-version; s=albinoniB; bh=rJOSnSnmweLGN0RaufMBzY2kw/Q=; b=Y /pxeosNk8SyPbm3asKbH+M0TaLZCZ5cyzdmRZXxv2d/3pzZ6HGOunVrU6q7mK//V ny+Zjd5wOdaV8XfslKD35CLtj93qcCSMt9Pfs05ma+ty60wvvKSJhABAbymvfP55 JOidjeQZ+XVXH2cdQfpqDiei+kxzLfRLBALdFnZO6fyam0683q1TJ/wCWZPl6p/y opZAziOve6GsAx/EULrqX8RXf+iGLzqdcyc7syepIgmJqw5xZEOf8AMx/3imOrgT cVXgHQ81IqV4E9cMjLmcZeM5P+1usDLTV0vzmWbysrhMNIcATCu86pnLBa2eS9KJ J2rGTwOZQbSpjKLWXX3qw== Received: by planete-kraus.eu (OpenSMTPD) with ESMTPSA id bafbb626 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); Fri, 6 Oct 2023 17:31:23 +0000 (UTC) Message-ID: <1e9635cac8aa08da17be6f1270552e3f4dfbdd40.1696610746.git.vivien@planete-kraus.eu> In-Reply-To: References: <0825bf42daa34ee464c5237b04ad6bf90942e489.camel@gmail.com>, , <1a1089275d13e02b4485c5de6e908ece88f5d2b6.camel@gmail.com><87y1ghryel.fsf@gmail.com>, <87pm1try6q.fsf@gmail.com>, <87lechrvhl.fsf@gmail.com> Date: Thu, 5 Oct 2023 19:24:56 +0200 MIME-Version: 1.0 User-Agent: Evolution 3.46.4 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: , Reply-to: Vivien Kraus X-ACL-Warn: , Vivien Kraus via Guix-patches From: Vivien Kraus via Guix-patches via Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Scanner: mx1.migadu.com X-Migadu-Spam-Score: -4.24 X-Spam-Score: -4.24 X-Migadu-Queue-Id: B523E5F1E5 X-TUID: tQu/FwePaxC3 * gnu/services/base.scm (udev-configurations-union): New function. (udev-configuration-file): New function, use file->udev-configuration-file. (file->udev-configuration-file): New function. (udev-rules-union): Use udev-configurations-union. (udev-rule): Use udev-configuration-file. (file->udev-rule): Use file->udev-configuration-file. --- gnu/services/base.scm | 50 +++++++++++++++++++++++++++++-------------- 1 file changed, 34 insertions(+), 16 deletions(-) diff --git a/gnu/services/base.scm b/gnu/services/base.scm index 30372bf1b5..0bf0568a4e 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -2184,9 +2184,9 @@ (define-record-type* (rules udev-configuration-rules ;list of file-like (default '()))) -(define (udev-rules-union packages) - "Return the union of the @code{lib/udev/rules.d} directories found in each -item of @var{packages}." +(define (udev-configurations-union subdirectory packages) + "Return the union of the lib/udev/SUBDIRECTORY.d directories found in each +item of PACKAGES." (define build (with-imported-modules '((guix build union) (guix build utils)) @@ -2197,39 +2197,57 @@ (define (udev-rules-union packages) (srfi srfi-26)) (define %standard-locations - '("/lib/udev/rules.d" "/libexec/udev/rules.d")) + '(#$(string-append "/lib/udev/" subdirectory ".d") + #$(string-append "/libexec/udev/" subdirectory ".d"))) - (define (rules-sub-directory directory) - ;; Return the sub-directory of DIRECTORY containing udev rules, or - ;; #f if none was found. + (define (configuration-sub-directory directory) + ;; Return the sub-directory of DIRECTORY containing udev + ;; configurations, or #f if none was found. (find directory-exists? (map (cut string-append directory <>) %standard-locations))) (union-build #$output - (filter-map rules-sub-directory '#$packages))))) + (filter-map configuration-sub-directory '#$packages))))) + + (computed-file (string-append "udev-" subdirectory) build)) - (computed-file "udev-rules" build)) +(define (udev-rules-union packages) + "Return the union of the lib/udev/rules.d directories found in each +item of PACKAGES." + (udev-configurations-union "rules" packages)) + +(define (udev-configuration-file subdirectory file-name contents) + "Return a directory with a udev configuration file FILE-NAME containing CONTENTS." + (file->udev-configuration-file subdirectory file-name (plain-file file-name contents))) (define (udev-rule file-name contents) "Return a directory with a udev rule file FILE-NAME containing CONTENTS." - (file->udev-rule file-name (plain-file file-name contents))) + (udev-configuration-file "rules" file-name contents)) -(define (file->udev-rule file-name file) - "Return a directory with a udev rule file FILE-NAME which is a copy of FILE." +(define (file->udev-configuration-file subdirectory file-name file) + "Return a directory with a udev configuration file FILE-NAME which is a copy + of FILE." (computed-file file-name (with-imported-modules '((guix build utils)) #~(begin (use-modules (guix build utils)) - (define rules.d - (string-append #$output "/lib/udev/rules.d")) + (define conf.d + (string-append #$output + "/lib/udev/" + #$subdirectory + ".d")) (define file-copy-dest - (string-append rules.d "/" #$file-name)) + (string-append conf.d "/" #$file-name)) - (mkdir-p rules.d) + (mkdir-p conf.d) (copy-file #$file file-copy-dest))))) +(define (file->udev-rule file-name file) + "Return a directory with a udev rule file FILE-NAME which is a copy of FILE." + (file->udev-configuration-file "rules" file-name file)) + (define kvm-udev-rule ;; Return a directory with a udev rule that changes the group of /dev/kvm to ;; "kvm" and makes it #o660. Apparently QEMU-KVM used to ship this rule, -- 2.41.0