all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Vivien Kraus via Guix-patches via <guix-patches@gnu.org>
To: Maxim Cournoyer <maxim.cournoyer@gmail.com>,
	Liliana Marie Prikler <liliana.prikler@gmail.com>,
	66099@debbugs.gnu.org
Cc: rg@raghavgururajan.name
Subject: [bug#66099] [PATCH gnome-team v10 3/6] services: udev: Make udev-rule helper functions generic.
Date: Thu, 5 Oct 2023 19:24:56 +0200	[thread overview]
Message-ID: <cd08e1b6a17aba5bccf8d745f24d75026629d078.1696966139.git.vivien@planete-kraus.eu> (raw)
In-Reply-To: <70ae450282e2411c5506447c79adf6a62345344c.1696966139.git.vivien@planete-kraus.eu>

* 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 8b54f30ef6..10e7383475 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -2234,9 +2234,9 @@ (define-record-type* <udev-configuration>
   (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))
@@ -2247,39 +2247,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 configuration-directory
+                         (string-append #$output
+                                        "/lib/udev/"
+                                        #$subdirectory
+                                        ".d"))
 
                        (define file-copy-dest
-                         (string-append rules.d "/" #$file-name))
+                         (string-append configuration-directory "/" #$file-name))
 
-                       (mkdir-p rules.d)
+                       (mkdir-p configuration-directory)
                        (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




  reply	other threads:[~2023-10-10 19:34 UTC|newest]

Thread overview: 91+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-19 11:35 [bug#66099] [PATCH gnome-team 0/3] Update upower Vivien Kraus via Guix-patches via
2023-09-19 11:23 ` [bug#66099] [PATCH gnome-team 1/3] gnu: eudev: Update libudev version to 251 Vivien Kraus via Guix-patches via
2023-09-19 11:32 ` [bug#66099] [PATCH gnome-team 2/3] gnu: libgudev: Update to 238 Vivien Kraus via Guix-patches via
2023-09-19 11:32 ` [bug#66099] [PATCH gnome-team 3/3] gnu: upower: Update to 1.90.2 Vivien Kraus via Guix-patches via
2023-09-19 15:51   ` Vivien Kraus via Guix-patches via
2023-09-21 17:06 ` [bug#66099] [PATCH gnome-team 0/3] Update upower Liliana Marie Prikler
2023-09-21 21:05   ` Vivien Kraus via Guix-patches via
2023-09-21 22:03     ` Vivien Kraus via Guix-patches via
2023-09-22  4:22       ` Liliana Marie Prikler
2023-09-30 10:43         ` [bug#66099] [WIP PATCH gnome-team v2 0/3] Nicer eudev, upower still fails Vivien Kraus via Guix-patches via
2023-09-19 11:23           ` [bug#66099] [WIP PATCH gnome-team v2 1/3] gnu: eudev: Update libudev version to 251 Vivien Kraus via Guix-patches via
2023-09-19 11:32           ` [bug#66099] [WIP PATCH gnome-team v2 2/3] gnu: libgudev: Update to 238 Vivien Kraus via Guix-patches via
2023-09-19 11:32           ` [bug#66099] [WIP PATCH gnome-team v2 3/3] gnu: upower: Update to 1.90.2 Vivien Kraus via Guix-patches via
2023-09-30 14:20         ` [bug#66099] [PATCH gnome-team v3 0/3] Update eudev and upower Vivien Kraus via Guix-patches via
2023-09-19 11:23           ` [bug#66099] [PATCH gnome-team v3 1/3] gnu: eudev: Update libudev version to 251 Vivien Kraus via Guix-patches via
2023-09-30 17:59             ` Liliana Marie Prikler
2023-10-01 22:02             ` Maxim Cournoyer
2023-10-02 17:02               ` Liliana Marie Prikler
2023-09-19 11:32           ` [bug#66099] [PATCH gnome-team v3 2/3] gnu: libgudev: Update to 238 Vivien Kraus via Guix-patches via
2023-10-01 20:32             ` Maxim Cournoyer
2023-09-19 11:32           ` [bug#66099] [PATCH gnome-team v3 3/3] gnu: upower: Update to 1.90.2 Vivien Kraus via Guix-patches via
2023-10-01 20:20 ` [bug#66099] [PATCH gnome-team v4 0/4] Update eudev and upower Vivien Kraus via Guix-patches via
2023-09-19 11:23   ` [bug#66099] [PATCH gnome-team v4 1/4] gnu: eudev: Update libudev version to 251 Vivien Kraus via Guix-patches via
2023-10-02 17:12     ` Liliana Marie Prikler
2023-10-02 19:33       ` Vivien Kraus via Guix-patches via
2023-10-04  1:00         ` Maxim Cournoyer
2023-09-19 11:32   ` [bug#66099] [PATCH gnome-team v4 3/4] gnu: libgudev: Update to 238 Vivien Kraus via Guix-patches via
2023-09-19 11:32   ` [bug#66099] [PATCH gnome-team v4 4/4] gnu: upower: Update to 1.90.2 Vivien Kraus via Guix-patches via
2023-10-02 17:17     ` Liliana Marie Prikler
2023-10-04 10:00       ` [bug#66099] [PATCH gnome-team v5 0/4] Update eudev and udev-service-type Vivien Kraus via Guix-patches via
2023-09-19 11:23         ` [bug#66099] [PATCH gnome-team v5 1/4] gnu: eudev: Update libudev version to 251 Vivien Kraus via Guix-patches via
2023-09-19 11:32         ` [bug#66099] [PATCH gnome-team v5 3/4] gnu: libgudev: Update to 238 Vivien Kraus via Guix-patches via
2023-09-19 11:32         ` [bug#66099] [PATCH gnome-team v5 4/4] gnu: upower: Update to 1.90.2 Vivien Kraus via Guix-patches via
2023-10-02 19:08         ` [bug#66099] [PATCH gnome-team v5 2/4] gnu: udev-service-type: accept hwdb file extensions Vivien Kraus via Guix-patches via
2023-10-04 16:52           ` Liliana Marie Prikler
2023-10-04 21:37             ` [bug#66099] [PATCH gnome-team v6 0/5] Update eudev, udev-service-type, upower Vivien Kraus via Guix-patches via
2023-09-19 11:23               ` [bug#66099] [PATCH gnome-team v6 1/5] gnu: eudev: Update libudev version to 251 Vivien Kraus via Guix-patches via
2023-10-05  4:50                 ` Liliana Marie Prikler
2023-10-05  5:04                   ` [bug#66099] [PATCH gnome-team v7 0/5] Update eudev with a snippet, udev-service-type, upower Vivien Kraus via Guix-patches via
2023-09-19 11:23                     ` [bug#66099] [PATCH gnome-team v7 1/5] gnu: eudev: Update libudev version to 251 Vivien Kraus via Guix-patches via
2023-10-05 13:28                       ` Maxim Cournoyer
2023-09-19 11:32                     ` [bug#66099] [PATCH gnome-team v7 4/5] gnu: libgudev: Update to 238 Vivien Kraus via Guix-patches via
2023-10-05 14:32                       ` Maxim Cournoyer
2023-09-19 11:32                     ` [bug#66099] [PATCH gnome-team v7 5/5] gnu: upower: Update to 1.90.2 Vivien Kraus via Guix-patches via
2023-10-05 14:35                       ` Maxim Cournoyer
2023-10-02 19:08                     ` [bug#66099] [PATCH gnome-team v7 3/5] gnu: udev-service-type: accept hwdb file extensions Vivien Kraus via Guix-patches via
2023-10-05 14:31                       ` Maxim Cournoyer
2023-10-06 16:45                         ` [bug#66099] [PATCH gnome-team v8 0/6] Update eudev, udev-service-type, upower Vivien Kraus via Guix-patches via
2023-09-19 11:23                           ` [bug#66099] [PATCH gnome-team v8 1/6] gnu: eudev: Update to 3.2.14 Vivien Kraus via Guix-patches via
2023-10-06 18:35                             ` Liliana Marie Prikler
2023-09-19 11:32                           ` [bug#66099] [PATCH gnome-team v8 5/6] gnu: libgudev: Update to 238 Vivien Kraus via Guix-patches via
2023-09-19 11:32                           ` [bug#66099] [PATCH gnome-team v8 6/6] gnu: upower: Update to 1.90.2 Vivien Kraus via Guix-patches via
2023-10-06 18:48                             ` Liliana Marie Prikler
2023-10-02 19:08                           ` [bug#66099] [PATCH gnome-team v8 4/6] gnu: udev-service-type: accept hardware description file extensions Vivien Kraus via Guix-patches via
2023-10-06 18:42                             ` Liliana Marie Prikler
2023-10-05 17:24                           ` [bug#66099] [PATCH gnome-team v8 3/6] services: udev: Make udev-rule helper functions generic Vivien Kraus via Guix-patches via
2023-10-07 14:45                             ` Maxim Cournoyer
2023-10-08 10:49                               ` [bug#66099] [PATCH gnome-team v9 0/7] Update eudev, upower, udev-service-type, with /lib/udev/hardware Vivien Kraus via Guix-patches via
2023-09-19 11:23                                 ` [bug#66099] [PATCH gnome-team v9 1/7] gnu: eudev: Update to 3.2.14 Vivien Kraus via Guix-patches via
2023-09-19 11:32                                 ` [bug#66099] [PATCH gnome-team v9 5/7] gnu: libgudev: Update to 238 Vivien Kraus via Guix-patches via
2023-09-19 11:32                                 ` [bug#66099] [PATCH gnome-team v9 6/7] gnu: upower: Update to 1.90.2 Vivien Kraus via Guix-patches via
2023-10-02 19:08                                 ` [bug#66099] [PATCH gnome-team v9 4/7] gnu: udev-service-type: accept hardware description file extensions Vivien Kraus via Guix-patches via
2023-10-05 17:24                                 ` [bug#66099] [PATCH gnome-team v9 3/7] services: udev: Make udev-rule helper functions generic Vivien Kraus via Guix-patches via
2023-10-05 17:33                                 ` [bug#66099] [PATCH gnome-team v9 2/7] services: udev: Rewrite udev-rule to use file->udev-rule Vivien Kraus via Guix-patches via
2023-10-08 10:00                                 ` [bug#66099] [PATCH gnome-team v9 7/7] services: udev: Install hardware files in /lib/udev/hardware Vivien Kraus via Guix-patches via
2023-10-08 12:28                                   ` Maxim Cournoyer
2023-10-10 19:28                                     ` [bug#66099] [PATCH gnome-team v10 0/6] Exact same, without the last patch Vivien Kraus via Guix-patches via
2023-09-19 11:23                                       ` [bug#66099] [PATCH gnome-team v10 1/6] gnu: eudev: Update to 3.2.14 Vivien Kraus via Guix-patches via
2023-10-05 17:33                                         ` [bug#66099] [PATCH gnome-team v10 2/6] services: udev: Rewrite udev-rule to use file->udev-rule Vivien Kraus via Guix-patches via
2023-10-05 17:24                                           ` Vivien Kraus via Guix-patches via [this message]
2023-10-02 19:08                                             ` [bug#66099] [PATCH gnome-team v10 4/6] gnu: udev-service-type: accept hardware description file extensions Vivien Kraus via Guix-patches via
2023-09-19 11:32                                               ` [bug#66099] [PATCH gnome-team v10 5/6] gnu: libgudev: Update to 238 Vivien Kraus via Guix-patches via
2023-09-19 11:32                                                 ` [bug#66099] [PATCH gnome-team v10 6/6] gnu: upower: Update to 1.90.2 Vivien Kraus via Guix-patches via
2023-10-10 23:44                                       ` [bug#66099] [PATCH gnome-team v10 0/6] Exact same, without the last patch Maxim Cournoyer
2023-10-11  4:18                                         ` bug#66099: " Liliana Marie Prikler
2023-10-08 12:27                                 ` [bug#66099] [PATCH gnome-team v9 0/7] Update eudev, upower, udev-service-type, with /lib/udev/hardware Maxim Cournoyer
2023-10-08 12:33                                   ` Vivien Kraus via Guix-patches via
2023-10-05 17:33                           ` [bug#66099] [PATCH gnome-team v8 2/6] services: udev: Rewrite udev-rule to use file->udev-rule Vivien Kraus via Guix-patches via
2023-10-06 18:23                           ` [bug#66099] [PATCH gnome-team v8 0/6] Update eudev, udev-service-type, upower Liliana Marie Prikler
2023-10-04 21:05                     ` [bug#66099] [PATCH gnome-team v7 2/5] services: udev: unify udev-rule and file->udev-rule Vivien Kraus via Guix-patches via
2023-10-05 13:30                       ` Maxim Cournoyer
2023-10-05 13:33                       ` Maxim Cournoyer
2023-10-05  5:54                     ` [bug#66099] [PATCH gnome-team v7 0/5] Update eudev with a snippet, udev-service-type, upower Liliana Marie Prikler
2023-09-19 11:32               ` [bug#66099] [PATCH gnome-team v6 4/5] gnu: libgudev: Update to 238 Vivien Kraus via Guix-patches via
2023-09-19 11:32               ` [bug#66099] [PATCH gnome-team v6 5/5] gnu: upower: Update to 1.90.2 Vivien Kraus via Guix-patches via
2023-10-02 19:08               ` [bug#66099] [PATCH gnome-team v6 3/5] gnu: udev-service-type: accept hwdb file extensions Vivien Kraus via Guix-patches via
2023-10-05  5:42                 ` Liliana Marie Prikler
2023-10-05  5:55                   ` Vivien Kraus via Guix-patches via
2023-10-05  6:53                     ` Liliana Marie Prikler
2023-10-04 21:05               ` [bug#66099] [PATCH gnome-team v6 2/5] services: udev: unify udev-rule and file->udev-rule Vivien Kraus via Guix-patches via
2023-09-30 19:32   ` [bug#66099] [PATCH gnome-team v4 2/4] guix: Add udev-hwdb-bin profile hook Vivien Kraus via Guix-patches via

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cd08e1b6a17aba5bccf8d745f24d75026629d078.1696966139.git.vivien@planete-kraus.eu \
    --to=guix-patches@gnu.org \
    --cc=66099@debbugs.gnu.org \
    --cc=liliana.prikler@gmail.com \
    --cc=maxim.cournoyer@gmail.com \
    --cc=rg@raghavgururajan.name \
    --cc=vivien@planete-kraus.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.