unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#66099] [PATCH gnome-team 1/3] gnu: eudev: Update libudev version to 251.
  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 ` 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
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-09-19 11:23 UTC (permalink / raw)
  To: 66099; +Cc: liliana.prikler, maxim.cournoyer, rg

Support for version 251 is only provided as a merge request for now:

https://github.com/eudev-project/eudev/pull/253

This merge request bumps the eudev version to 3.2.14, but it has not been
released yet.

The udevadm command to generate the hwdb.bin file now looks at file under
/lib/udev/hwdb.d, and generates /lib/udev/hwdb.bin. The intention is not to
touch /etc so that users can supply their own files. The steps to generate the
file are:

1. Copy /etc/udev/hwdb.d to /lib/udev/hwdb.d to accept all files from eudev;
2. Generate /lib/udev/hwdb.bin from /lib/udev/hwdb.d (by passing --usr to the
udevadm command-line) − if not cross-compiling;
3. Copy /lib/udev/hwdb.bin to /etc/udev − if not cross-compiling.

Point 1. is dealt with in a new phase, and points 2. and 3. are dealt with in
the 'build-hwdb phase.

* gnu/packages/linux.scm (eudev): Update to v3.2.12, but bump version to
3.2.14.beta.
[#:phases] <allow-eudev-hwdb>: New phase.
<build-hwdb>: Update accordingly.
* gnu/packages/patches/eudev-bump-to-251.patch: New file.
* gnu/packages/linux.scm (eudev): Use it here.
* gnu/local.mk (dist_patch_DATA): Register it here.
---
 gnu/local.mk                                 |   1 +
 gnu/packages/linux.scm                       |  22 ++-
 gnu/packages/patches/eudev-bump-to-251.patch | 134 +++++++++++++++++++
 3 files changed, 151 insertions(+), 6 deletions(-)
 create mode 100644 gnu/packages/patches/eudev-bump-to-251.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index db21feb507..8b9365055d 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1122,6 +1122,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/esmini-use-pkgconfig.patch		\
   %D%/packages/patches/esmtp-add-lesmtp.patch		\
   %D%/packages/patches/eudev-rules-directory.patch		\
+  %D%/packages/patches/eudev-bump-to-251.patch		\
   %D%/packages/patches/evdi-fix-build-with-linux-6.2.patch	\
   %D%/packages/patches/exercism-disable-self-update.patch	\
   %D%/packages/patches/extempore-unbundle-external-dependencies.patch	\
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 91109c41d9..2cad9cbbe9 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -4225,16 +4225,17 @@ (define-public eudev
   ;; The post-systemd fork, maintained by Gentoo.
   (package
     (name "eudev")
-    (version "3.2.11")
+    (version "3.2.14.beta")
     (source (origin
               (method git-fetch)
               (uri (git-reference (url "https://github.com/gentoo/eudev")
-                                  (commit (string-append "v" version))))
+                                  (commit "v3.2.12")))
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "0dzaqwjnl55f69ird57wb6skahc6l7zs1slsrzqqfhww33icp6av"))
-              (patches (search-patches "eudev-rules-directory.patch"))))
+                "0wpckjxzsb4wkj3pwnw14zmp3z8ivf03hjbgs838q5gfridpxnf7"))
+              (patches (search-patches "eudev-rules-directory.patch"
+                                       "eudev-bump-to-251.patch"))))
     (build-system gnu-build-system)
     (arguments
      (list
@@ -4257,7 +4258,14 @@ (define-public eudev
                 (substitute* (string-append #$output "/lib/libudev.la")
                   (("old_library=.*")
                    "old_library=''\n")))))
-          (add-after 'install 'build-hwdb
+          (add-after 'install 'allow-eudev-hwdb
+            (lambda _
+              ;; eudev distributes the hwdb, but each file has to be enabled
+              ;; by being copied under /lib/udev/hwdb.d. We accept all of
+              ;; them.
+              (symlink (string-append #$output "/etc/udev/hwdb.d")
+                       (string-append #$output "/lib/udev/hwdb.d"))))
+          (add-after 'allow-eudev-hwdb 'build-hwdb
             (lambda _
               ;; Build OUT/etc/udev/hwdb.bin.  This allows 'lsusb' and
               ;; similar tools to display product names.
@@ -4267,7 +4275,9 @@ (define-public eudev
               #$@(if (%current-target-system)
                      #~(#t)
                      #~((invoke (string-append #$output "/bin/udevadm")
-                                "hwdb" "--update"))))))
+                                "hwdb" "--update" "--usr")
+                        (symlink (string-append #$output "/lib/udev/hwdb.bin")
+                                 (string-append #$output "/etc/udev/hwdb.bin")))))))
        #:configure-flags #~(list "--enable-manpages")))
     (native-inputs
      (list autoconf
diff --git a/gnu/packages/patches/eudev-bump-to-251.patch b/gnu/packages/patches/eudev-bump-to-251.patch
new file mode 100644
index 0000000000..96a73f4ede
--- /dev/null
+++ b/gnu/packages/patches/eudev-bump-to-251.patch
@@ -0,0 +1,134 @@
+From 4d29151078c351569767dfef490a29e379afd430 Mon Sep 17 00:00:00 2001
+Message-ID: <4d29151078c351569767dfef490a29e379afd430.1695104483.git.vivien@planete-kraus.eu>
+In-Reply-To: <cover.1695104483.git.vivien@planete-kraus.eu>
+References: <cover.1695104483.git.vivien@planete-kraus.eu>
+From: Boian Bonev <bbonev@ipacct.com>
+Date: Tue, 30 May 2023 16:16:33 +0000
+Subject: [PATCH 1/1] Update as per IRC discussion
+
+Bump udev version to 251
+
+Export dummies for
+
+ - udev_device_has_current_tag
+ - udev_device_get_current_tags_list_entry
+
+since the current eudev device database does not support the concept of
+current tags
+
+bump version to 3.2.14
+---
+ README.md                    | 18 ++++++++++++------
+ configure.ac                 |  4 ++--
+ src/libudev/libudev-device.c | 11 +++++++++++
+ src/libudev/libudev.h        |  2 ++
+ src/libudev/libudev.sym      |  6 ++++++
+ 5 files changed, 33 insertions(+), 8 deletions(-)
+
+diff --git a/README.md b/README.md
+index 848ef3348..6016380ba 100644
+--- a/README.md
++++ b/README.md
+@@ -1,11 +1,17 @@
+-This git repo is a fork of git://anongit.freedesktop.org/systemd/systemd
+-with the aim of isolating udev from any particular flavor of system
+-initialization.  In this case, the isolation is from systemd.
++**eudev** is a standalone dynamic and persistent device naming support (aka
++userspace devfs) daemon that runs independently from the init system.
++**eudev** strives to remain init system and linux distribution neutral. It is
++currently used as the devfs manager for more than a dozen different linux
++distributions.
++
++This git repo is a fork of git://anongit.freedesktop.org/systemd/systemd with
++the aim of isolating udev from any particular flavor of system initialization.
++In this case, the isolation is from systemd.
+ 
+ This is a project started by Gentoo developers and testing was initially being
+-done mostly on OpenRC.  We welcome contribution from others using a variety of
+-system initializations to ensure eudev remains system initialization and
+-distribution neutral.  On 2021-08-20 Gentoo decided to abandon eudev and a new
++done mostly on OpenRC. We welcome contribution from others using a variety of
++system initializations to ensure **eudev** remains system initialization and
++distribution neutral. On 2021-08-20 Gentoo decided to abandon eudev and a new
+ project was established on 2021-09-14 by Alpine, Devuan and Gentoo
+ contributors (alphabetical order).
+ 
+diff --git a/configure.ac b/configure.ac
+index 3e31b0ebc..0d9a135bc 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1,6 +1,6 @@
+ AC_PREREQ([2.68])
+-AC_INIT([eudev],[3.2.12],[https://github.com/gentoo/eudev/issues])
+-AC_SUBST(UDEV_VERSION, 243)
++AC_INIT([eudev],[3.2.14],[https://github.com/gentoo/eudev/issues])
++AC_SUBST(UDEV_VERSION, 251)
+ AC_CONFIG_SRCDIR([src/udev/udevd.c])
+ 
+ AC_USE_SYSTEM_EXTENSIONS
+diff --git a/src/libudev/libudev-device.c b/src/libudev/libudev-device.c
+index ac67ce846..7d7a6622e 100644
+--- a/src/libudev/libudev-device.c
++++ b/src/libudev/libudev-device.c
+@@ -1819,6 +1819,12 @@ _public_ struct udev_list_entry *udev_device_get_tags_list_entry(struct udev_dev
+         return udev_list_get_entry(&udev_device->tags_list);
+ }
+ 
++_public_ struct udev_list_entry *udev_device_get_current_tags_list_entry(struct udev_device *udev_device)
++{
++        // TODO: eudev database does not support current tags
++        return udev_device_get_tags_list_entry(udev_device);
++}
++
+ /**
+  * udev_device_has_tag:
+  * @udev_device: udev device
+@@ -1842,6 +1848,11 @@ _public_ int udev_device_has_tag(struct udev_device *udev_device, const char *ta
+         return false;
+ }
+ 
++_public_ int udev_device_has_current_tag(struct udev_device *udev_device, const char *tag) {
++        // TODO: eudev database does not support current tags
++        return udev_device_has_tag(udev_device, tag);
++}
++
+ #define ENVP_SIZE                        128
+ #define MONITOR_BUF_SIZE                4096
+ static int update_envp_monitor_buf(struct udev_device *udev_device)
+diff --git a/src/libudev/libudev.h b/src/libudev/libudev.h
+index 8491d2b81..0202964d6 100644
+--- a/src/libudev/libudev.h
++++ b/src/libudev/libudev.h
+@@ -100,6 +100,7 @@ int udev_device_get_is_initialized(struct udev_device *udev_device);
+ struct udev_list_entry *udev_device_get_devlinks_list_entry(struct udev_device *udev_device);
+ struct udev_list_entry *udev_device_get_properties_list_entry(struct udev_device *udev_device);
+ struct udev_list_entry *udev_device_get_tags_list_entry(struct udev_device *udev_device);
++struct udev_list_entry *udev_device_get_current_tags_list_entry(struct udev_device *udev_device);
+ struct udev_list_entry *udev_device_get_sysattr_list_entry(struct udev_device *udev_device);
+ const char *udev_device_get_property_value(struct udev_device *udev_device, const char *key);
+ const char *udev_device_get_driver(struct udev_device *udev_device);
+@@ -110,6 +111,7 @@ unsigned long long int udev_device_get_usec_since_initialized(struct udev_device
+ const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const char *sysattr);
+ int udev_device_set_sysattr_value(struct udev_device *udev_device, const char *sysattr, char *value);
+ int udev_device_has_tag(struct udev_device *udev_device, const char *tag);
++int udev_device_has_current_tag(struct udev_device *udev_device, const char *tag);
+ 
+ /*
+  * udev_monitor
+diff --git a/src/libudev/libudev.sym b/src/libudev/libudev.sym
+index 76726fca7..d56c2aeab 100644
+--- a/src/libudev/libudev.sym
++++ b/src/libudev/libudev.sym
+@@ -118,3 +118,9 @@ global:
+         udev_queue_flush;
+         udev_queue_get_fd;
+ } LIBUDEV_199;
++
++LIBUDEV_247 {
++global:
++        udev_device_has_current_tag;
++        udev_device_get_current_tags_list_entry;
++} LIBUDEV_215;
+-- 
+2.41.0
+
-- 
2.41.0




^ permalink raw reply related	[flat|nested] 91+ messages in thread

* [bug#66099] [WIP PATCH gnome-team v2 1/3] gnu: eudev: Update libudev version to 251.
  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           ` 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
  2 siblings, 0 replies; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-09-19 11:23 UTC (permalink / raw)
  To: Liliana Marie Prikler, 66099; +Cc: rg, maxim.cournoyer

Support for version 251 is only provided as a merge request for now:

https://github.com/eudev-project/eudev/pull/253

This merge request bumps the eudev version to 3.2.14, but it has not been
released yet.

Eudev now has a hardware database that installs descriptions of hardware in
/etc, but they should go to /lib prior to being used. I added a phase to copy
all the /etc files to /lib.

I submitted 3 patches to make udev hwdb more guix-friendly, fused in
eudev-hwdb-bin-path.patch. libudev requires an indexed binary file that knows
about all devices, and this file is generated by udevadm hwdb --update -o
<prefix>/lib/udev/hwdb.bin. This udevadm hwdb command respects the
UDEV_HWDB_PATH to collect all entries for the hwdb. Then, libudev can use
UDEV_HWDB_BIN to select the database at run-time.

I think everything could work out for Guix if we add a new profile hook that:
1. Calls udevadm hwdb --update -o <profile>/lib/udev/hwdb.bin;
2. Set UDEV_HWDB_BIN to <profile>/lib/udev/hwdb.bin.

Unfortunately, I don’t know how to do that profile hook thing. Do you have
pointers?

* gnu/packages/linux.scm (eudev): Update to v3.2.12, but bump version to
3.2.14.beta.
[#:phases] <allow-eudev-hwdb>: New phase.
<build-hwdb>: Update accordingly.
[search-paths]: Add UDEV_HWDB_PATH.
* gnu/packages/patches/eudev-bump-to-251.patch: New file.
* gnu/packages/patches/eudev-hwdb-bin-path.patch: New file.
* gnu/packages/linux.scm (eudev): Use them here.
* gnu/local.mk (dist_patch_DATA): Register them here.
---
 gnu/local.mk                                  |   2 +
 gnu/packages/linux.scm                        |  32 +-
 gnu/packages/patches/eudev-bump-to-251.patch  | 134 ++++++++
 .../patches/eudev-hwdb-bin-path.patch         | 309 ++++++++++++++++++
 4 files changed, 463 insertions(+), 14 deletions(-)
 create mode 100644 gnu/packages/patches/eudev-bump-to-251.patch
 create mode 100644 gnu/packages/patches/eudev-hwdb-bin-path.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 72c9954492..6c98ede191 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1127,6 +1127,8 @@ dist_patch_DATA =						\
   %D%/packages/patches/esmini-use-pkgconfig.patch		\
   %D%/packages/patches/esmtp-add-lesmtp.patch		\
   %D%/packages/patches/eudev-rules-directory.patch		\
+  %D%/packages/patches/eudev-bump-to-251.patch		\
+  %D%/packages/patches/eudev-hwdb-bin-path.patch		\
   %D%/packages/patches/exercism-disable-self-update.patch	\
   %D%/packages/patches/extempore-unbundle-external-dependencies.patch	\
   %D%/packages/patches/extundelete-e2fsprogs-1.44.patch		\
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 85e3d9845d..5ea44e886e 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -4265,16 +4265,18 @@ (define-public eudev
   ;; The post-systemd fork, maintained by Gentoo.
   (package
     (name "eudev")
-    (version "3.2.11")
+    (version "3.2.14.beta")
     (source (origin
               (method git-fetch)
               (uri (git-reference (url "https://github.com/gentoo/eudev")
-                                  (commit (string-append "v" version))))
+                                  (commit "v3.2.12")))
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "0dzaqwjnl55f69ird57wb6skahc6l7zs1slsrzqqfhww33icp6av"))
-              (patches (search-patches "eudev-rules-directory.patch"))))
+                "0wpckjxzsb4wkj3pwnw14zmp3z8ivf03hjbgs838q5gfridpxnf7"))
+              (patches (search-patches "eudev-rules-directory.patch"
+                                       "eudev-bump-to-251.patch"
+                                       "eudev-hwdb-bin-path.patch"))))
     (build-system gnu-build-system)
     (arguments
      (list
@@ -4297,18 +4299,20 @@ (define-public eudev
                 (substitute* (string-append #$output "/lib/libudev.la")
                   (("old_library=.*")
                    "old_library=''\n")))))
-          (add-after 'install 'build-hwdb
+          (add-after 'install 'allow-eudev-hwdb
             (lambda _
-              ;; Build OUT/etc/udev/hwdb.bin.  This allows 'lsusb' and
-              ;; similar tools to display product names.
-              ;;
-              ;; XXX: This can't be done when cross-compiling. Find another way
-              ;; to generate hwdb.bin for cross-built systems.
-              #$@(if (%current-target-system)
-                     #~(#t)
-                     #~((invoke (string-append #$output "/bin/udevadm")
-                                "hwdb" "--update"))))))
+              ;; eudev distributes the hwdb, but each file has to be enabled
+              ;; by being copied under /lib/udev/hwdb.d. We accept all of
+              ;; them.
+              (symlink (string-append #$output "/etc/udev/hwdb.d")
+                       (string-append #$output "/lib/udev/hwdb.d")))))
        #:configure-flags #~(list "--enable-manpages")))
+    (search-paths
+      (list (search-path-specification
+              (variable "UDEV_HWDB_PATH")
+              (files '("lib/udev/hwdb.d")))))
+    ;; FIXME: there needs to be a profile hook that calls udevadm hwdb
+    ;; --update -o <profile>/lib/udev/hwdb.bin
     (native-inputs
      (list autoconf
            automake
diff --git a/gnu/packages/patches/eudev-bump-to-251.patch b/gnu/packages/patches/eudev-bump-to-251.patch
new file mode 100644
index 0000000000..96a73f4ede
--- /dev/null
+++ b/gnu/packages/patches/eudev-bump-to-251.patch
@@ -0,0 +1,134 @@
+From 4d29151078c351569767dfef490a29e379afd430 Mon Sep 17 00:00:00 2001
+Message-ID: <4d29151078c351569767dfef490a29e379afd430.1695104483.git.vivien@planete-kraus.eu>
+In-Reply-To: <cover.1695104483.git.vivien@planete-kraus.eu>
+References: <cover.1695104483.git.vivien@planete-kraus.eu>
+From: Boian Bonev <bbonev@ipacct.com>
+Date: Tue, 30 May 2023 16:16:33 +0000
+Subject: [PATCH 1/1] Update as per IRC discussion
+
+Bump udev version to 251
+
+Export dummies for
+
+ - udev_device_has_current_tag
+ - udev_device_get_current_tags_list_entry
+
+since the current eudev device database does not support the concept of
+current tags
+
+bump version to 3.2.14
+---
+ README.md                    | 18 ++++++++++++------
+ configure.ac                 |  4 ++--
+ src/libudev/libudev-device.c | 11 +++++++++++
+ src/libudev/libudev.h        |  2 ++
+ src/libudev/libudev.sym      |  6 ++++++
+ 5 files changed, 33 insertions(+), 8 deletions(-)
+
+diff --git a/README.md b/README.md
+index 848ef3348..6016380ba 100644
+--- a/README.md
++++ b/README.md
+@@ -1,11 +1,17 @@
+-This git repo is a fork of git://anongit.freedesktop.org/systemd/systemd
+-with the aim of isolating udev from any particular flavor of system
+-initialization.  In this case, the isolation is from systemd.
++**eudev** is a standalone dynamic and persistent device naming support (aka
++userspace devfs) daemon that runs independently from the init system.
++**eudev** strives to remain init system and linux distribution neutral. It is
++currently used as the devfs manager for more than a dozen different linux
++distributions.
++
++This git repo is a fork of git://anongit.freedesktop.org/systemd/systemd with
++the aim of isolating udev from any particular flavor of system initialization.
++In this case, the isolation is from systemd.
+ 
+ This is a project started by Gentoo developers and testing was initially being
+-done mostly on OpenRC.  We welcome contribution from others using a variety of
+-system initializations to ensure eudev remains system initialization and
+-distribution neutral.  On 2021-08-20 Gentoo decided to abandon eudev and a new
++done mostly on OpenRC. We welcome contribution from others using a variety of
++system initializations to ensure **eudev** remains system initialization and
++distribution neutral. On 2021-08-20 Gentoo decided to abandon eudev and a new
+ project was established on 2021-09-14 by Alpine, Devuan and Gentoo
+ contributors (alphabetical order).
+ 
+diff --git a/configure.ac b/configure.ac
+index 3e31b0ebc..0d9a135bc 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1,6 +1,6 @@
+ AC_PREREQ([2.68])
+-AC_INIT([eudev],[3.2.12],[https://github.com/gentoo/eudev/issues])
+-AC_SUBST(UDEV_VERSION, 243)
++AC_INIT([eudev],[3.2.14],[https://github.com/gentoo/eudev/issues])
++AC_SUBST(UDEV_VERSION, 251)
+ AC_CONFIG_SRCDIR([src/udev/udevd.c])
+ 
+ AC_USE_SYSTEM_EXTENSIONS
+diff --git a/src/libudev/libudev-device.c b/src/libudev/libudev-device.c
+index ac67ce846..7d7a6622e 100644
+--- a/src/libudev/libudev-device.c
++++ b/src/libudev/libudev-device.c
+@@ -1819,6 +1819,12 @@ _public_ struct udev_list_entry *udev_device_get_tags_list_entry(struct udev_dev
+         return udev_list_get_entry(&udev_device->tags_list);
+ }
+ 
++_public_ struct udev_list_entry *udev_device_get_current_tags_list_entry(struct udev_device *udev_device)
++{
++        // TODO: eudev database does not support current tags
++        return udev_device_get_tags_list_entry(udev_device);
++}
++
+ /**
+  * udev_device_has_tag:
+  * @udev_device: udev device
+@@ -1842,6 +1848,11 @@ _public_ int udev_device_has_tag(struct udev_device *udev_device, const char *ta
+         return false;
+ }
+ 
++_public_ int udev_device_has_current_tag(struct udev_device *udev_device, const char *tag) {
++        // TODO: eudev database does not support current tags
++        return udev_device_has_tag(udev_device, tag);
++}
++
+ #define ENVP_SIZE                        128
+ #define MONITOR_BUF_SIZE                4096
+ static int update_envp_monitor_buf(struct udev_device *udev_device)
+diff --git a/src/libudev/libudev.h b/src/libudev/libudev.h
+index 8491d2b81..0202964d6 100644
+--- a/src/libudev/libudev.h
++++ b/src/libudev/libudev.h
+@@ -100,6 +100,7 @@ int udev_device_get_is_initialized(struct udev_device *udev_device);
+ struct udev_list_entry *udev_device_get_devlinks_list_entry(struct udev_device *udev_device);
+ struct udev_list_entry *udev_device_get_properties_list_entry(struct udev_device *udev_device);
+ struct udev_list_entry *udev_device_get_tags_list_entry(struct udev_device *udev_device);
++struct udev_list_entry *udev_device_get_current_tags_list_entry(struct udev_device *udev_device);
+ struct udev_list_entry *udev_device_get_sysattr_list_entry(struct udev_device *udev_device);
+ const char *udev_device_get_property_value(struct udev_device *udev_device, const char *key);
+ const char *udev_device_get_driver(struct udev_device *udev_device);
+@@ -110,6 +111,7 @@ unsigned long long int udev_device_get_usec_since_initialized(struct udev_device
+ const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const char *sysattr);
+ int udev_device_set_sysattr_value(struct udev_device *udev_device, const char *sysattr, char *value);
+ int udev_device_has_tag(struct udev_device *udev_device, const char *tag);
++int udev_device_has_current_tag(struct udev_device *udev_device, const char *tag);
+ 
+ /*
+  * udev_monitor
+diff --git a/src/libudev/libudev.sym b/src/libudev/libudev.sym
+index 76726fca7..d56c2aeab 100644
+--- a/src/libudev/libudev.sym
++++ b/src/libudev/libudev.sym
+@@ -118,3 +118,9 @@ global:
+         udev_queue_flush;
+         udev_queue_get_fd;
+ } LIBUDEV_199;
++
++LIBUDEV_247 {
++global:
++        udev_device_has_current_tag;
++        udev_device_get_current_tags_list_entry;
++} LIBUDEV_215;
+-- 
+2.41.0
+
diff --git a/gnu/packages/patches/eudev-hwdb-bin-path.patch b/gnu/packages/patches/eudev-hwdb-bin-path.patch
new file mode 100644
index 0000000000..f6fa91dad0
--- /dev/null
+++ b/gnu/packages/patches/eudev-hwdb-bin-path.patch
@@ -0,0 +1,309 @@
+From 097290727d6e16aa2e5859e3cd6f0c5ea4c47101 Mon Sep 17 00:00:00 2001
+Message-ID: <097290727d6e16aa2e5859e3cd6f0c5ea4c47101.1696060300.git.vivien@planete-kraus.eu>
+From: Vivien Kraus <vivien@planete-kraus.eu>
+Date: Tue, 26 Sep 2023 18:17:34 +0200
+Subject: [PATCH] Improvements for Guix
+
+---
+This is the combination of:
+
+  - https://github.com/eudev-project/eudev/pull/262
+  - https://github.com/eudev-project/eudev/pull/263
+  - https://github.com/eudev-project/eudev/pull/264
+
+ src/libudev/libudev-hwdb.c |  37 +++++++++--
+ src/libudev/libudev.h      |   4 +-
+ src/udev/udevadm-hwdb.c    | 127 +++++++++++++++++++++++++++++++++----
+ 3 files changed, 149 insertions(+), 19 deletions(-)
+
+diff --git a/src/libudev/libudev-hwdb.c b/src/libudev/libudev-hwdb.c
+index 62029e2b2..f7212c519 100644
+--- a/src/libudev/libudev-hwdb.c
++++ b/src/libudev/libudev-hwdb.c
+@@ -47,6 +47,7 @@ struct udev_hwdb {
+         struct udev *udev;
+         int refcount;
+ 
++        char *bin_paths;
+         FILE *f;
+         struct stat st;
+         union {
+@@ -256,10 +257,28 @@ static int trie_search_f(struct udev_hwdb *hwdb, const char *search) {
+         return 0;
+ }
+ 
+-static const char hwdb_bin_paths[] =
+-    "/etc/udev/hwdb.bin\0"
+-    UDEV_LIBEXEC_DIR "/hwdb.bin\0";
+-
++static char *get_hwdb_bin_paths (void) {
++        static const char default_locations[] =
++          "/etc/udev/hwdb.bin\0"
++          UDEV_LIBEXEC_DIR "/hwdb.bin\0";
++        const char *by_env = getenv("UDEV_HWDB_BIN");
++        if (by_env != NULL) {
++                char *path = malloc(strlen(by_env) + 1
++                                    + sizeof (default_locations));
++                if (path != NULL) {
++                        memcpy(path, by_env, strlen(by_env) + 1);
++                        memcpy(path + strlen(by_env) + 1,
++                               default_locations,
++                               sizeof (default_locations));
++                }
++                return path;
++        }
++        char *path = malloc(sizeof (default_locations));
++        if (path != NULL) {
++                memcpy(path, default_locations, sizeof (default_locations));
++        }
++        return path;
++}
+ 
+ /**
+  * udev_hwdb_new:
+@@ -282,7 +301,12 @@ _public_ struct udev_hwdb *udev_hwdb_new(struct udev *udev) {
+         udev_list_init(udev, &hwdb->properties_list, true);
+ 
+         /* find hwdb.bin in hwdb_bin_paths */
+-        NULSTR_FOREACH(hwdb_bin_path, hwdb_bin_paths) {
++        hwdb->bin_paths = get_hwdb_bin_paths();
++        if (hwdb->bin_paths == NULL) {
++                udev_hwdb_unref(hwdb);
++                return NULL;
++        }
++        NULSTR_FOREACH(hwdb_bin_path, hwdb->bin_paths) {
+                 hwdb->f = fopen(hwdb_bin_path, "re");
+                 if (hwdb->f)
+                         break;
+@@ -363,6 +387,7 @@ _public_ struct udev_hwdb *udev_hwdb_unref(struct udev_hwdb *hwdb) {
+                 return NULL;
+         if (hwdb->map)
+                 munmap((void *)hwdb->map, hwdb->st.st_size);
++        free(hwdb->bin_paths);
+         if (hwdb->f)
+                 fclose(hwdb->f);
+         udev_list_cleanup(&hwdb->properties_list);
+@@ -381,7 +406,7 @@ bool udev_hwdb_validate(struct udev_hwdb *hwdb) {
+                 return false;
+ 
+         /* if hwdb.bin doesn't exist anywhere, we need to update */
+-        NULSTR_FOREACH(p, hwdb_bin_paths) {
++        NULSTR_FOREACH(p, hwdb->bin_paths) {
+                 if (stat(p, &st) >= 0) {
+                         found = true;
+                         break;
+diff --git a/src/libudev/libudev.h b/src/libudev/libudev.h
+index 8491d2b81..e4bc18970 100644
+--- a/src/libudev/libudev.h
++++ b/src/libudev/libudev.h
+@@ -185,7 +185,9 @@ struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev
+ /*
+  *  udev_hwdb
+  *
+- *  access to the static hardware properties database
++ *  access to the static hardware properties database; the database to
++ *  use can be overriden by setting the UDEV_HWDB_BIN environment
++ *  variable to its file name
+  */
+ struct udev_hwdb;
+ struct udev_hwdb *udev_hwdb_new(struct udev *udev);
+diff --git a/src/udev/udevadm-hwdb.c b/src/udev/udevadm-hwdb.c
+index d14a3434f..c2214dc91 100644
+--- a/src/udev/udevadm-hwdb.c
++++ b/src/udev/udevadm-hwdb.c
+@@ -35,11 +35,69 @@
+  * Uses a Patricia/radix trie to index all matches for efficient lookup.
+  */
+ 
+-static const char * const conf_file_dirs[] = {
+-        UDEV_HWDB_DIR,
+-        UDEV_LIBEXEC_DIR "/hwdb.d",
+-        NULL
+-};
++static ssize_t follow_path (const char *path_variable, char **destination, size_t max) {
++        size_t n = 0;
++        if (path_variable != NULL) {
++                while (path_variable[0] == ':') {
++                      path_variable++;
++                }
++                while (path_variable[0] != '\0') {
++                        const char *end = strchr(path_variable, ':');
++                        if (end == NULL) {
++                                end = path_variable + strlen(path_variable);
++                        }
++                        if (n < max) {
++                                destination[n] = strndup(path_variable, end - path_variable);
++                                if (destination[n] == NULL) {
++                                        return -ENOMEM;
++                                }
++                        }
++                        n++;
++                        path_variable = end;
++                        while (path_variable[0] == ':') {
++                                path_variable++;
++                        }
++                }
++        }
++        if (n < max) {
++                destination[n] = NULL;
++        }
++        return n;
++}
++
++static char ** list_conf_file_dirs (void) {
++        static const char *main_hwdb_dir = UDEV_HWDB_DIR;
++        static const char *libexec_dir = UDEV_LIBEXEC_DIR "/hwdb.d";
++        const char *path_variable = getenv ("UDEV_HWDB_PATH");
++        ssize_t path_length = 0;
++        if (path_variable != NULL) {
++                path_length = follow_path(path_variable, NULL, 0);
++                if (path_length < 0) {
++                      return NULL;
++                }
++        }
++        char **all_dirs = malloc((path_length + 2 + 1) * sizeof (char *));
++        if (all_dirs == NULL) {
++                return NULL;
++        }
++        for (ssize_t i = 0; i < path_length + 2 + 1; i++) {
++                all_dirs[i] = NULL;
++        }
++        ssize_t error = follow_path(path_variable, all_dirs, path_length + 1);
++        all_dirs[path_length] = strdup(main_hwdb_dir);
++        all_dirs[path_length + 1] = strdup(libexec_dir);
++        all_dirs[path_length + 2] = NULL;
++        if (error < 0
++            || all_dirs[path_length] == NULL
++            || all_dirs[path_length + 1] == NULL) {
++                for (ssize_t i = 0; i < path_length + 2 + 1; i++) {
++                        free(all_dirs[i]);
++                }
++                free(all_dirs);
++                all_dirs = NULL;
++        }
++        return all_dirs;
++}
+ 
+ /* in-memory trie objects */
+ struct trie {
+@@ -564,10 +622,15 @@ static int import_file(struct udev *udev, struct trie *trie, const char *filenam
+ static void help(void) {
+         printf("Usage: udevadm hwdb OPTIONS\n"
+                "  -u,--update          update the hardware database\n"
++               "  -o,--output=.../hwdb.bin generate in .../hwdb.bin instead of /etc/udev/hwdb.bin\n"
+                "  --usr                generate in " UDEV_LIBEXEC_DIR " instead of /etc/udev\n"
+                "  -t,--test=MODALIAS   query database and print result\n"
+                "  -r,--root=PATH       alternative root path in the filesystem\n"
+-               "  -h,--help\n\n");
++               "  -h,--help\n"
++               "\n"
++               "The HWDB is searched in the UDEV_HWDB_PATH search path, "
++               UDEV_HWDB_DIR ", and " UDEV_LIBEXEC_DIR "/hwdb.d.\n"
++               "\n");
+ }
+ 
+ static int adm_hwdb(struct udev *udev, int argc, char *argv[]) {
+@@ -578,6 +641,7 @@ static int adm_hwdb(struct udev *udev, int argc, char *argv[]) {
+         static const struct option options[] = {
+                 { "update", no_argument,       NULL, 'u' },
+                 { "usr",    no_argument,       NULL, ARG_USR },
++                { "output", required_argument, NULL, 'o' },
+                 { "test",   required_argument, NULL, 't' },
+                 { "root",   required_argument, NULL, 'r' },
+                 { "help",   no_argument,       NULL, 'h' },
+@@ -585,19 +649,37 @@ static int adm_hwdb(struct udev *udev, int argc, char *argv[]) {
+         };
+         const char *test = NULL;
+         const char *root = "";
+-        const char *hwdb_bin_dir = "/etc/udev";
+         bool update = false;
+         struct trie *trie = NULL;
+         int err, c;
+         int rc = EXIT_SUCCESS;
+ 
+-        while ((c = getopt_long(argc, argv, "ut:r:h", options, NULL)) >= 0)
++        _cleanup_free_ char *hwdb_bin = strdup("/etc/udev/hwdb.bin");
++        if (hwdb_bin == NULL) {
++                rc = EXIT_FAILURE;
++                goto out;
++        }
++
++        while ((c = getopt_long(argc, argv, "uo:t:r:h", options, NULL)) >= 0)
+                 switch(c) {
+                 case 'u':
+                         update = true;
+                         break;
+                 case ARG_USR:
+-                        hwdb_bin_dir = UDEV_LIBEXEC_DIR;
++                        free(hwdb_bin);
++                        hwdb_bin = strdup(UDEV_LIBEXEC_DIR "/hwdb.bin");
++                        if (hwdb_bin == NULL) {
++                                rc = EXIT_FAILURE;
++                                goto out;
++                        }
++                        break;
++                case 'o':
++                        free(hwdb_bin);
++                        hwdb_bin = strdup(optarg);
++                        if (hwdb_bin == NULL) {
++                                rc = EXIT_FAILURE;
++                                goto out;
++                        }
+                         break;
+                 case 't':
+                         test = optarg;
+@@ -619,9 +701,18 @@ static int adm_hwdb(struct udev *udev, int argc, char *argv[]) {
+                 return EXIT_FAILURE;
+         }
+ 
++        if (root) {
++                char *full_hwdb_bin = strjoin(root, "/", hwdb_bin, NULL);
++                if (full_hwdb_bin == NULL) {
++                        rc = EXIT_FAILURE;
++                        goto out;
++                }
++                free (hwdb_bin);
++                hwdb_bin = full_hwdb_bin;
++        }
++
+         if (update) {
+                 char **files, **f;
+-                _cleanup_free_ char *hwdb_bin = NULL;
+ 
+                 trie = new0(struct trie, 1);
+                 if (!trie) {
+@@ -644,7 +735,20 @@ static int adm_hwdb(struct udev *udev, int argc, char *argv[]) {
+                 }
+                 trie->nodes_count++;
+ 
+-                err = conf_files_list_strv(&files, ".hwdb", root, conf_file_dirs);
++                char **conf_file_dirs = list_conf_file_dirs ();
++                if (conf_file_dirs == NULL) {
++                        rc = EXIT_FAILURE;
++                        goto out;
++                }
++                err = conf_files_list_strv(&files, ".hwdb", root,
++                                           (const char * const*) conf_file_dirs);
++                size_t dir_to_cleanup = 0;
++                for (dir_to_cleanup = 0;
++                     conf_file_dirs[dir_to_cleanup] != NULL;
++                     dir_to_cleanup++) {
++                        free (conf_file_dirs[dir_to_cleanup]);
++                }
++                free (conf_file_dirs);
+                 if (err < 0) {
+                         log_error_errno(err, "failed to enumerate hwdb files: %m");
+                         rc = EXIT_FAILURE;
+@@ -672,7 +776,6 @@ static int adm_hwdb(struct udev *udev, int argc, char *argv[]) {
+                 log_debug("strings dedup'ed: %8zu bytes (%8zu)",
+                           trie->strings->dedup_len, trie->strings->dedup_count);
+ 
+-                hwdb_bin = strjoin(root, "/", hwdb_bin_dir, "/hwdb.bin", NULL);
+                 if (!hwdb_bin) {
+                         rc = EXIT_FAILURE;
+                         goto out;
+
+base-commit: 0d86dd9a2a57d5d0809de6395dc36abe515818b5
+-- 
+2.41.0
+
-- 
2.41.0




^ permalink raw reply related	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v3 1/3] gnu: eudev: Update libudev version to 251.
  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           ` Vivien Kraus via Guix-patches via
  2023-09-30 17:59             ` Liliana Marie Prikler
  2023-10-01 22:02             ` Maxim Cournoyer
  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-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
  2 siblings, 2 replies; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-09-19 11:23 UTC (permalink / raw)
  To: Liliana Marie Prikler, 66099; +Cc: rg, maxim.cournoyer

Support for version 251 is only provided as a merge request for now:

https://github.com/eudev-project/eudev/pull/253

This merge request bumps the eudev version to 3.2.14, but it has not been
released yet.

Eudev now has a hardware database that installs descriptions of hardware in
/etc, but they should go to /lib prior to being used. I added a phase to copy
all the /etc files to /lib.

I submitted 3 patches to make udev hwdb more guix-friendly, fused in
eudev-hwdb-bin-path.patch. libudev requires an indexed binary file that knows
about all devices, and this file is generated by udevadm hwdb --update -o
<prefix>/lib/udev/hwdb.bin. This udevadm hwdb command respects the
UDEV_HWDB_PATH to collect all entries for the hwdb. Then, libudev can use
UDEV_HWDB_BIN to select the database at run-time.

Another unreleased patch for PR 255 is also included.

I think everything could work out for Guix if we add a new profile hook that:
1. Calls udevadm hwdb --update -o <profile>/lib/udev/hwdb.bin;
2. Set UDEV_HWDB_BIN to <profile>/lib/udev/hwdb.bin.

This is why there are actually 2 search paths: one for UDEV_HWDB_PATH, and one
for UDEV_HWDB_BIN (the latter accepting only 1 value).

* gnu/packages/linux.scm (eudev): Update to v3.2.12, but bump version to
3.2.14.beta.
[#:phases] <allow-eudev-hwdb>: New phase.
<build-hwdb>: Update accordingly.
[native-search-paths]: Add UDEV_HWDB_PATH.
* gnu/packages/patches/eudev-bump-to-251.patch: New file.
* gnu/packages/patches/eudev-hwdb-bin-path.patch: New file.
* gnu/packages/patches/eudev-pr-255.patch: New file.
* gnu/packages/linux.scm (eudev): Use them here.
* gnu/local.mk (dist_patch_DATA): Register them here.
* guix/profiles.scm (udev-hwdb-bin): New profile hook to generate hwdb.bin.
(%default-profile-hooks): Register it here.
---
 gnu/local.mk                                  |   3 +
 gnu/packages/linux.scm                        |  38 ++-
 gnu/packages/patches/eudev-bump-to-251.patch  | 134 ++++++++
 .../patches/eudev-hwdb-bin-path.patch         | 309 ++++++++++++++++++
 gnu/packages/patches/eudev-pr-255.patch       |  39 +++
 guix/profiles.scm                             |  29 ++
 6 files changed, 538 insertions(+), 14 deletions(-)
 create mode 100644 gnu/packages/patches/eudev-bump-to-251.patch
 create mode 100644 gnu/packages/patches/eudev-hwdb-bin-path.patch
 create mode 100644 gnu/packages/patches/eudev-pr-255.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 72c9954492..6efe1944e7 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1127,6 +1127,9 @@ dist_patch_DATA =						\
   %D%/packages/patches/esmini-use-pkgconfig.patch		\
   %D%/packages/patches/esmtp-add-lesmtp.patch		\
   %D%/packages/patches/eudev-rules-directory.patch		\
+  %D%/packages/patches/eudev-bump-to-251.patch		\
+  %D%/packages/patches/eudev-hwdb-bin-path.patch		\
+  %D%/packages/patches/eudev-pr-255.patch		\
   %D%/packages/patches/exercism-disable-self-update.patch	\
   %D%/packages/patches/extempore-unbundle-external-dependencies.patch	\
   %D%/packages/patches/extundelete-e2fsprogs-1.44.patch		\
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 85e3d9845d..7b69ad7466 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -4265,16 +4265,19 @@ (define-public eudev
   ;; The post-systemd fork, maintained by Gentoo.
   (package
     (name "eudev")
-    (version "3.2.11")
+    (version "3.2.14.beta")
     (source (origin
               (method git-fetch)
               (uri (git-reference (url "https://github.com/gentoo/eudev")
-                                  (commit (string-append "v" version))))
+                                  (commit "v3.2.12")))
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "0dzaqwjnl55f69ird57wb6skahc6l7zs1slsrzqqfhww33icp6av"))
-              (patches (search-patches "eudev-rules-directory.patch"))))
+                "0wpckjxzsb4wkj3pwnw14zmp3z8ivf03hjbgs838q5gfridpxnf7"))
+              (patches (search-patches "eudev-rules-directory.patch"
+                                       "eudev-bump-to-251.patch"
+                                       "eudev-hwdb-bin-path.patch"
+                                       "eudev-pr-255.patch"))))
     (build-system gnu-build-system)
     (arguments
      (list
@@ -4297,18 +4300,25 @@ (define-public eudev
                 (substitute* (string-append #$output "/lib/libudev.la")
                   (("old_library=.*")
                    "old_library=''\n")))))
-          (add-after 'install 'build-hwdb
+          (add-after 'install 'allow-eudev-hwdb
             (lambda _
-              ;; Build OUT/etc/udev/hwdb.bin.  This allows 'lsusb' and
-              ;; similar tools to display product names.
-              ;;
-              ;; XXX: This can't be done when cross-compiling. Find another way
-              ;; to generate hwdb.bin for cross-built systems.
-              #$@(if (%current-target-system)
-                     #~(#t)
-                     #~((invoke (string-append #$output "/bin/udevadm")
-                                "hwdb" "--update"))))))
+              ;; eudev distributes the hwdb, but each file has to be enabled
+              ;; by being copied under /lib/udev/hwdb.d. We accept all of
+              ;; them.
+              (symlink (string-append #$output "/etc/udev/hwdb.d")
+                       (string-append #$output "/lib/udev/hwdb.d")))))
        #:configure-flags #~(list "--enable-manpages")))
+    (native-search-paths
+      (list (search-path-specification
+              (variable "UDEV_HWDB_PATH")
+              (files '("lib/udev/hwdb.d")))
+            ;; Never install a hwdb.bin file, always let the udev-hwdb-bin
+            ;; profile hook generate it.
+            (search-path-specification
+              (variable "UDEV_HWDB_BIN")
+              (files '("lib/udev/hwdb.bin"))
+              (file-type 'regular)
+              (separator #f))))
     (native-inputs
      (list autoconf
            automake
diff --git a/gnu/packages/patches/eudev-bump-to-251.patch b/gnu/packages/patches/eudev-bump-to-251.patch
new file mode 100644
index 0000000000..96a73f4ede
--- /dev/null
+++ b/gnu/packages/patches/eudev-bump-to-251.patch
@@ -0,0 +1,134 @@
+From 4d29151078c351569767dfef490a29e379afd430 Mon Sep 17 00:00:00 2001
+Message-ID: <4d29151078c351569767dfef490a29e379afd430.1695104483.git.vivien@planete-kraus.eu>
+In-Reply-To: <cover.1695104483.git.vivien@planete-kraus.eu>
+References: <cover.1695104483.git.vivien@planete-kraus.eu>
+From: Boian Bonev <bbonev@ipacct.com>
+Date: Tue, 30 May 2023 16:16:33 +0000
+Subject: [PATCH 1/1] Update as per IRC discussion
+
+Bump udev version to 251
+
+Export dummies for
+
+ - udev_device_has_current_tag
+ - udev_device_get_current_tags_list_entry
+
+since the current eudev device database does not support the concept of
+current tags
+
+bump version to 3.2.14
+---
+ README.md                    | 18 ++++++++++++------
+ configure.ac                 |  4 ++--
+ src/libudev/libudev-device.c | 11 +++++++++++
+ src/libudev/libudev.h        |  2 ++
+ src/libudev/libudev.sym      |  6 ++++++
+ 5 files changed, 33 insertions(+), 8 deletions(-)
+
+diff --git a/README.md b/README.md
+index 848ef3348..6016380ba 100644
+--- a/README.md
++++ b/README.md
+@@ -1,11 +1,17 @@
+-This git repo is a fork of git://anongit.freedesktop.org/systemd/systemd
+-with the aim of isolating udev from any particular flavor of system
+-initialization.  In this case, the isolation is from systemd.
++**eudev** is a standalone dynamic and persistent device naming support (aka
++userspace devfs) daemon that runs independently from the init system.
++**eudev** strives to remain init system and linux distribution neutral. It is
++currently used as the devfs manager for more than a dozen different linux
++distributions.
++
++This git repo is a fork of git://anongit.freedesktop.org/systemd/systemd with
++the aim of isolating udev from any particular flavor of system initialization.
++In this case, the isolation is from systemd.
+ 
+ This is a project started by Gentoo developers and testing was initially being
+-done mostly on OpenRC.  We welcome contribution from others using a variety of
+-system initializations to ensure eudev remains system initialization and
+-distribution neutral.  On 2021-08-20 Gentoo decided to abandon eudev and a new
++done mostly on OpenRC. We welcome contribution from others using a variety of
++system initializations to ensure **eudev** remains system initialization and
++distribution neutral. On 2021-08-20 Gentoo decided to abandon eudev and a new
+ project was established on 2021-09-14 by Alpine, Devuan and Gentoo
+ contributors (alphabetical order).
+ 
+diff --git a/configure.ac b/configure.ac
+index 3e31b0ebc..0d9a135bc 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1,6 +1,6 @@
+ AC_PREREQ([2.68])
+-AC_INIT([eudev],[3.2.12],[https://github.com/gentoo/eudev/issues])
+-AC_SUBST(UDEV_VERSION, 243)
++AC_INIT([eudev],[3.2.14],[https://github.com/gentoo/eudev/issues])
++AC_SUBST(UDEV_VERSION, 251)
+ AC_CONFIG_SRCDIR([src/udev/udevd.c])
+ 
+ AC_USE_SYSTEM_EXTENSIONS
+diff --git a/src/libudev/libudev-device.c b/src/libudev/libudev-device.c
+index ac67ce846..7d7a6622e 100644
+--- a/src/libudev/libudev-device.c
++++ b/src/libudev/libudev-device.c
+@@ -1819,6 +1819,12 @@ _public_ struct udev_list_entry *udev_device_get_tags_list_entry(struct udev_dev
+         return udev_list_get_entry(&udev_device->tags_list);
+ }
+ 
++_public_ struct udev_list_entry *udev_device_get_current_tags_list_entry(struct udev_device *udev_device)
++{
++        // TODO: eudev database does not support current tags
++        return udev_device_get_tags_list_entry(udev_device);
++}
++
+ /**
+  * udev_device_has_tag:
+  * @udev_device: udev device
+@@ -1842,6 +1848,11 @@ _public_ int udev_device_has_tag(struct udev_device *udev_device, const char *ta
+         return false;
+ }
+ 
++_public_ int udev_device_has_current_tag(struct udev_device *udev_device, const char *tag) {
++        // TODO: eudev database does not support current tags
++        return udev_device_has_tag(udev_device, tag);
++}
++
+ #define ENVP_SIZE                        128
+ #define MONITOR_BUF_SIZE                4096
+ static int update_envp_monitor_buf(struct udev_device *udev_device)
+diff --git a/src/libudev/libudev.h b/src/libudev/libudev.h
+index 8491d2b81..0202964d6 100644
+--- a/src/libudev/libudev.h
++++ b/src/libudev/libudev.h
+@@ -100,6 +100,7 @@ int udev_device_get_is_initialized(struct udev_device *udev_device);
+ struct udev_list_entry *udev_device_get_devlinks_list_entry(struct udev_device *udev_device);
+ struct udev_list_entry *udev_device_get_properties_list_entry(struct udev_device *udev_device);
+ struct udev_list_entry *udev_device_get_tags_list_entry(struct udev_device *udev_device);
++struct udev_list_entry *udev_device_get_current_tags_list_entry(struct udev_device *udev_device);
+ struct udev_list_entry *udev_device_get_sysattr_list_entry(struct udev_device *udev_device);
+ const char *udev_device_get_property_value(struct udev_device *udev_device, const char *key);
+ const char *udev_device_get_driver(struct udev_device *udev_device);
+@@ -110,6 +111,7 @@ unsigned long long int udev_device_get_usec_since_initialized(struct udev_device
+ const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const char *sysattr);
+ int udev_device_set_sysattr_value(struct udev_device *udev_device, const char *sysattr, char *value);
+ int udev_device_has_tag(struct udev_device *udev_device, const char *tag);
++int udev_device_has_current_tag(struct udev_device *udev_device, const char *tag);
+ 
+ /*
+  * udev_monitor
+diff --git a/src/libudev/libudev.sym b/src/libudev/libudev.sym
+index 76726fca7..d56c2aeab 100644
+--- a/src/libudev/libudev.sym
++++ b/src/libudev/libudev.sym
+@@ -118,3 +118,9 @@ global:
+         udev_queue_flush;
+         udev_queue_get_fd;
+ } LIBUDEV_199;
++
++LIBUDEV_247 {
++global:
++        udev_device_has_current_tag;
++        udev_device_get_current_tags_list_entry;
++} LIBUDEV_215;
+-- 
+2.41.0
+
diff --git a/gnu/packages/patches/eudev-hwdb-bin-path.patch b/gnu/packages/patches/eudev-hwdb-bin-path.patch
new file mode 100644
index 0000000000..f6fa91dad0
--- /dev/null
+++ b/gnu/packages/patches/eudev-hwdb-bin-path.patch
@@ -0,0 +1,309 @@
+From 097290727d6e16aa2e5859e3cd6f0c5ea4c47101 Mon Sep 17 00:00:00 2001
+Message-ID: <097290727d6e16aa2e5859e3cd6f0c5ea4c47101.1696060300.git.vivien@planete-kraus.eu>
+From: Vivien Kraus <vivien@planete-kraus.eu>
+Date: Tue, 26 Sep 2023 18:17:34 +0200
+Subject: [PATCH] Improvements for Guix
+
+---
+This is the combination of:
+
+  - https://github.com/eudev-project/eudev/pull/262
+  - https://github.com/eudev-project/eudev/pull/263
+  - https://github.com/eudev-project/eudev/pull/264
+
+ src/libudev/libudev-hwdb.c |  37 +++++++++--
+ src/libudev/libudev.h      |   4 +-
+ src/udev/udevadm-hwdb.c    | 127 +++++++++++++++++++++++++++++++++----
+ 3 files changed, 149 insertions(+), 19 deletions(-)
+
+diff --git a/src/libudev/libudev-hwdb.c b/src/libudev/libudev-hwdb.c
+index 62029e2b2..f7212c519 100644
+--- a/src/libudev/libudev-hwdb.c
++++ b/src/libudev/libudev-hwdb.c
+@@ -47,6 +47,7 @@ struct udev_hwdb {
+         struct udev *udev;
+         int refcount;
+ 
++        char *bin_paths;
+         FILE *f;
+         struct stat st;
+         union {
+@@ -256,10 +257,28 @@ static int trie_search_f(struct udev_hwdb *hwdb, const char *search) {
+         return 0;
+ }
+ 
+-static const char hwdb_bin_paths[] =
+-    "/etc/udev/hwdb.bin\0"
+-    UDEV_LIBEXEC_DIR "/hwdb.bin\0";
+-
++static char *get_hwdb_bin_paths (void) {
++        static const char default_locations[] =
++          "/etc/udev/hwdb.bin\0"
++          UDEV_LIBEXEC_DIR "/hwdb.bin\0";
++        const char *by_env = getenv("UDEV_HWDB_BIN");
++        if (by_env != NULL) {
++                char *path = malloc(strlen(by_env) + 1
++                                    + sizeof (default_locations));
++                if (path != NULL) {
++                        memcpy(path, by_env, strlen(by_env) + 1);
++                        memcpy(path + strlen(by_env) + 1,
++                               default_locations,
++                               sizeof (default_locations));
++                }
++                return path;
++        }
++        char *path = malloc(sizeof (default_locations));
++        if (path != NULL) {
++                memcpy(path, default_locations, sizeof (default_locations));
++        }
++        return path;
++}
+ 
+ /**
+  * udev_hwdb_new:
+@@ -282,7 +301,12 @@ _public_ struct udev_hwdb *udev_hwdb_new(struct udev *udev) {
+         udev_list_init(udev, &hwdb->properties_list, true);
+ 
+         /* find hwdb.bin in hwdb_bin_paths */
+-        NULSTR_FOREACH(hwdb_bin_path, hwdb_bin_paths) {
++        hwdb->bin_paths = get_hwdb_bin_paths();
++        if (hwdb->bin_paths == NULL) {
++                udev_hwdb_unref(hwdb);
++                return NULL;
++        }
++        NULSTR_FOREACH(hwdb_bin_path, hwdb->bin_paths) {
+                 hwdb->f = fopen(hwdb_bin_path, "re");
+                 if (hwdb->f)
+                         break;
+@@ -363,6 +387,7 @@ _public_ struct udev_hwdb *udev_hwdb_unref(struct udev_hwdb *hwdb) {
+                 return NULL;
+         if (hwdb->map)
+                 munmap((void *)hwdb->map, hwdb->st.st_size);
++        free(hwdb->bin_paths);
+         if (hwdb->f)
+                 fclose(hwdb->f);
+         udev_list_cleanup(&hwdb->properties_list);
+@@ -381,7 +406,7 @@ bool udev_hwdb_validate(struct udev_hwdb *hwdb) {
+                 return false;
+ 
+         /* if hwdb.bin doesn't exist anywhere, we need to update */
+-        NULSTR_FOREACH(p, hwdb_bin_paths) {
++        NULSTR_FOREACH(p, hwdb->bin_paths) {
+                 if (stat(p, &st) >= 0) {
+                         found = true;
+                         break;
+diff --git a/src/libudev/libudev.h b/src/libudev/libudev.h
+index 8491d2b81..e4bc18970 100644
+--- a/src/libudev/libudev.h
++++ b/src/libudev/libudev.h
+@@ -185,7 +185,9 @@ struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev
+ /*
+  *  udev_hwdb
+  *
+- *  access to the static hardware properties database
++ *  access to the static hardware properties database; the database to
++ *  use can be overriden by setting the UDEV_HWDB_BIN environment
++ *  variable to its file name
+  */
+ struct udev_hwdb;
+ struct udev_hwdb *udev_hwdb_new(struct udev *udev);
+diff --git a/src/udev/udevadm-hwdb.c b/src/udev/udevadm-hwdb.c
+index d14a3434f..c2214dc91 100644
+--- a/src/udev/udevadm-hwdb.c
++++ b/src/udev/udevadm-hwdb.c
+@@ -35,11 +35,69 @@
+  * Uses a Patricia/radix trie to index all matches for efficient lookup.
+  */
+ 
+-static const char * const conf_file_dirs[] = {
+-        UDEV_HWDB_DIR,
+-        UDEV_LIBEXEC_DIR "/hwdb.d",
+-        NULL
+-};
++static ssize_t follow_path (const char *path_variable, char **destination, size_t max) {
++        size_t n = 0;
++        if (path_variable != NULL) {
++                while (path_variable[0] == ':') {
++                      path_variable++;
++                }
++                while (path_variable[0] != '\0') {
++                        const char *end = strchr(path_variable, ':');
++                        if (end == NULL) {
++                                end = path_variable + strlen(path_variable);
++                        }
++                        if (n < max) {
++                                destination[n] = strndup(path_variable, end - path_variable);
++                                if (destination[n] == NULL) {
++                                        return -ENOMEM;
++                                }
++                        }
++                        n++;
++                        path_variable = end;
++                        while (path_variable[0] == ':') {
++                                path_variable++;
++                        }
++                }
++        }
++        if (n < max) {
++                destination[n] = NULL;
++        }
++        return n;
++}
++
++static char ** list_conf_file_dirs (void) {
++        static const char *main_hwdb_dir = UDEV_HWDB_DIR;
++        static const char *libexec_dir = UDEV_LIBEXEC_DIR "/hwdb.d";
++        const char *path_variable = getenv ("UDEV_HWDB_PATH");
++        ssize_t path_length = 0;
++        if (path_variable != NULL) {
++                path_length = follow_path(path_variable, NULL, 0);
++                if (path_length < 0) {
++                      return NULL;
++                }
++        }
++        char **all_dirs = malloc((path_length + 2 + 1) * sizeof (char *));
++        if (all_dirs == NULL) {
++                return NULL;
++        }
++        for (ssize_t i = 0; i < path_length + 2 + 1; i++) {
++                all_dirs[i] = NULL;
++        }
++        ssize_t error = follow_path(path_variable, all_dirs, path_length + 1);
++        all_dirs[path_length] = strdup(main_hwdb_dir);
++        all_dirs[path_length + 1] = strdup(libexec_dir);
++        all_dirs[path_length + 2] = NULL;
++        if (error < 0
++            || all_dirs[path_length] == NULL
++            || all_dirs[path_length + 1] == NULL) {
++                for (ssize_t i = 0; i < path_length + 2 + 1; i++) {
++                        free(all_dirs[i]);
++                }
++                free(all_dirs);
++                all_dirs = NULL;
++        }
++        return all_dirs;
++}
+ 
+ /* in-memory trie objects */
+ struct trie {
+@@ -564,10 +622,15 @@ static int import_file(struct udev *udev, struct trie *trie, const char *filenam
+ static void help(void) {
+         printf("Usage: udevadm hwdb OPTIONS\n"
+                "  -u,--update          update the hardware database\n"
++               "  -o,--output=.../hwdb.bin generate in .../hwdb.bin instead of /etc/udev/hwdb.bin\n"
+                "  --usr                generate in " UDEV_LIBEXEC_DIR " instead of /etc/udev\n"
+                "  -t,--test=MODALIAS   query database and print result\n"
+                "  -r,--root=PATH       alternative root path in the filesystem\n"
+-               "  -h,--help\n\n");
++               "  -h,--help\n"
++               "\n"
++               "The HWDB is searched in the UDEV_HWDB_PATH search path, "
++               UDEV_HWDB_DIR ", and " UDEV_LIBEXEC_DIR "/hwdb.d.\n"
++               "\n");
+ }
+ 
+ static int adm_hwdb(struct udev *udev, int argc, char *argv[]) {
+@@ -578,6 +641,7 @@ static int adm_hwdb(struct udev *udev, int argc, char *argv[]) {
+         static const struct option options[] = {
+                 { "update", no_argument,       NULL, 'u' },
+                 { "usr",    no_argument,       NULL, ARG_USR },
++                { "output", required_argument, NULL, 'o' },
+                 { "test",   required_argument, NULL, 't' },
+                 { "root",   required_argument, NULL, 'r' },
+                 { "help",   no_argument,       NULL, 'h' },
+@@ -585,19 +649,37 @@ static int adm_hwdb(struct udev *udev, int argc, char *argv[]) {
+         };
+         const char *test = NULL;
+         const char *root = "";
+-        const char *hwdb_bin_dir = "/etc/udev";
+         bool update = false;
+         struct trie *trie = NULL;
+         int err, c;
+         int rc = EXIT_SUCCESS;
+ 
+-        while ((c = getopt_long(argc, argv, "ut:r:h", options, NULL)) >= 0)
++        _cleanup_free_ char *hwdb_bin = strdup("/etc/udev/hwdb.bin");
++        if (hwdb_bin == NULL) {
++                rc = EXIT_FAILURE;
++                goto out;
++        }
++
++        while ((c = getopt_long(argc, argv, "uo:t:r:h", options, NULL)) >= 0)
+                 switch(c) {
+                 case 'u':
+                         update = true;
+                         break;
+                 case ARG_USR:
+-                        hwdb_bin_dir = UDEV_LIBEXEC_DIR;
++                        free(hwdb_bin);
++                        hwdb_bin = strdup(UDEV_LIBEXEC_DIR "/hwdb.bin");
++                        if (hwdb_bin == NULL) {
++                                rc = EXIT_FAILURE;
++                                goto out;
++                        }
++                        break;
++                case 'o':
++                        free(hwdb_bin);
++                        hwdb_bin = strdup(optarg);
++                        if (hwdb_bin == NULL) {
++                                rc = EXIT_FAILURE;
++                                goto out;
++                        }
+                         break;
+                 case 't':
+                         test = optarg;
+@@ -619,9 +701,18 @@ static int adm_hwdb(struct udev *udev, int argc, char *argv[]) {
+                 return EXIT_FAILURE;
+         }
+ 
++        if (root) {
++                char *full_hwdb_bin = strjoin(root, "/", hwdb_bin, NULL);
++                if (full_hwdb_bin == NULL) {
++                        rc = EXIT_FAILURE;
++                        goto out;
++                }
++                free (hwdb_bin);
++                hwdb_bin = full_hwdb_bin;
++        }
++
+         if (update) {
+                 char **files, **f;
+-                _cleanup_free_ char *hwdb_bin = NULL;
+ 
+                 trie = new0(struct trie, 1);
+                 if (!trie) {
+@@ -644,7 +735,20 @@ static int adm_hwdb(struct udev *udev, int argc, char *argv[]) {
+                 }
+                 trie->nodes_count++;
+ 
+-                err = conf_files_list_strv(&files, ".hwdb", root, conf_file_dirs);
++                char **conf_file_dirs = list_conf_file_dirs ();
++                if (conf_file_dirs == NULL) {
++                        rc = EXIT_FAILURE;
++                        goto out;
++                }
++                err = conf_files_list_strv(&files, ".hwdb", root,
++                                           (const char * const*) conf_file_dirs);
++                size_t dir_to_cleanup = 0;
++                for (dir_to_cleanup = 0;
++                     conf_file_dirs[dir_to_cleanup] != NULL;
++                     dir_to_cleanup++) {
++                        free (conf_file_dirs[dir_to_cleanup]);
++                }
++                free (conf_file_dirs);
+                 if (err < 0) {
+                         log_error_errno(err, "failed to enumerate hwdb files: %m");
+                         rc = EXIT_FAILURE;
+@@ -672,7 +776,6 @@ static int adm_hwdb(struct udev *udev, int argc, char *argv[]) {
+                 log_debug("strings dedup'ed: %8zu bytes (%8zu)",
+                           trie->strings->dedup_len, trie->strings->dedup_count);
+ 
+-                hwdb_bin = strjoin(root, "/", hwdb_bin_dir, "/hwdb.bin", NULL);
+                 if (!hwdb_bin) {
+                         rc = EXIT_FAILURE;
+                         goto out;
+
+base-commit: 0d86dd9a2a57d5d0809de6395dc36abe515818b5
+-- 
+2.41.0
+
diff --git a/gnu/packages/patches/eudev-pr-255.patch b/gnu/packages/patches/eudev-pr-255.patch
new file mode 100644
index 0000000000..505a5e7074
--- /dev/null
+++ b/gnu/packages/patches/eudev-pr-255.patch
@@ -0,0 +1,39 @@
+From b9cc389aabf14379685e4582c3275c23f5a9d0bc Mon Sep 17 00:00:00 2001
+Message-ID: <b9cc389aabf14379685e4582c3275c23f5a9d0bc.1696071334.git.vivien@planete-kraus.eu>
+From: NaofumiHonda <honda@math.sci.hokudai.ac.jp>
+Date: Tue, 22 Aug 2023 00:17:45 +0900
+Subject: [PATCH] Clear sysattr cache if a null pointer is passed (#255)
+
+* Clear sysattr cache if a null pointer is passed
+
+* remove tabs
+---
+ src/libudev/libudev-device.c | 12 +++++++++---
+ 1 file changed, 9 insertions(+), 3 deletions(-)
+
+diff --git a/src/libudev/libudev-device.c b/src/libudev/libudev-device.c
+index ac67ce846..d6bc4032a 100644
+--- a/src/libudev/libudev-device.c
++++ b/src/libudev/libudev-device.c
+@@ -1557,9 +1557,15 @@ _public_ int udev_device_set_sysattr_value(struct udev_device *udev_device, cons
+         dev = udev_device;
+         if (sysattr == NULL)
+                 return -EINVAL;
+-        if (value == NULL)
+-                value_len = 0;
+-        else
++        if (value == NULL) {
++                struct udev_list_entry *list_entry;
++
++                list_entry = udev_list_get_entry(&udev_device->sysattr_value_list);
++                list_entry = udev_list_entry_get_by_name(list_entry, sysattr);
++                if (list_entry != NULL)
++                        udev_list_entry_delete(list_entry);
++                goto out;
++        } else
+                 value_len = strlen(value);
+ 
+         strscpyl(path, sizeof(path), udev_device_get_syspath(dev), "/", sysattr, NULL);
+-- 
+2.41.0
+
diff --git a/guix/profiles.scm b/guix/profiles.scm
index c88672c25a..d308e7fb88 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -1905,6 +1905,34 @@ (define (texlive-font-maps manifest)
                             (hook . texlive-font-maps)))
         (return #f))))
 
+(define (udev-hwdb-bin manifest)
+  "Return a derivation that builds lib/udev/hwdb.bin."
+  (define eudev
+    (module-ref (resolve-interface '(gnu packages linux)) 'eudev))
+  (define build
+    (with-imported-modules
+        (source-module-closure '((guix build utils)))
+      #~(begin
+          (use-modules (guix build utils))
+          (let* ((inputs '#$(manifest-inputs manifest))
+                 (hwdb-directories
+                  (filter
+                   file-exists?
+                   (map (lambda (directory)
+                          (string-append directory "/lib/udev/hwdb.d"))
+                        inputs))))
+            (setenv "UDEV_HWDB_PATH"
+                    (string-join hwdb-directories ":")))
+          (invoke #$(file-append eudev "/bin/udevadm")
+                  "hwdb" "--update"
+                  "-o" (string-append #$output "/lib/udev/hwdb.bin")))))
+  (gexp->derivation "udev-hwdb-bin" build
+                    #:substitutable? #f
+                    #:local-build? #t
+                    #:properties
+                    `((type . profile-hook)
+                      (hook . udev-hwdb-bin))))
+
 (define %default-profile-hooks
   ;; This is the list of derivation-returning procedures that are called by
   ;; default when making a non-empty profile.
@@ -1919,6 +1947,7 @@ (define %default-profile-hooks
         gtk-icon-themes
         gtk-im-modules
         texlive-font-maps
+        udev-hwdb-bin
         xdg-desktop-database
         xdg-mime-database))
 
-- 
2.41.0




^ permalink raw reply related	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v4 1/4] gnu: eudev: Update libudev version to 251.
  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   ` Vivien Kraus via Guix-patches via
  2023-10-02 17:12     ` Liliana Marie Prikler
  2023-09-19 11:32   ` [bug#66099] [PATCH gnome-team v4 3/4] gnu: libgudev: Update to 238 Vivien Kraus via Guix-patches via
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-09-19 11:23 UTC (permalink / raw)
  To: Liliana Marie Prikler, 66099; +Cc: rg, maxim.cournoyer

Support for version 251 is only provided as a pull request for now:

https://github.com/eudev-project/eudev/pull/253

This pull request is included as a patch, without the version bump.

Eudev now has a hardware database that installs descriptions of hardware in
/etc, but they should go to /lib prior to being used. A new phase moves the
hwdb files from /etc to /lib.

Some commits have been added since 3.2.12, in order to support search paths
for udev hwdb, and fixing a regression.

* gnu/packages/linux.scm (eudev): Update to a post-v3.2.12 commit.
[#:phases] <allow-eudev-hwdb>: New phase.
<build-hwdb>: Update accordingly.
[native-search-paths]: Add UDEV_HWDB_PATH and UDEV_HWDB_BIN.
* gnu/packages/patches/eudev-libudev-251-compat.patch: New file.
* gnu/packages/linux.scm (eudev): Use it here.
* gnu/local.mk (dist_patch_DATA): Register it here.
* gnu/packages/patches/eudev-rules-directory.patch: Rebase it.
---
 gnu/local.mk                                  |   1 +
 gnu/packages/linux.scm                        |  39 ++++---
 .../patches/eudev-libudev-251-compat.patch    | 110 ++++++++++++++++++
 .../patches/eudev-rules-directory.patch       |   9 +-
 4 files changed, 141 insertions(+), 18 deletions(-)
 create mode 100644 gnu/packages/patches/eudev-libudev-251-compat.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 72c9954492..b9880332f3 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1127,6 +1127,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/esmini-use-pkgconfig.patch		\
   %D%/packages/patches/esmtp-add-lesmtp.patch		\
   %D%/packages/patches/eudev-rules-directory.patch		\
+  %D%/packages/patches/eudev-libudev-251-compat.patch		\
   %D%/packages/patches/exercism-disable-self-update.patch	\
   %D%/packages/patches/extempore-unbundle-external-dependencies.patch	\
   %D%/packages/patches/extundelete-e2fsprogs-1.44.patch		\
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 85e3d9845d..254cca715e 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -4263,18 +4263,22 @@ (define-public earlyoom
 
 (define-public eudev
   ;; The post-systemd fork, maintained by Gentoo.
+  (define commit
+    "2e4dd05900e7b42d96cd7bdd5689c8ee431fb000")
+  (define revision "1")
   (package
     (name "eudev")
-    (version "3.2.11")
+    (version (git-version "3.2.12" revision commit))
     (source (origin
               (method git-fetch)
               (uri (git-reference (url "https://github.com/gentoo/eudev")
-                                  (commit (string-append "v" version))))
+                                  (commit commit)))
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "0dzaqwjnl55f69ird57wb6skahc6l7zs1slsrzqqfhww33icp6av"))
-              (patches (search-patches "eudev-rules-directory.patch"))))
+                "0kl2lmp759wix83pxnax2p9954b6w3j8zqzgxl99nm6brl8cx11i"))
+              (patches (search-patches "eudev-rules-directory.patch"
+                                       "eudev-libudev-251-compat.patch"))))
     (build-system gnu-build-system)
     (arguments
      (list
@@ -4297,18 +4301,25 @@ (define-public eudev
                 (substitute* (string-append #$output "/lib/libudev.la")
                   (("old_library=.*")
                    "old_library=''\n")))))
-          (add-after 'install 'build-hwdb
+          (add-after 'install 'allow-eudev-hwdb
             (lambda _
-              ;; Build OUT/etc/udev/hwdb.bin.  This allows 'lsusb' and
-              ;; similar tools to display product names.
-              ;;
-              ;; XXX: This can't be done when cross-compiling. Find another way
-              ;; to generate hwdb.bin for cross-built systems.
-              #$@(if (%current-target-system)
-                     #~(#t)
-                     #~((invoke (string-append #$output "/bin/udevadm")
-                                "hwdb" "--update"))))))
+              ;; eudev distributes the hwdb, but each file has to be enabled
+              ;; by being copied under /lib/udev/hwdb.d. We accept all of
+              ;; them.
+              (symlink (string-append #$output "/etc/udev/hwdb.d")
+                       (string-append #$output "/lib/udev/hwdb.d")))))
        #:configure-flags #~(list "--enable-manpages")))
+    (native-search-paths
+      (list (search-path-specification
+              (variable "UDEV_HWDB_PATH")
+              (files '("lib/udev/hwdb.d")))
+            ;; Never install a hwdb.bin file, always let the udev-hwdb-bin
+            ;; profile hook generate it.
+            (search-path-specification
+              (variable "UDEV_HWDB_BIN")
+              (files '("lib/udev/hwdb.bin"))
+              (file-type 'regular)
+              (separator #f))))
     (native-inputs
      (list autoconf
            automake
diff --git a/gnu/packages/patches/eudev-libudev-251-compat.patch b/gnu/packages/patches/eudev-libudev-251-compat.patch
new file mode 100644
index 0000000000..b24893d79c
--- /dev/null
+++ b/gnu/packages/patches/eudev-libudev-251-compat.patch
@@ -0,0 +1,110 @@
+From ca8607912b6da3ce87ecd8a7209f23840fec5a90 Mon Sep 17 00:00:00 2001
+Message-ID: <ca8607912b6da3ce87ecd8a7209f23840fec5a90.1696185684.git.vivien@planete-kraus.eu>
+From: Vivien Kraus <vivien@planete-kraus.eu>
+Date: Sun, 1 Oct 2023 20:40:40 +0200
+Subject: [PATCH] Squashed commit of the following:
+
+commit dacff83d872c1dcb563439f98c9b974e244fcd46
+Author: Boian Bonev <bbonev@ipacct.com>
+Date:   Fri Aug 11 23:14:02 2023 +0000
+
+    Export dummies for
+
+     - udev_device_has_current_tag
+     - udev_device_get_current_tags_list_entry
+
+    since the current eudev device database does not support the concept of
+    current tags
+
+commit 7d2123ead5a15d4b2aff70eafc6f7b9b2f6527ac
+Author: Boian Bonev <bbonev@ipacct.com>
+Date:   Fri Aug 11 22:08:27 2023 +0000
+
+    Bump udev version to 251
+---
+ configure.ac                 |  2 +-
+ src/libudev/libudev-device.c | 11 +++++++++++
+ src/libudev/libudev.h        |  2 ++
+ src/libudev/libudev.sym      |  6 ++++++
+ 4 files changed, 20 insertions(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index 3e31b0ebc..069fdfb87 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1,6 +1,6 @@
+ AC_PREREQ([2.68])
+ AC_INIT([eudev],[3.2.12],[https://github.com/gentoo/eudev/issues])
+-AC_SUBST(UDEV_VERSION, 243)
++AC_SUBST(UDEV_VERSION, 251)
+ AC_CONFIG_SRCDIR([src/udev/udevd.c])
+ 
+ AC_USE_SYSTEM_EXTENSIONS
+diff --git a/src/libudev/libudev-device.c b/src/libudev/libudev-device.c
+index d6bc4032a..312d9ee84 100644
+--- a/src/libudev/libudev-device.c
++++ b/src/libudev/libudev-device.c
+@@ -1825,6 +1825,12 @@ _public_ struct udev_list_entry *udev_device_get_tags_list_entry(struct udev_dev
+         return udev_list_get_entry(&udev_device->tags_list);
+ }
+ 
++_public_ struct udev_list_entry *udev_device_get_current_tags_list_entry(struct udev_device *udev_device)
++{
++        // TODO: eudev database does not support current tags
++        return udev_device_get_tags_list_entry(udev_device);
++}
++
+ /**
+  * udev_device_has_tag:
+  * @udev_device: udev device
+@@ -1848,6 +1854,11 @@ _public_ int udev_device_has_tag(struct udev_device *udev_device, const char *ta
+         return false;
+ }
+ 
++_public_ int udev_device_has_current_tag(struct udev_device *udev_device, const char *tag) {
++        // TODO: eudev database does not support current tags
++        return udev_device_has_tag(udev_device, tag);
++}
++
+ #define ENVP_SIZE                        128
+ #define MONITOR_BUF_SIZE                4096
+ static int update_envp_monitor_buf(struct udev_device *udev_device)
+diff --git a/src/libudev/libudev.h b/src/libudev/libudev.h
+index e4bc18970..62fab107f 100644
+--- a/src/libudev/libudev.h
++++ b/src/libudev/libudev.h
+@@ -100,6 +100,7 @@ int udev_device_get_is_initialized(struct udev_device *udev_device);
+ struct udev_list_entry *udev_device_get_devlinks_list_entry(struct udev_device *udev_device);
+ struct udev_list_entry *udev_device_get_properties_list_entry(struct udev_device *udev_device);
+ struct udev_list_entry *udev_device_get_tags_list_entry(struct udev_device *udev_device);
++struct udev_list_entry *udev_device_get_current_tags_list_entry(struct udev_device *udev_device);
+ struct udev_list_entry *udev_device_get_sysattr_list_entry(struct udev_device *udev_device);
+ const char *udev_device_get_property_value(struct udev_device *udev_device, const char *key);
+ const char *udev_device_get_driver(struct udev_device *udev_device);
+@@ -110,6 +111,7 @@ unsigned long long int udev_device_get_usec_since_initialized(struct udev_device
+ const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const char *sysattr);
+ int udev_device_set_sysattr_value(struct udev_device *udev_device, const char *sysattr, char *value);
+ int udev_device_has_tag(struct udev_device *udev_device, const char *tag);
++int udev_device_has_current_tag(struct udev_device *udev_device, const char *tag);
+ 
+ /*
+  * udev_monitor
+diff --git a/src/libudev/libudev.sym b/src/libudev/libudev.sym
+index 76726fca7..d56c2aeab 100644
+--- a/src/libudev/libudev.sym
++++ b/src/libudev/libudev.sym
+@@ -118,3 +118,9 @@ global:
+         udev_queue_flush;
+         udev_queue_get_fd;
+ } LIBUDEV_199;
++
++LIBUDEV_247 {
++global:
++        udev_device_has_current_tag;
++        udev_device_get_current_tags_list_entry;
++} LIBUDEV_215;
+
+base-commit: 2e4dd05900e7b42d96cd7bdd5689c8ee431fb000
+-- 
+2.41.0
+
diff --git a/gnu/packages/patches/eudev-rules-directory.patch b/gnu/packages/patches/eudev-rules-directory.patch
index 54fc01c6d5..c4b1cfae39 100644
--- a/gnu/packages/patches/eudev-rules-directory.patch
+++ b/gnu/packages/patches/eudev-rules-directory.patch
@@ -4,9 +4,9 @@ The old udev 182 supported $UDEV_CONFIG_FILE, which in turn allowed
 the search path to be customized, but eudev no longer has this, hence
 this hack.
 
---- eudev-3.1.5/src/udev/udev-rules.c	2015-10-13 06:22:14.000000000 +0800
-+++ eudev-3.1.5/src/udev/udev-rules.c	2015-10-16 20:45:38.491934336 +0800
-@@ -47,15 +47,11 @@
+--- a/src/udev/udev-rules.c
++++ b/src/udev/udev-rules.c
+@@ -48,16 +48,11 @@ struct uid_gid {
          };
  };
  
@@ -20,11 +20,12 @@ this hack.
 -        "/lib/udev/rules.d",
 -        "/usr/lib/udev/rules.d",
 -#endif
+-        "/usr/local/lib/udev/rules.d",
 +        NULL,			/* placeholder for $EUDEV_RULES_DIRECTORY */
          NULL};
  
  struct udev_rules {
-@@ -1704,6 +1700,9 @@
+@@ -1718,6 +1713,9 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) {
  
          udev_rules_check_timestamp(rules);
  
-- 
2.41.0




^ permalink raw reply related	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v5 1/4] gnu: eudev: Update libudev version to 251.
  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         ` 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
                           ` (2 subsequent siblings)
  3 siblings, 0 replies; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-09-19 11:23 UTC (permalink / raw)
  To: Liliana Marie Prikler, maxim.cournoyer, 66099; +Cc: rg

Eudev has significant improvements from 3.2.12, but they are not released
yet. The package version number has already been bumped to 3.2.14, but since
it is not released yet, the version number is downgraded to 3.2.12.

Everything that eudev searches in "sysconf" (/etc/udev/*) is actually searched
under its installation prefix. The udev-service-type however prepares every
file in /etc/udev, without a prefix.

Eudev has a hardware database that installs descriptions of hardware in /etc,
but they should go to <prefix>/lib prior to being used. The build system can’t
install to /etc, and should not, because this directory is owned by the
udev-service-type. So they are installed directly in <prefix>/lib. Another
file, an empty /etc/udev.conf, is simply ignored.

The hwdb.bin file used to be generated in <prefix>/etc/udev/hwdb.bin, but
since the sysconf dir is now directly /etc, the hwdb.bin index will not be
found under <prefix>/etc/udev/hwdb.bin.

* gnu/packages/linux.scm (eudev): Update to a post-v3.2.12 commit.
[#:phases] <allow-eudev-hwdb>: New phase.
<install-in-lib>: New phase.
<build-hwdb>: Remove phase.
[#:configure-flags]: Set sysconfdir to avoid a prefix.
[native-search-paths]: Add UDEV_HWDB_PATH.
* gnu/packages/patches/eudev-set-version-to-3.2.12.patch: New file.
* gnu/packages/linux.scm (eudev): Use it here.
* gnu/local.mk (dist_patch_DATA): Register it here.
* gnu/packages/patches/eudev-rules-directory.patch: Rebase it.
---
 gnu/local.mk                                  |  1 +
 gnu/packages/linux.scm                        | 55 +++++++++++++------
 .../patches/eudev-rules-directory.patch       |  9 +--
 .../patches/eudev-set-version-to-3.2.12.patch | 25 +++++++++
 4 files changed, 69 insertions(+), 21 deletions(-)
 create mode 100644 gnu/packages/patches/eudev-set-version-to-3.2.12.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 72c9954492..73beb8daff 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1127,6 +1127,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/esmini-use-pkgconfig.patch		\
   %D%/packages/patches/esmtp-add-lesmtp.patch		\
   %D%/packages/patches/eudev-rules-directory.patch		\
+  %D%/packages/patches/eudev-set-version-to-3.2.12.patch	\
   %D%/packages/patches/exercism-disable-self-update.patch	\
   %D%/packages/patches/extempore-unbundle-external-dependencies.patch	\
   %D%/packages/patches/extundelete-e2fsprogs-1.44.patch		\
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 85e3d9845d..e1959fde3d 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -4263,18 +4263,22 @@ (define-public earlyoom
 
 (define-public eudev
   ;; The post-systemd fork, maintained by Gentoo.
+  (define commit
+    "c5bae0b656513463f92808f324f8fcbe34a0b401")
+  (define revision "1")
   (package
     (name "eudev")
-    (version "3.2.11")
+    (version (git-version "3.2.12" revision commit))
     (source (origin
               (method git-fetch)
               (uri (git-reference (url "https://github.com/gentoo/eudev")
-                                  (commit (string-append "v" version))))
+                                  (commit commit)))
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "0dzaqwjnl55f69ird57wb6skahc6l7zs1slsrzqqfhww33icp6av"))
-              (patches (search-patches "eudev-rules-directory.patch"))))
+                "0rqyzmp8kcnxiy1hq13pr2syp4krnf6q97xwlr0bwcd6x4grbak4"))
+              (patches (search-patches "eudev-rules-directory.patch"
+                                       "eudev-set-version-to-3.2.12.patch"))))
     (build-system gnu-build-system)
     (arguments
      (list
@@ -4285,6 +4289,28 @@ (define-public eudev
               (substitute* "man/make.sh"
                 (("/usr/bin/xsltproc")
                  (search-input-file (or native-inputs inputs) "/bin/xsltproc")))))
+          (add-before 'bootstrap 'install-in-lib
+            (lambda _
+              ;; eudev wants to install its provided hwdb files in /etc, but
+              ;; we want them in udevlibexecdir.
+              (copy-file "hwdb/Makefile.am" "hwdb/files.am")
+              (call-with-output-file "hwdb/Makefile.am"
+                (lambda (port)
+                  (format port "udevhwdblibdir = $(udevlibexecdir)/hwdb.d\n")
+                  (format port "include ./files.am")))
+              (substitute* "hwdb/files.am"
+                (("dist_udevhwdb_DATA =")
+                 "dist_udevhwdblib_DATA ="))
+              ;; eudev wants to install a template udev.conf into /etc, but we
+              ;; do not care.
+              (substitute* "src/udev/Makefile.am"
+                (("dist_udevconf_DATA =")
+                 "dist_noinst_DATA ="))
+              ;; eudev thinks we want to make sure /etc/udev/rules.d exists
+              ;; when installing - we do not.
+              (substitute* "rules/Makefile.am"
+                (("\\$\\(MKDIR_P\\) \\$\\(DESTDIR\\)\\$\\(udevconfdir\\)/rules\\.d")
+                 "true"))))
           (add-after 'install 'move-static-library
             (lambda _
               (let ((source (string-append #$output "/lib/libudev.a"))
@@ -4296,19 +4322,14 @@ (define-public eudev
                 ;; such that Libtool looks for it in the usual places.
                 (substitute* (string-append #$output "/lib/libudev.la")
                   (("old_library=.*")
-                   "old_library=''\n")))))
-          (add-after 'install 'build-hwdb
-            (lambda _
-              ;; Build OUT/etc/udev/hwdb.bin.  This allows 'lsusb' and
-              ;; similar tools to display product names.
-              ;;
-              ;; XXX: This can't be done when cross-compiling. Find another way
-              ;; to generate hwdb.bin for cross-built systems.
-              #$@(if (%current-target-system)
-                     #~(#t)
-                     #~((invoke (string-append #$output "/bin/udevadm")
-                                "hwdb" "--update"))))))
-       #:configure-flags #~(list "--enable-manpages")))
+                   "old_library=''\n"))))))
+      #:configure-flags
+      #~(list "--enable-manpages"
+              "--sysconfdir=/etc")))
+    (native-search-paths
+      (list (search-path-specification
+              (variable "UDEV_HWDB_PATH")
+              (files '("lib/udev/hwdb.d")))))
     (native-inputs
      (list autoconf
            automake
diff --git a/gnu/packages/patches/eudev-rules-directory.patch b/gnu/packages/patches/eudev-rules-directory.patch
index 54fc01c6d5..c4b1cfae39 100644
--- a/gnu/packages/patches/eudev-rules-directory.patch
+++ b/gnu/packages/patches/eudev-rules-directory.patch
@@ -4,9 +4,9 @@ The old udev 182 supported $UDEV_CONFIG_FILE, which in turn allowed
 the search path to be customized, but eudev no longer has this, hence
 this hack.
 
---- eudev-3.1.5/src/udev/udev-rules.c	2015-10-13 06:22:14.000000000 +0800
-+++ eudev-3.1.5/src/udev/udev-rules.c	2015-10-16 20:45:38.491934336 +0800
-@@ -47,15 +47,11 @@
+--- a/src/udev/udev-rules.c
++++ b/src/udev/udev-rules.c
+@@ -48,16 +48,11 @@ struct uid_gid {
          };
  };
  
@@ -20,11 +20,12 @@ this hack.
 -        "/lib/udev/rules.d",
 -        "/usr/lib/udev/rules.d",
 -#endif
+-        "/usr/local/lib/udev/rules.d",
 +        NULL,			/* placeholder for $EUDEV_RULES_DIRECTORY */
          NULL};
  
  struct udev_rules {
-@@ -1704,6 +1700,9 @@
+@@ -1718,6 +1713,9 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) {
  
          udev_rules_check_timestamp(rules);
  
diff --git a/gnu/packages/patches/eudev-set-version-to-3.2.12.patch b/gnu/packages/patches/eudev-set-version-to-3.2.12.patch
new file mode 100644
index 0000000000..9221269e08
--- /dev/null
+++ b/gnu/packages/patches/eudev-set-version-to-3.2.12.patch
@@ -0,0 +1,25 @@
+From 6a8fdb8a14dc9e0480c68426edcf3f4b55e9cfe3 Mon Sep 17 00:00:00 2001
+Message-ID: <6a8fdb8a14dc9e0480c68426edcf3f4b55e9cfe3.1696356960.git.vivien@planete-kraus.eu>
+From: Vivien Kraus <vivien@planete-kraus.eu>
+Date: Tue, 3 Oct 2023 20:15:48 +0200
+Subject: [PATCH] Revert "bump version to 3.2.14"
+
+This reverts commit df220edbc585d2e7a08ed8ad90770fefd0e60bb5.
+---
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index 0d9a135bc..069fdfb87 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1,5 +1,5 @@
+ AC_PREREQ([2.68])
+-AC_INIT([eudev],[3.2.14],[https://github.com/gentoo/eudev/issues])
++AC_INIT([eudev],[3.2.12],[https://github.com/gentoo/eudev/issues])
+ AC_SUBST(UDEV_VERSION, 251)
+ AC_CONFIG_SRCDIR([src/udev/udevd.c])
+ 
+-- 
+2.41.0
+
-- 
2.41.0




^ permalink raw reply related	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v6 1/5] gnu: eudev: Update libudev version to 251.
  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               ` Vivien Kraus via Guix-patches via
  2023-10-05  4:50                 ` 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
                                 ` (3 subsequent siblings)
  4 siblings, 1 reply; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-09-19 11:23 UTC (permalink / raw)
  To: Liliana Marie Prikler, maxim.cournoyer, 66099; +Cc: rg

Eudev has significant improvements from 3.2.12, but they are not released
yet. The package version number has already been bumped to 3.2.14, but since
it is not released yet, the version number is downgraded to 3.2.12.

Everything that eudev searches in "sysconf" (/etc/udev/*) is actually searched
under its installation prefix. The udev-service-type however prepares every
file in /etc/udev, without a prefix.

Eudev has a hardware database that installs descriptions of hardware in /etc,
but they should go to <prefix>/lib prior to being used. The build system can’t
install to /etc, and should not, because this directory is owned by the
udev-service-type. So they are installed directly in <prefix>/lib. Another
file, an empty /etc/udev.conf, is simply ignored.

The hwdb.bin file used to be generated in <prefix>/etc/udev/hwdb.bin, but
since the sysconf dir is now directly /etc, the hwdb.bin index will not be
found under <prefix>/etc/udev/hwdb.bin.

* gnu/packages/linux.scm (eudev): Update to a post-v3.2.12 commit.
[#:phases] <allow-eudev-hwdb>: New phase.
<install-in-lib>: New phase.
<build-hwdb>: Remove phase.
[#:configure-flags]: Set sysconfdir to avoid a prefix.
[native-search-paths]: Add UDEV_HWDB_PATH.
* gnu/packages/patches/eudev-set-version-to-3.2.12.patch: New file.
* gnu/packages/linux.scm (eudev): Use it here.
* gnu/local.mk (dist_patch_DATA): Register it here.
* gnu/packages/patches/eudev-rules-directory.patch: Rebase it.
---
 gnu/local.mk                                  |  1 +
 gnu/packages/linux.scm                        | 55 +++++++++++++------
 .../patches/eudev-rules-directory.patch       |  9 +--
 .../patches/eudev-set-version-to-3.2.12.patch | 25 +++++++++
 4 files changed, 69 insertions(+), 21 deletions(-)
 create mode 100644 gnu/packages/patches/eudev-set-version-to-3.2.12.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 72c9954492..73beb8daff 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1127,6 +1127,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/esmini-use-pkgconfig.patch		\
   %D%/packages/patches/esmtp-add-lesmtp.patch		\
   %D%/packages/patches/eudev-rules-directory.patch		\
+  %D%/packages/patches/eudev-set-version-to-3.2.12.patch	\
   %D%/packages/patches/exercism-disable-self-update.patch	\
   %D%/packages/patches/extempore-unbundle-external-dependencies.patch	\
   %D%/packages/patches/extundelete-e2fsprogs-1.44.patch		\
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 85e3d9845d..e1959fde3d 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -4263,18 +4263,22 @@ (define-public earlyoom
 
 (define-public eudev
   ;; The post-systemd fork, maintained by Gentoo.
+  (define commit
+    "c5bae0b656513463f92808f324f8fcbe34a0b401")
+  (define revision "1")
   (package
     (name "eudev")
-    (version "3.2.11")
+    (version (git-version "3.2.12" revision commit))
     (source (origin
               (method git-fetch)
               (uri (git-reference (url "https://github.com/gentoo/eudev")
-                                  (commit (string-append "v" version))))
+                                  (commit commit)))
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "0dzaqwjnl55f69ird57wb6skahc6l7zs1slsrzqqfhww33icp6av"))
-              (patches (search-patches "eudev-rules-directory.patch"))))
+                "0rqyzmp8kcnxiy1hq13pr2syp4krnf6q97xwlr0bwcd6x4grbak4"))
+              (patches (search-patches "eudev-rules-directory.patch"
+                                       "eudev-set-version-to-3.2.12.patch"))))
     (build-system gnu-build-system)
     (arguments
      (list
@@ -4285,6 +4289,28 @@ (define-public eudev
               (substitute* "man/make.sh"
                 (("/usr/bin/xsltproc")
                  (search-input-file (or native-inputs inputs) "/bin/xsltproc")))))
+          (add-before 'bootstrap 'install-in-lib
+            (lambda _
+              ;; eudev wants to install its provided hwdb files in /etc, but
+              ;; we want them in udevlibexecdir.
+              (copy-file "hwdb/Makefile.am" "hwdb/files.am")
+              (call-with-output-file "hwdb/Makefile.am"
+                (lambda (port)
+                  (format port "udevhwdblibdir = $(udevlibexecdir)/hwdb.d\n")
+                  (format port "include ./files.am")))
+              (substitute* "hwdb/files.am"
+                (("dist_udevhwdb_DATA =")
+                 "dist_udevhwdblib_DATA ="))
+              ;; eudev wants to install a template udev.conf into /etc, but we
+              ;; do not care.
+              (substitute* "src/udev/Makefile.am"
+                (("dist_udevconf_DATA =")
+                 "dist_noinst_DATA ="))
+              ;; eudev thinks we want to make sure /etc/udev/rules.d exists
+              ;; when installing - we do not.
+              (substitute* "rules/Makefile.am"
+                (("\\$\\(MKDIR_P\\) \\$\\(DESTDIR\\)\\$\\(udevconfdir\\)/rules\\.d")
+                 "true"))))
           (add-after 'install 'move-static-library
             (lambda _
               (let ((source (string-append #$output "/lib/libudev.a"))
@@ -4296,19 +4322,14 @@ (define-public eudev
                 ;; such that Libtool looks for it in the usual places.
                 (substitute* (string-append #$output "/lib/libudev.la")
                   (("old_library=.*")
-                   "old_library=''\n")))))
-          (add-after 'install 'build-hwdb
-            (lambda _
-              ;; Build OUT/etc/udev/hwdb.bin.  This allows 'lsusb' and
-              ;; similar tools to display product names.
-              ;;
-              ;; XXX: This can't be done when cross-compiling. Find another way
-              ;; to generate hwdb.bin for cross-built systems.
-              #$@(if (%current-target-system)
-                     #~(#t)
-                     #~((invoke (string-append #$output "/bin/udevadm")
-                                "hwdb" "--update"))))))
-       #:configure-flags #~(list "--enable-manpages")))
+                   "old_library=''\n"))))))
+      #:configure-flags
+      #~(list "--enable-manpages"
+              "--sysconfdir=/etc")))
+    (native-search-paths
+      (list (search-path-specification
+              (variable "UDEV_HWDB_PATH")
+              (files '("lib/udev/hwdb.d")))))
     (native-inputs
      (list autoconf
            automake
diff --git a/gnu/packages/patches/eudev-rules-directory.patch b/gnu/packages/patches/eudev-rules-directory.patch
index 54fc01c6d5..c4b1cfae39 100644
--- a/gnu/packages/patches/eudev-rules-directory.patch
+++ b/gnu/packages/patches/eudev-rules-directory.patch
@@ -4,9 +4,9 @@ The old udev 182 supported $UDEV_CONFIG_FILE, which in turn allowed
 the search path to be customized, but eudev no longer has this, hence
 this hack.
 
---- eudev-3.1.5/src/udev/udev-rules.c	2015-10-13 06:22:14.000000000 +0800
-+++ eudev-3.1.5/src/udev/udev-rules.c	2015-10-16 20:45:38.491934336 +0800
-@@ -47,15 +47,11 @@
+--- a/src/udev/udev-rules.c
++++ b/src/udev/udev-rules.c
+@@ -48,16 +48,11 @@ struct uid_gid {
          };
  };
  
@@ -20,11 +20,12 @@ this hack.
 -        "/lib/udev/rules.d",
 -        "/usr/lib/udev/rules.d",
 -#endif
+-        "/usr/local/lib/udev/rules.d",
 +        NULL,			/* placeholder for $EUDEV_RULES_DIRECTORY */
          NULL};
  
  struct udev_rules {
-@@ -1704,6 +1700,9 @@
+@@ -1718,6 +1713,9 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) {
  
          udev_rules_check_timestamp(rules);
  
diff --git a/gnu/packages/patches/eudev-set-version-to-3.2.12.patch b/gnu/packages/patches/eudev-set-version-to-3.2.12.patch
new file mode 100644
index 0000000000..9221269e08
--- /dev/null
+++ b/gnu/packages/patches/eudev-set-version-to-3.2.12.patch
@@ -0,0 +1,25 @@
+From 6a8fdb8a14dc9e0480c68426edcf3f4b55e9cfe3 Mon Sep 17 00:00:00 2001
+Message-ID: <6a8fdb8a14dc9e0480c68426edcf3f4b55e9cfe3.1696356960.git.vivien@planete-kraus.eu>
+From: Vivien Kraus <vivien@planete-kraus.eu>
+Date: Tue, 3 Oct 2023 20:15:48 +0200
+Subject: [PATCH] Revert "bump version to 3.2.14"
+
+This reverts commit df220edbc585d2e7a08ed8ad90770fefd0e60bb5.
+---
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index 0d9a135bc..069fdfb87 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1,5 +1,5 @@
+ AC_PREREQ([2.68])
+-AC_INIT([eudev],[3.2.14],[https://github.com/gentoo/eudev/issues])
++AC_INIT([eudev],[3.2.12],[https://github.com/gentoo/eudev/issues])
+ AC_SUBST(UDEV_VERSION, 251)
+ AC_CONFIG_SRCDIR([src/udev/udevd.c])
+ 
+-- 
+2.41.0
+
-- 
2.41.0




^ permalink raw reply related	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v7 1/5] gnu: eudev: Update libudev version to 251.
  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                     ` 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
                                       ` (4 subsequent siblings)
  5 siblings, 1 reply; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-09-19 11:23 UTC (permalink / raw)
  To: Liliana Marie Prikler, maxim.cournoyer, 66099; +Cc: rg

Eudev has significant improvements from 3.2.12, but they are not released
yet. The package version number has already been bumped to 3.2.14, but since
it is not released yet, we still advertise it as 3.2.12.

Everything that eudev searches in "sysconf" (/etc/udev/*) is actually searched
under its installation prefix. The udev-service-type however prepares every
file in /etc/udev, without a prefix.

Eudev has a hardware database that installs descriptions of hardware in /etc,
but they should go to <prefix>/lib prior to being used. The build system can’t
install to /etc, and should not, because this directory is owned by the
udev-service-type. So they are installed directly in <prefix>/lib. Another
file, an empty /etc/udev.conf, is simply ignored.

The hwdb.bin file used to be generated in <prefix>/etc/udev/hwdb.bin, but
since the sysconf dir is now directly /etc, the hwdb.bin index will not be
found under <prefix>/etc/udev/hwdb.bin.

* gnu/packages/linux.scm (eudev): Update to a post-v3.2.12 commit.
[snippet]: New snippet to override the version number.
[modules]: Import (guix build utils).
[#:phases] <allow-eudev-hwdb>: New phase.
<install-in-lib>: New phase.
<build-hwdb>: Remove phase.
[#:configure-flags]: Set sysconfdir to avoid a prefix.
[native-search-paths]: Add UDEV_HWDB_PATH.
* gnu/packages/patches/eudev-rules-directory.patch: Rebase it.
---
 gnu/packages/linux.scm                        | 64 ++++++++++++++-----
 .../patches/eudev-rules-directory.patch       |  9 +--
 2 files changed, 52 insertions(+), 21 deletions(-)

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 85e3d9845d..e75ed0b233 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -4263,18 +4263,31 @@ (define-public earlyoom
 
 (define-public eudev
   ;; The post-systemd fork, maintained by Gentoo.
+  (define commit
+    "c5bae0b656513463f92808f324f8fcbe34a0b401")
+  (define revision "1")
   (package
     (name "eudev")
-    (version "3.2.11")
+    ;; Remove the snippet when upgrading to a released version
+    (version (git-version "3.2.12" revision commit))
     (source (origin
               (method git-fetch)
               (uri (git-reference (url "https://github.com/gentoo/eudev")
-                                  (commit (string-append "v" version))))
+                                  (commit commit)))
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "0dzaqwjnl55f69ird57wb6skahc6l7zs1slsrzqqfhww33icp6av"))
-              (patches (search-patches "eudev-rules-directory.patch"))))
+                "0rqyzmp8kcnxiy1hq13pr2syp4krnf6q97xwlr0bwcd6x4grbak4"))
+              (patches (search-patches "eudev-rules-directory.patch"))
+              (modules '((guix build utils)))
+              (snippet
+               #~(begin
+                   ;; configure.ac uses 3.2.14 as the version number, but it
+                   ;; is not released yet. Remove the snippet once a later
+                   ;; version is released.
+                   (substitute* "configure.ac"
+                     (("AC_INIT\\(\\[eudev\\],\\[3.2.14\\]")
+                      "AC_INIT([eudev],[3.2.12]"))))))
     (build-system gnu-build-system)
     (arguments
      (list
@@ -4285,6 +4298,28 @@ (define-public eudev
               (substitute* "man/make.sh"
                 (("/usr/bin/xsltproc")
                  (search-input-file (or native-inputs inputs) "/bin/xsltproc")))))
+          (add-before 'bootstrap 'install-in-lib
+            (lambda _
+              ;; eudev wants to install its provided hwdb files in /etc, but
+              ;; we want them in udevlibexecdir.
+              (copy-file "hwdb/Makefile.am" "hwdb/files.am")
+              (call-with-output-file "hwdb/Makefile.am"
+                (lambda (port)
+                  (format port "udevhwdblibdir = $(udevlibexecdir)/hwdb.d\n")
+                  (format port "include ./files.am")))
+              (substitute* "hwdb/files.am"
+                (("dist_udevhwdb_DATA =")
+                 "dist_udevhwdblib_DATA ="))
+              ;; eudev wants to install a template udev.conf into /etc, but we
+              ;; do not care.
+              (substitute* "src/udev/Makefile.am"
+                (("dist_udevconf_DATA =")
+                 "dist_noinst_DATA ="))
+              ;; eudev thinks we want to make sure /etc/udev/rules.d exists
+              ;; when installing - we do not.
+              (substitute* "rules/Makefile.am"
+                (("\\$\\(MKDIR_P\\) \\$\\(DESTDIR\\)\\$\\(udevconfdir\\)/rules\\.d")
+                 "true"))))
           (add-after 'install 'move-static-library
             (lambda _
               (let ((source (string-append #$output "/lib/libudev.a"))
@@ -4296,19 +4331,14 @@ (define-public eudev
                 ;; such that Libtool looks for it in the usual places.
                 (substitute* (string-append #$output "/lib/libudev.la")
                   (("old_library=.*")
-                   "old_library=''\n")))))
-          (add-after 'install 'build-hwdb
-            (lambda _
-              ;; Build OUT/etc/udev/hwdb.bin.  This allows 'lsusb' and
-              ;; similar tools to display product names.
-              ;;
-              ;; XXX: This can't be done when cross-compiling. Find another way
-              ;; to generate hwdb.bin for cross-built systems.
-              #$@(if (%current-target-system)
-                     #~(#t)
-                     #~((invoke (string-append #$output "/bin/udevadm")
-                                "hwdb" "--update"))))))
-       #:configure-flags #~(list "--enable-manpages")))
+                   "old_library=''\n"))))))
+      #:configure-flags
+      #~(list "--enable-manpages"
+              "--sysconfdir=/etc")))
+    (native-search-paths
+      (list (search-path-specification
+              (variable "UDEV_HWDB_PATH")
+              (files '("lib/udev/hwdb.d")))))
     (native-inputs
      (list autoconf
            automake
diff --git a/gnu/packages/patches/eudev-rules-directory.patch b/gnu/packages/patches/eudev-rules-directory.patch
index 54fc01c6d5..c4b1cfae39 100644
--- a/gnu/packages/patches/eudev-rules-directory.patch
+++ b/gnu/packages/patches/eudev-rules-directory.patch
@@ -4,9 +4,9 @@ The old udev 182 supported $UDEV_CONFIG_FILE, which in turn allowed
 the search path to be customized, but eudev no longer has this, hence
 this hack.
 
---- eudev-3.1.5/src/udev/udev-rules.c	2015-10-13 06:22:14.000000000 +0800
-+++ eudev-3.1.5/src/udev/udev-rules.c	2015-10-16 20:45:38.491934336 +0800
-@@ -47,15 +47,11 @@
+--- a/src/udev/udev-rules.c
++++ b/src/udev/udev-rules.c
+@@ -48,16 +48,11 @@ struct uid_gid {
          };
  };
  
@@ -20,11 +20,12 @@ this hack.
 -        "/lib/udev/rules.d",
 -        "/usr/lib/udev/rules.d",
 -#endif
+-        "/usr/local/lib/udev/rules.d",
 +        NULL,			/* placeholder for $EUDEV_RULES_DIRECTORY */
          NULL};
  
  struct udev_rules {
-@@ -1704,6 +1700,9 @@
+@@ -1718,6 +1713,9 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) {
  
          udev_rules_check_timestamp(rules);
  
-- 
2.41.0




^ permalink raw reply related	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v8 1/6] gnu: eudev: Update to 3.2.14.
  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                           ` 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
                                             ` (5 subsequent siblings)
  6 siblings, 1 reply; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-09-19 11:23 UTC (permalink / raw)
  To: Liliana Marie Prikler, Maxim Cournoyer, 66099; +Cc: rg

Everything that eudev searches in "sysconf" is actually searched under
/gnu/store/.../etc/udev, as autoconf defines sysconfdir under $prefix by
default. The udev-service-type however prepares every file in /etc/udev,
without a prefix. To use /etc/udev as the sysconfdir, we must set it as a
configure flag.

Eudev has a hardware database that installs descriptions of hardware in /etc,
but they can also be installed in <prefix>/lib instead. The manual page
recommends to install all hardware description files into <prefix of
eudev>/lib/udev/hwdb.d, but this directory will be read-only when installing
another hardware-providing package.

udevadm hwdb --update searches for hardware files in /etc/udev/hwdb.d, then
<prefix of eudev>/lib/udev/hwdb.d, then UDEV_HWDB_PATH. Each package providing
hardware descriptions should install them into their respective
<prefix>/lib/udev/hwdb.d, and the udev-service-type is responsible to collect
the relevant hardware descriptions and put them all in /etc/udev/hwdb.d.

The build system tries, but fails, to install hardware files into /etc. A fix
makes it install the hardware files into <prefix>/lib instead. Another file,
an empty /etc/udev.conf, is expected to be installed in /etc/udev, but it is
not needed in guix.

The hwdb.bin file used to be generated in <prefix>/etc/udev/hwdb.bin, but
since the sysconf dir is now directly /etc, the hwdb.bin index will not be
found under <prefix>/etc/udev/hwdb.bin.

* gnu/packages/linux.scm (eudev): Update to 3.2.14.
[modules]: Import (guix build utils).
[#:phases] <allow-eudev-hwdb>: New phase.
<install-in-lib>: New phase.
<build-hwdb>: Remove phase.
[#:configure-flags]: Set sysconfdir to avoid a prefix.
[native-search-paths]: Add UDEV_HWDB_PATH.
* gnu/packages/patches/eudev-rules-directory.patch: Rebase it.
---
 gnu/packages/linux.scm                        | 57 +++++++++++++------
 .../patches/eudev-rules-directory.patch       |  9 +--
 2 files changed, 45 insertions(+), 21 deletions(-)

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 85e3d9845d..c33036b6e0 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -4262,10 +4262,9 @@ (define-public earlyoom
     (license license:expat)))
 
 (define-public eudev
-  ;; The post-systemd fork, maintained by Gentoo.
   (package
     (name "eudev")
-    (version "3.2.11")
+    (version "3.2.14")
     (source (origin
               (method git-fetch)
               (uri (git-reference (url "https://github.com/gentoo/eudev")
@@ -4273,8 +4272,9 @@ (define-public eudev
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "0dzaqwjnl55f69ird57wb6skahc6l7zs1slsrzqqfhww33icp6av"))
-              (patches (search-patches "eudev-rules-directory.patch"))))
+                "1f6lz57igi7iw2ls3fpzgw42bfznam4nf9368h7x8yf1mb737yxz"))
+              (patches (search-patches "eudev-rules-directory.patch"))
+              (modules '((guix build utils)))))
     (build-system gnu-build-system)
     (arguments
      (list
@@ -4285,6 +4285,31 @@ (define-public eudev
               (substitute* "man/make.sh"
                 (("/usr/bin/xsltproc")
                  (search-input-file (or native-inputs inputs) "/bin/xsltproc")))))
+          (add-before 'bootstrap 'install-in-lib
+            (lambda _
+              ;; When the udev-service-type instantiates /etc, it collects
+              ;; hardware files from the <package>/lib/udev/hwdb.d directories
+              ;; of different packages.  Since we set sysconfdir to /etc, the
+              ;; only package-dependent location we can install hwdb files is
+              ;; in <package>/lib/udev/hwdb.d.  Eudev is configured to install
+              ;; these files in sysconfdir, but they should be placed into
+              ;; udevlibexecdir.
+              (copy-file "hwdb/Makefile.am" "hwdb/files.am")
+              (call-with-output-file "hwdb/Makefile.am"
+                (lambda (port)
+                  (format port "udevhwdblibdir = $(udevlibexecdir)/hwdb.d\n")
+                  (format port "include ./files.am")))
+              (substitute* "hwdb/files.am"
+                (("dist_udevhwdb_DATA =")
+                 "dist_udevhwdblib_DATA ="))
+              ;; Do not install the empty udev.conf template.
+              (substitute* "src/udev/Makefile.am"
+                (("dist_udevconf_DATA =")
+                 "dist_noinst_DATA ="))
+              ;; Do not ensure that /etc/udev/rules.d exists.
+              (substitute* "rules/Makefile.am"
+                (("\\$\\(MKDIR_P\\) \\$\\(DESTDIR\\)\\$\\(udevconfdir\\)/rules\\.d")
+                 "true"))))
           (add-after 'install 'move-static-library
             (lambda _
               (let ((source (string-append #$output "/lib/libudev.a"))
@@ -4296,19 +4321,17 @@ (define-public eudev
                 ;; such that Libtool looks for it in the usual places.
                 (substitute* (string-append #$output "/lib/libudev.la")
                   (("old_library=.*")
-                   "old_library=''\n")))))
-          (add-after 'install 'build-hwdb
-            (lambda _
-              ;; Build OUT/etc/udev/hwdb.bin.  This allows 'lsusb' and
-              ;; similar tools to display product names.
-              ;;
-              ;; XXX: This can't be done when cross-compiling. Find another way
-              ;; to generate hwdb.bin for cross-built systems.
-              #$@(if (%current-target-system)
-                     #~(#t)
-                     #~((invoke (string-append #$output "/bin/udevadm")
-                                "hwdb" "--update"))))))
-       #:configure-flags #~(list "--enable-manpages")))
+                   "old_library=''\n"))))))
+      #:configure-flags
+      #~(list "--enable-manpages"
+              ;; By default, autoconf uses $prefix/etc. The udev-service-type
+              ;; makes sure /etc is set up with rules and hardware file
+              ;; descriptions.
+              "--sysconfdir=/etc")))
+    (native-search-paths
+      (list (search-path-specification
+              (variable "UDEV_HWDB_PATH")
+              (files '("lib/udev/hwdb.d")))))
     (native-inputs
      (list autoconf
            automake
diff --git a/gnu/packages/patches/eudev-rules-directory.patch b/gnu/packages/patches/eudev-rules-directory.patch
index 54fc01c6d5..c4b1cfae39 100644
--- a/gnu/packages/patches/eudev-rules-directory.patch
+++ b/gnu/packages/patches/eudev-rules-directory.patch
@@ -4,9 +4,9 @@ The old udev 182 supported $UDEV_CONFIG_FILE, which in turn allowed
 the search path to be customized, but eudev no longer has this, hence
 this hack.
 
---- eudev-3.1.5/src/udev/udev-rules.c	2015-10-13 06:22:14.000000000 +0800
-+++ eudev-3.1.5/src/udev/udev-rules.c	2015-10-16 20:45:38.491934336 +0800
-@@ -47,15 +47,11 @@
+--- a/src/udev/udev-rules.c
++++ b/src/udev/udev-rules.c
+@@ -48,16 +48,11 @@ struct uid_gid {
          };
  };
  
@@ -20,11 +20,12 @@ this hack.
 -        "/lib/udev/rules.d",
 -        "/usr/lib/udev/rules.d",
 -#endif
+-        "/usr/local/lib/udev/rules.d",
 +        NULL,			/* placeholder for $EUDEV_RULES_DIRECTORY */
          NULL};
  
  struct udev_rules {
-@@ -1704,6 +1700,9 @@
+@@ -1718,6 +1713,9 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) {
  
          udev_rules_check_timestamp(rules);
  
-- 
2.41.0




^ permalink raw reply related	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v9 1/7] gnu: eudev: Update to 3.2.14.
  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                                 ` 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
                                                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-09-19 11:23 UTC (permalink / raw)
  To: Liliana Marie Prikler, Maxim Cournoyer, 66099; +Cc: rg

Eudev now has a hardware database /etc/udev/hwdb.bin made up of descriptions
installed in the /lib/udev/hwdb.d directory of each package, and more
generally, UDEV_HWDB_PATH.  This database index is compiled with udevadm hwdb
--update.  The udev-service-type collects the files and compiles the index.
Previously, the hardware description files provided by eudev would be compiled
into $prefix/etc/udev/hwdb.bin in the eudev output.

* gnu/packages/linux.scm (eudev): Update to 3.2.14.
[modules]: Import (guix build utils).
[#:phases] <allow-eudev-hwdb>: New phase.
<install-in-lib>: New phase.
<build-hwdb>: Remove phase.
[#:configure-flags]: Set sysconfdir to avoid a prefix.
[native-search-paths]: Add UDEV_HWDB_PATH.
* gnu/packages/patches/eudev-rules-directory.patch: Rebase it.
---
 gnu/packages/linux.scm                        | 57 +++++++++++++------
 .../patches/eudev-rules-directory.patch       |  9 +--
 2 files changed, 45 insertions(+), 21 deletions(-)

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 85e3d9845d..f552ccccae 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -4262,10 +4262,9 @@ (define-public earlyoom
     (license license:expat)))
 
 (define-public eudev
-  ;; The post-systemd fork, maintained by Gentoo.
   (package
     (name "eudev")
-    (version "3.2.11")
+    (version "3.2.14")
     (source (origin
               (method git-fetch)
               (uri (git-reference (url "https://github.com/gentoo/eudev")
@@ -4273,8 +4272,9 @@ (define-public eudev
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "0dzaqwjnl55f69ird57wb6skahc6l7zs1slsrzqqfhww33icp6av"))
-              (patches (search-patches "eudev-rules-directory.patch"))))
+                "1f6lz57igi7iw2ls3fpzgw42bfznam4nf9368h7x8yf1mb737yxz"))
+              (patches (search-patches "eudev-rules-directory.patch"))
+              (modules '((guix build utils)))))
     (build-system gnu-build-system)
     (arguments
      (list
@@ -4285,6 +4285,31 @@ (define-public eudev
               (substitute* "man/make.sh"
                 (("/usr/bin/xsltproc")
                  (search-input-file (or native-inputs inputs) "/bin/xsltproc")))))
+          (add-before 'bootstrap 'install-in-lib
+            (lambda _
+              ;; When the udev-service-type instantiates /etc, it collects
+              ;; hardware files from the <package>/lib/udev/hwdb.d directories
+              ;; of different packages.  Since we set sysconfdir to /etc, the
+              ;; only package-dependent location we can install hwdb files is
+              ;; in <package>/lib/udev/hwdb.d.  Eudev is configured to install
+              ;; these files in sysconfdir, but they should be placed into
+              ;; udevlibexecdir.
+              (copy-file "hwdb/Makefile.am" "hwdb/files.am")
+              (call-with-output-file "hwdb/Makefile.am"
+                (lambda (port)
+                  (format port "hardwarelibdir = $(udevlibexecdir)/hwdb.d\n")
+                  (format port "include ./files.am")))
+              (substitute* "hwdb/files.am"
+                (("dist_udevhwdb_DATA =")
+                 "dist_hardwarelib_DATA ="))
+              ;; Do not install the empty udev.conf template.
+              (substitute* "src/udev/Makefile.am"
+                (("dist_udevconf_DATA =")
+                 "dist_noinst_DATA ="))
+              ;; Do not ensure that /etc/udev/rules.d exists.
+              (substitute* "rules/Makefile.am"
+                (("\\$\\(MKDIR_P\\) \\$\\(DESTDIR\\)\\$\\(udevconfdir\\)/rules\\.d")
+                 "true"))))
           (add-after 'install 'move-static-library
             (lambda _
               (let ((source (string-append #$output "/lib/libudev.a"))
@@ -4296,19 +4321,17 @@ (define-public eudev
                 ;; such that Libtool looks for it in the usual places.
                 (substitute* (string-append #$output "/lib/libudev.la")
                   (("old_library=.*")
-                   "old_library=''\n")))))
-          (add-after 'install 'build-hwdb
-            (lambda _
-              ;; Build OUT/etc/udev/hwdb.bin.  This allows 'lsusb' and
-              ;; similar tools to display product names.
-              ;;
-              ;; XXX: This can't be done when cross-compiling. Find another way
-              ;; to generate hwdb.bin for cross-built systems.
-              #$@(if (%current-target-system)
-                     #~(#t)
-                     #~((invoke (string-append #$output "/bin/udevadm")
-                                "hwdb" "--update"))))))
-       #:configure-flags #~(list "--enable-manpages")))
+                   "old_library=''\n"))))))
+      #:configure-flags
+      #~(list "--enable-manpages"
+              ;; By default, autoconf uses $prefix/etc. The udev-service-type
+              ;; makes sure /etc is set up with rules and hardware file
+              ;; descriptions.
+              "--sysconfdir=/etc")))
+    (native-search-paths
+      (list (search-path-specification
+              (variable "UDEV_HWDB_PATH")
+              (files '("lib/udev/hwdb.d")))))
     (native-inputs
      (list autoconf
            automake
diff --git a/gnu/packages/patches/eudev-rules-directory.patch b/gnu/packages/patches/eudev-rules-directory.patch
index 54fc01c6d5..c4b1cfae39 100644
--- a/gnu/packages/patches/eudev-rules-directory.patch
+++ b/gnu/packages/patches/eudev-rules-directory.patch
@@ -4,9 +4,9 @@ The old udev 182 supported $UDEV_CONFIG_FILE, which in turn allowed
 the search path to be customized, but eudev no longer has this, hence
 this hack.
 
---- eudev-3.1.5/src/udev/udev-rules.c	2015-10-13 06:22:14.000000000 +0800
-+++ eudev-3.1.5/src/udev/udev-rules.c	2015-10-16 20:45:38.491934336 +0800
-@@ -47,15 +47,11 @@
+--- a/src/udev/udev-rules.c
++++ b/src/udev/udev-rules.c
+@@ -48,16 +48,11 @@ struct uid_gid {
          };
  };
  
@@ -20,11 +20,12 @@ this hack.
 -        "/lib/udev/rules.d",
 -        "/usr/lib/udev/rules.d",
 -#endif
+-        "/usr/local/lib/udev/rules.d",
 +        NULL,			/* placeholder for $EUDEV_RULES_DIRECTORY */
          NULL};
  
  struct udev_rules {
-@@ -1704,6 +1700,9 @@
+@@ -1718,6 +1713,9 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) {
  
          udev_rules_check_timestamp(rules);
  
-- 
2.41.0




^ permalink raw reply related	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v10 1/6] gnu: eudev: Update to 3.2.14.
  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                                       ` 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-10 23:44                                       ` [bug#66099] [PATCH gnome-team v10 0/6] Exact same, without the last patch Maxim Cournoyer
  1 sibling, 1 reply; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-09-19 11:23 UTC (permalink / raw)
  To: Maxim Cournoyer, Liliana Marie Prikler, 66099; +Cc: rg

Eudev now has a hardware database /etc/udev/hwdb.bin made up of descriptions
installed in the /lib/udev/hwdb.d directory of each package, and more
generally, UDEV_HWDB_PATH.  This database index is compiled with udevadm hwdb
--update.  The udev-service-type collects the files and compiles the index.
Previously, the hardware description files provided by eudev would be compiled
into $prefix/etc/udev/hwdb.bin in the eudev output.

* gnu/packages/linux.scm (eudev): Update to 3.2.14.
[modules]: Import (guix build utils).
[#:phases] <allow-eudev-hwdb>: New phase.
<install-in-lib>: New phase.
<build-hwdb>: Remove phase.
[#:configure-flags]: Set sysconfdir to avoid a prefix.
[native-search-paths]: Add UDEV_HWDB_PATH.
* gnu/packages/patches/eudev-rules-directory.patch: Rebase it.
---
 gnu/packages/linux.scm                        | 57 +++++++++++++------
 .../patches/eudev-rules-directory.patch       |  9 +--
 2 files changed, 45 insertions(+), 21 deletions(-)

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index c993e7b9bb..c5049843eb 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -4327,10 +4327,9 @@ (define-public earlyoom
     (license license:expat)))
 
 (define-public eudev
-  ;; The post-systemd fork, maintained by Gentoo.
   (package
     (name "eudev")
-    (version "3.2.11")
+    (version "3.2.14")
     (source (origin
               (method git-fetch)
               (uri (git-reference (url "https://github.com/gentoo/eudev")
@@ -4338,8 +4337,9 @@ (define-public eudev
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "0dzaqwjnl55f69ird57wb6skahc6l7zs1slsrzqqfhww33icp6av"))
-              (patches (search-patches "eudev-rules-directory.patch"))))
+                "1f6lz57igi7iw2ls3fpzgw42bfznam4nf9368h7x8yf1mb737yxz"))
+              (patches (search-patches "eudev-rules-directory.patch"))
+              (modules '((guix build utils)))))
     (build-system gnu-build-system)
     (arguments
      (list
@@ -4350,6 +4350,31 @@ (define-public eudev
               (substitute* "man/make.sh"
                 (("/usr/bin/xsltproc")
                  (search-input-file (or native-inputs inputs) "/bin/xsltproc")))))
+          (add-before 'bootstrap 'install-in-lib
+            (lambda _
+              ;; When the udev-service-type instantiates /etc, it collects
+              ;; hardware files from the <package>/lib/udev/hwdb.d directories
+              ;; of different packages.  Since we set sysconfdir to /etc, the
+              ;; only package-dependent location we can install hwdb files is
+              ;; in <package>/lib/udev/hwdb.d.  Eudev is configured to install
+              ;; these files in sysconfdir, but they should be placed into
+              ;; udevlibexecdir.
+              (copy-file "hwdb/Makefile.am" "hwdb/files.am")
+              (call-with-output-file "hwdb/Makefile.am"
+                (lambda (port)
+                  (format port "hardwarelibdir = $(udevlibexecdir)/hwdb.d\n")
+                  (format port "include ./files.am")))
+              (substitute* "hwdb/files.am"
+                (("dist_udevhwdb_DATA =")
+                 "dist_hardwarelib_DATA ="))
+              ;; Do not install the empty udev.conf template.
+              (substitute* "src/udev/Makefile.am"
+                (("dist_udevconf_DATA =")
+                 "dist_noinst_DATA ="))
+              ;; Do not ensure that /etc/udev/rules.d exists.
+              (substitute* "rules/Makefile.am"
+                (("\\$\\(MKDIR_P\\) \\$\\(DESTDIR\\)\\$\\(udevconfdir\\)/rules\\.d")
+                 "true"))))
           (add-after 'install 'move-static-library
             (lambda _
               (let ((source (string-append #$output "/lib/libudev.a"))
@@ -4361,19 +4386,17 @@ (define-public eudev
                 ;; such that Libtool looks for it in the usual places.
                 (substitute* (string-append #$output "/lib/libudev.la")
                   (("old_library=.*")
-                   "old_library=''\n")))))
-          (add-after 'install 'build-hwdb
-            (lambda _
-              ;; Build OUT/etc/udev/hwdb.bin.  This allows 'lsusb' and
-              ;; similar tools to display product names.
-              ;;
-              ;; XXX: This can't be done when cross-compiling. Find another way
-              ;; to generate hwdb.bin for cross-built systems.
-              #$@(if (%current-target-system)
-                     #~(#t)
-                     #~((invoke (string-append #$output "/bin/udevadm")
-                                "hwdb" "--update"))))))
-       #:configure-flags #~(list "--enable-manpages")))
+                   "old_library=''\n"))))))
+      #:configure-flags
+      #~(list "--enable-manpages"
+              ;; By default, autoconf uses $prefix/etc. The udev-service-type
+              ;; makes sure /etc is set up with rules and hardware file
+              ;; descriptions.
+              "--sysconfdir=/etc")))
+    (native-search-paths
+      (list (search-path-specification
+              (variable "UDEV_HWDB_PATH")
+              (files '("lib/udev/hwdb.d")))))
     (native-inputs
      (list autoconf
            automake
diff --git a/gnu/packages/patches/eudev-rules-directory.patch b/gnu/packages/patches/eudev-rules-directory.patch
index 54fc01c6d5..c4b1cfae39 100644
--- a/gnu/packages/patches/eudev-rules-directory.patch
+++ b/gnu/packages/patches/eudev-rules-directory.patch
@@ -4,9 +4,9 @@ The old udev 182 supported $UDEV_CONFIG_FILE, which in turn allowed
 the search path to be customized, but eudev no longer has this, hence
 this hack.
 
---- eudev-3.1.5/src/udev/udev-rules.c	2015-10-13 06:22:14.000000000 +0800
-+++ eudev-3.1.5/src/udev/udev-rules.c	2015-10-16 20:45:38.491934336 +0800
-@@ -47,15 +47,11 @@
+--- a/src/udev/udev-rules.c
++++ b/src/udev/udev-rules.c
+@@ -48,16 +48,11 @@ struct uid_gid {
          };
  };
  
@@ -20,11 +20,12 @@ this hack.
 -        "/lib/udev/rules.d",
 -        "/usr/lib/udev/rules.d",
 -#endif
+-        "/usr/local/lib/udev/rules.d",
 +        NULL,			/* placeholder for $EUDEV_RULES_DIRECTORY */
          NULL};
  
  struct udev_rules {
-@@ -1704,6 +1700,9 @@
+@@ -1718,6 +1713,9 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) {
  
          udev_rules_check_timestamp(rules);
  
-- 
2.41.0




^ permalink raw reply related	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team 2/3] gnu: libgudev: Update to 238.
  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 ` 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
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-09-19 11:32 UTC (permalink / raw)
  To: 66099; +Cc: liliana.prikler, maxim.cournoyer, rg

* gnu/packages/gnome.scm (libgudev): Update to 238.
---
 gnu/packages/gnome.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index 2077478ff2..f87ad4b063 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -6883,14 +6883,14 @@ (define-public eog-plugins
 (define-public libgudev
   (package
     (name "libgudev")
-    (version "236")
+    (version "238")
     (source (origin
               (method url-fetch)
               (uri (string-append "mirror://gnome/sources/" name "/"
                                   version "/" name "-" version ".tar.xz"))
               (sha256
                (base32
-                "094mgjmwgsgqrr1i0vd20ynvlkihvs3vgbmpbrhswjsrdp86j0z5"))))
+                "1laxgdkgmr30aw44sm4rgpsdybwxx5rszcm8c2y3vmy9myqnl9k1"))))
     (build-system meson-build-system)
     (native-inputs
      `(("glib:bin" ,glib "bin") ; for glib-genmarshal, etc.
-- 
2.41.0




^ permalink raw reply related	[flat|nested] 91+ messages in thread

* [bug#66099] [WIP PATCH gnome-team v2 2/3] gnu: libgudev: Update to 238.
  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           ` 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
  2 siblings, 0 replies; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-09-19 11:32 UTC (permalink / raw)
  To: Liliana Marie Prikler, 66099; +Cc: rg, maxim.cournoyer

* gnu/packages/gnome.scm (libgudev): Update to 238.
---
 gnu/packages/gnome.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index eaceb76e1e..4ea3dc455a 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -6899,14 +6899,14 @@ (define-public eog-plugins
 (define-public libgudev
   (package
     (name "libgudev")
-    (version "236")
+    (version "238")
     (source (origin
               (method url-fetch)
               (uri (string-append "mirror://gnome/sources/" name "/"
                                   version "/" name "-" version ".tar.xz"))
               (sha256
                (base32
-                "094mgjmwgsgqrr1i0vd20ynvlkihvs3vgbmpbrhswjsrdp86j0z5"))))
+                "1laxgdkgmr30aw44sm4rgpsdybwxx5rszcm8c2y3vmy9myqnl9k1"))))
     (build-system meson-build-system)
     (native-inputs
      `(("glib:bin" ,glib "bin") ; for glib-genmarshal, etc.
-- 
2.41.0




^ permalink raw reply related	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v3 2/3] gnu: libgudev: Update to 238.
  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-19 11:32           ` 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
  2 siblings, 1 reply; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-09-19 11:32 UTC (permalink / raw)
  To: Liliana Marie Prikler, 66099; +Cc: rg, maxim.cournoyer

* gnu/packages/gnome.scm (libgudev): Update to 238.
---
 gnu/packages/gnome.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index eaceb76e1e..4ea3dc455a 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -6899,14 +6899,14 @@ (define-public eog-plugins
 (define-public libgudev
   (package
     (name "libgudev")
-    (version "236")
+    (version "238")
     (source (origin
               (method url-fetch)
               (uri (string-append "mirror://gnome/sources/" name "/"
                                   version "/" name "-" version ".tar.xz"))
               (sha256
                (base32
-                "094mgjmwgsgqrr1i0vd20ynvlkihvs3vgbmpbrhswjsrdp86j0z5"))))
+                "1laxgdkgmr30aw44sm4rgpsdybwxx5rszcm8c2y3vmy9myqnl9k1"))))
     (build-system meson-build-system)
     (native-inputs
      `(("glib:bin" ,glib "bin") ; for glib-genmarshal, etc.
-- 
2.41.0




^ permalink raw reply related	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v4 3/4] gnu: libgudev: Update to 238.
  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-09-19 11:32   ` 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-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
  3 siblings, 0 replies; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-09-19 11:32 UTC (permalink / raw)
  To: Liliana Marie Prikler, 66099; +Cc: rg, maxim.cournoyer

* gnu/packages/gnome.scm (libgudev): Update to 238.
---
 gnu/packages/gnome.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index eaceb76e1e..4ea3dc455a 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -6899,14 +6899,14 @@ (define-public eog-plugins
 (define-public libgudev
   (package
     (name "libgudev")
-    (version "236")
+    (version "238")
     (source (origin
               (method url-fetch)
               (uri (string-append "mirror://gnome/sources/" name "/"
                                   version "/" name "-" version ".tar.xz"))
               (sha256
                (base32
-                "094mgjmwgsgqrr1i0vd20ynvlkihvs3vgbmpbrhswjsrdp86j0z5"))))
+                "1laxgdkgmr30aw44sm4rgpsdybwxx5rszcm8c2y3vmy9myqnl9k1"))))
     (build-system meson-build-system)
     (native-inputs
      `(("glib:bin" ,glib "bin") ; for glib-genmarshal, etc.
-- 
2.41.0




^ permalink raw reply related	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v5 3/4] gnu: libgudev: Update to 238.
  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         ` 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
  3 siblings, 0 replies; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-09-19 11:32 UTC (permalink / raw)
  To: Liliana Marie Prikler, maxim.cournoyer, 66099; +Cc: rg

* gnu/packages/gnome.scm (libgudev): Update to 238.
---
 gnu/packages/gnome.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index eaceb76e1e..4ea3dc455a 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -6899,14 +6899,14 @@ (define-public eog-plugins
 (define-public libgudev
   (package
     (name "libgudev")
-    (version "236")
+    (version "238")
     (source (origin
               (method url-fetch)
               (uri (string-append "mirror://gnome/sources/" name "/"
                                   version "/" name "-" version ".tar.xz"))
               (sha256
                (base32
-                "094mgjmwgsgqrr1i0vd20ynvlkihvs3vgbmpbrhswjsrdp86j0z5"))))
+                "1laxgdkgmr30aw44sm4rgpsdybwxx5rszcm8c2y3vmy9myqnl9k1"))))
     (build-system meson-build-system)
     (native-inputs
      `(("glib:bin" ,glib "bin") ; for glib-genmarshal, etc.
-- 
2.41.0




^ permalink raw reply related	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v6 4/5] gnu: libgudev: Update to 238.
  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-09-19 11:32               ` 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
                                 ` (2 subsequent siblings)
  4 siblings, 0 replies; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-09-19 11:32 UTC (permalink / raw)
  To: Liliana Marie Prikler, maxim.cournoyer, 66099; +Cc: rg

* gnu/packages/gnome.scm (libgudev): Update to 238.
---
 gnu/packages/gnome.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index eaceb76e1e..4ea3dc455a 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -6899,14 +6899,14 @@ (define-public eog-plugins
 (define-public libgudev
   (package
     (name "libgudev")
-    (version "236")
+    (version "238")
     (source (origin
               (method url-fetch)
               (uri (string-append "mirror://gnome/sources/" name "/"
                                   version "/" name "-" version ".tar.xz"))
               (sha256
                (base32
-                "094mgjmwgsgqrr1i0vd20ynvlkihvs3vgbmpbrhswjsrdp86j0z5"))))
+                "1laxgdkgmr30aw44sm4rgpsdybwxx5rszcm8c2y3vmy9myqnl9k1"))))
     (build-system meson-build-system)
     (native-inputs
      `(("glib:bin" ,glib "bin") ; for glib-genmarshal, etc.
-- 
2.41.0




^ permalink raw reply related	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v7 4/5] gnu: libgudev: Update to 238.
  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-09-19 11:32                     ` 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
                                       ` (3 subsequent siblings)
  5 siblings, 1 reply; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-09-19 11:32 UTC (permalink / raw)
  To: Liliana Marie Prikler, maxim.cournoyer, 66099; +Cc: rg

* gnu/packages/gnome.scm (libgudev): Update to 238.
---
 gnu/packages/gnome.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index eaceb76e1e..4ea3dc455a 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -6899,14 +6899,14 @@ (define-public eog-plugins
 (define-public libgudev
   (package
     (name "libgudev")
-    (version "236")
+    (version "238")
     (source (origin
               (method url-fetch)
               (uri (string-append "mirror://gnome/sources/" name "/"
                                   version "/" name "-" version ".tar.xz"))
               (sha256
                (base32
-                "094mgjmwgsgqrr1i0vd20ynvlkihvs3vgbmpbrhswjsrdp86j0z5"))))
+                "1laxgdkgmr30aw44sm4rgpsdybwxx5rszcm8c2y3vmy9myqnl9k1"))))
     (build-system meson-build-system)
     (native-inputs
      `(("glib:bin" ,glib "bin") ; for glib-genmarshal, etc.
-- 
2.41.0




^ permalink raw reply related	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v8 5/6] gnu: libgudev: Update to 238.
  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-09-19 11:32                           ` 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
                                             ` (4 subsequent siblings)
  6 siblings, 0 replies; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-09-19 11:32 UTC (permalink / raw)
  To: Liliana Marie Prikler, Maxim Cournoyer, 66099; +Cc: rg

* gnu/packages/gnome.scm (libgudev): Update to 238.
---
 gnu/packages/gnome.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index eaceb76e1e..4ea3dc455a 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -6899,14 +6899,14 @@ (define-public eog-plugins
 (define-public libgudev
   (package
     (name "libgudev")
-    (version "236")
+    (version "238")
     (source (origin
               (method url-fetch)
               (uri (string-append "mirror://gnome/sources/" name "/"
                                   version "/" name "-" version ".tar.xz"))
               (sha256
                (base32
-                "094mgjmwgsgqrr1i0vd20ynvlkihvs3vgbmpbrhswjsrdp86j0z5"))))
+                "1laxgdkgmr30aw44sm4rgpsdybwxx5rszcm8c2y3vmy9myqnl9k1"))))
     (build-system meson-build-system)
     (native-inputs
      `(("glib:bin" ,glib "bin") ; for glib-genmarshal, etc.
-- 
2.41.0




^ permalink raw reply related	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v9 5/7] gnu: libgudev: Update to 238.
  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                                 ` 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
                                                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-09-19 11:32 UTC (permalink / raw)
  To: Liliana Marie Prikler, Maxim Cournoyer, 66099; +Cc: rg

* gnu/packages/gnome.scm (libgudev): Update to 238.
---
 gnu/packages/gnome.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index eaceb76e1e..4ea3dc455a 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -6899,14 +6899,14 @@ (define-public eog-plugins
 (define-public libgudev
   (package
     (name "libgudev")
-    (version "236")
+    (version "238")
     (source (origin
               (method url-fetch)
               (uri (string-append "mirror://gnome/sources/" name "/"
                                   version "/" name "-" version ".tar.xz"))
               (sha256
                (base32
-                "094mgjmwgsgqrr1i0vd20ynvlkihvs3vgbmpbrhswjsrdp86j0z5"))))
+                "1laxgdkgmr30aw44sm4rgpsdybwxx5rszcm8c2y3vmy9myqnl9k1"))))
     (build-system meson-build-system)
     (native-inputs
      `(("glib:bin" ,glib "bin") ; for glib-genmarshal, etc.
-- 
2.41.0




^ permalink raw reply related	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v10 5/6] gnu: libgudev: Update to 238.
  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                                               ` 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
  0 siblings, 1 reply; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-09-19 11:32 UTC (permalink / raw)
  To: Maxim Cournoyer, Liliana Marie Prikler, 66099; +Cc: rg

* gnu/packages/gnome.scm (libgudev): Update to 238.
---
 gnu/packages/gnome.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index 4ed22d4da0..d8cdd11bd4 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -6899,14 +6899,14 @@ (define-public eog-plugins
 (define-public libgudev
   (package
     (name "libgudev")
-    (version "236")
+    (version "238")
     (source (origin
               (method url-fetch)
               (uri (string-append "mirror://gnome/sources/" name "/"
                                   version "/" name "-" version ".tar.xz"))
               (sha256
                (base32
-                "094mgjmwgsgqrr1i0vd20ynvlkihvs3vgbmpbrhswjsrdp86j0z5"))))
+                "1laxgdkgmr30aw44sm4rgpsdybwxx5rszcm8c2y3vmy9myqnl9k1"))))
     (build-system meson-build-system)
     (native-inputs
      `(("glib:bin" ,glib "bin") ; for glib-genmarshal, etc.
-- 
2.41.0




^ permalink raw reply related	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team 3/3] gnu: upower: Update to 1.90.2.
  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 ` 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-10-01 20:20 ` [bug#66099] [PATCH gnome-team v4 0/4] Update eudev and upower Vivien Kraus via Guix-patches via
  4 siblings, 1 reply; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-09-19 11:32 UTC (permalink / raw)
  To: 66099; +Cc: liliana.prikler, maxim.cournoyer, rg

* gnu/packages/gnome.scm (upower): Update to 1.90.2.
---
 gnu/packages/gnome.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index f87ad4b063..6a544099ab 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -5712,7 +5712,7 @@ (define-public geocode-glib-with-libsoup2
 (define-public upower
   (package
     (name "upower")
-    (version "1.90.0")
+    (version "1.90.2")
     (source
      (origin
        (method git-fetch)
@@ -5721,7 +5721,7 @@ (define-public upower
              (commit (string-append "v" version))))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "1g17rm91p8vfpjyb0k2shylrs55nccn3fa890vlk4n9s71sghbzq"))
+        (base32 "13xp423ycv8imf2cmgf6lii9f01p7x2v19cny7acrmczkc0cqv7d"))
        (modules '((guix build utils)))
        (snippet
         ;; Upstream commit <https://cgit.freedesktop.org/upower/commit/
-- 
2.41.0




^ permalink raw reply related	[flat|nested] 91+ messages in thread

* [bug#66099] [WIP PATCH gnome-team v2 3/3] gnu: upower: Update to 1.90.2.
  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           ` Vivien Kraus via Guix-patches via
  2 siblings, 0 replies; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-09-19 11:32 UTC (permalink / raw)
  To: Liliana Marie Prikler, 66099; +Cc: rg, maxim.cournoyer

The new eudev now can install hwdb files. Upower has some, but they should get
installed in upower’s output, not eudev’s.

The phases needed a rework. Now the 32-bit-specific test fix is always there,
except it may be empty.

Upower tests now requires that upower-provided hwdb files be installed. So I
call udevadm hwdb --update first.

* gnu/packages/gnome.scm (upower): Update to 1.90.2.
[#:configure-flags]: Set udevhwdbdir.
[#:phases] <adjust-test-for-excess-precision>: Add this phase
unconditionnally
<check>: Move it after 'install, and call set up hwdb first.
---
 gnu/packages/gnome.scm | 52 ++++++++++++++++++++++++++++++------------
 1 file changed, 37 insertions(+), 15 deletions(-)

diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index 4ea3dc455a..0c240dbb9a 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -5727,7 +5727,7 @@ (define-public geocode-glib-with-libsoup2
 (define-public upower
   (package
     (name "upower")
-    (version "1.90.0")
+    (version "1.90.2")
     (source
      (origin
        (method git-fetch)
@@ -5736,7 +5736,7 @@ (define-public upower
              (commit (string-append "v" version))))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "1g17rm91p8vfpjyb0k2shylrs55nccn3fa890vlk4n9s71sghbzq"))
+        (base32 "13xp423ycv8imf2cmgf6lii9f01p7x2v19cny7acrmczkc0cqv7d"))
        (modules '((guix build utils)))
        (snippet
         ;; Upstream commit <https://cgit.freedesktop.org/upower/commit/
@@ -5759,19 +5759,41 @@ (define-public upower
               ;; If not specified, udev will try putting history information
               ;; in /gnu/store.
               "-Dhistorydir=/var/lib/upower"
-              (string-append "-Dudevrulesdir=" #$output "/bin/udev/rules.d"))
-      #:phases (if (target-x86-32?)
-                   #~(modify-phases %standard-phases
-                       (add-after 'unpack 'adjust-test-for-excess-precision
-                         (lambda _
-                           ;; Address test failure caused by excess precision
-                           ;; on i686:
-                           ;; <https://gitlab.freedesktop.org/upower/upower/-/issues/214>.
-                           (substitute* "src/linux/integration-test.py"
-                             (("assertEqual(.*)40\\.0" _ middle)
-                              (string-append
-                               "assertAlmostEqual" middle "40.0"))))))
-                   #~%standard-phases)))
+              (string-append "-Dudevrulesdir=" #$output "/bin/udev/rules.d")
+              (string-append "-Dudevhwdbdir=" #$output "/lib/udev/hwdb.d"))
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'adjust-test-for-excess-precision
+            (lambda _
+              #$@(if (target-x86-32?)
+                     ;; Address test failure caused by excess precision
+                     ;; on i686:
+                     ;; <https://gitlab.freedesktop.org/upower/upower/-/issues/214>.
+                     '((substitute* "src/linux/integration-test.py"
+                         (("assertEqual(.*)40\\.0" _ middle)
+                          (string-append
+                           "assertAlmostEqual" middle "40.0"))))
+                     '(*unspecified*))))
+          (delete 'check) ;; move after the install phase
+          (add-after 'install 'check
+            (lambda* (#:key parallel-tests? tests? #:allow-other-keys)
+              (when tests?
+                (setenv "UDEV_HWDB_PATH"
+                        (apply string-append #$output "/lib/udev/hwdb.d"
+                               (let ((p (getenv "HWDB_BIN_PATH")))
+                                 (if p
+                                     (list ":" p)
+                                     '()))))
+                (let ((hwdb.bin (string-append (getcwd) "/test-hwdb.bin")))
+                  (invoke "udevadm" "hwdb" "--update"
+                          "-o" hwdb.bin)
+                  (setenv "UDEV_HWDB_BIN" hwdb.bin))
+                (setenv "MESON_TESTTHREADS"
+                        (if parallel-tests?
+                            (number->string (parallel-job-count))
+                            "1"))
+                (invoke "dbus-run-session" "--"
+                        "meson" "test" "-t" "0")))))))
     (native-inputs
      (list `(,glib "bin")               ; for gdbus-codegen
            gobject-introspection
-- 
2.41.0




^ permalink raw reply related	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v3 3/3] gnu: upower: Update to 1.90.2.
  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-19 11:32           ` [bug#66099] [PATCH gnome-team v3 2/3] gnu: libgudev: Update to 238 Vivien Kraus via Guix-patches via
@ 2023-09-19 11:32           ` Vivien Kraus via Guix-patches via
  2 siblings, 0 replies; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-09-19 11:32 UTC (permalink / raw)
  To: Liliana Marie Prikler, 66099; +Cc: rg, maxim.cournoyer

The new eudev now can install hwdb files. Upower has some, but they should get
installed in upower’s output, not eudev’s.

The phases needed a rework. Now the 32-bit-specific test fix is always there,
except it may be empty. A test needs to be disabled.

* gnu/packages/gnome.scm (upower): Update to 1.90.2.
[#:configure-flags]: Set udevhwdbdir.
[#:phases] <adjust-test-for-excess-precision>: Add this phase
unconditionnally
<disable-failing-test>: Disable the test.
---
 gnu/packages/gnome.scm | 38 +++++++++++++++++++++++---------------
 1 file changed, 23 insertions(+), 15 deletions(-)

diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index 4ea3dc455a..76018a4b5e 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -5727,7 +5727,7 @@ (define-public geocode-glib-with-libsoup2
 (define-public upower
   (package
     (name "upower")
-    (version "1.90.0")
+    (version "1.90.2")
     (source
      (origin
        (method git-fetch)
@@ -5736,7 +5736,7 @@ (define-public upower
              (commit (string-append "v" version))))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "1g17rm91p8vfpjyb0k2shylrs55nccn3fa890vlk4n9s71sghbzq"))
+        (base32 "13xp423ycv8imf2cmgf6lii9f01p7x2v19cny7acrmczkc0cqv7d"))
        (modules '((guix build utils)))
        (snippet
         ;; Upstream commit <https://cgit.freedesktop.org/upower/commit/
@@ -5759,19 +5759,27 @@ (define-public upower
               ;; If not specified, udev will try putting history information
               ;; in /gnu/store.
               "-Dhistorydir=/var/lib/upower"
-              (string-append "-Dudevrulesdir=" #$output "/bin/udev/rules.d"))
-      #:phases (if (target-x86-32?)
-                   #~(modify-phases %standard-phases
-                       (add-after 'unpack 'adjust-test-for-excess-precision
-                         (lambda _
-                           ;; Address test failure caused by excess precision
-                           ;; on i686:
-                           ;; <https://gitlab.freedesktop.org/upower/upower/-/issues/214>.
-                           (substitute* "src/linux/integration-test.py"
-                             (("assertEqual(.*)40\\.0" _ middle)
-                              (string-append
-                               "assertAlmostEqual" middle "40.0"))))))
-                   #~%standard-phases)))
+              (string-append "-Dudevrulesdir=" #$output "/bin/udev/rules.d")
+              (string-append "-Dudevhwdbdir=" #$output "/lib/udev/hwdb.d"))
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'disable-failing-test
+            (lambda _
+              ;; This test calls an unimplemented bluez dbus method
+              (substitute* "src/linux/integration-test.py"
+                (("test_bluetooth_hidpp_mouse")
+                 "disabled_test_bluetooth_hidpp_mouse"))))
+          (add-after 'unpack 'adjust-test-for-excess-precision
+            (lambda _
+              #$@(if (target-x86-32?)
+                     ;; Address test failure caused by excess precision
+                     ;; on i686:
+                     ;; <https://gitlab.freedesktop.org/upower/upower/-/issues/214>.
+                     '((substitute* "src/linux/integration-test.py"
+                         (("assertEqual(.*)40\\.0" _ middle)
+                          (string-append
+                           "assertAlmostEqual" middle "40.0"))))
+                     '(*unspecified*)))))))
     (native-inputs
      (list `(,glib "bin")               ; for gdbus-codegen
            gobject-introspection
-- 
2.41.0




^ permalink raw reply related	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v4 4/4] gnu: upower: Update to 1.90.2.
  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-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   ` Vivien Kraus via Guix-patches via
  2023-10-02 17:17     ` Liliana Marie Prikler
  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
  3 siblings, 1 reply; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-09-19 11:32 UTC (permalink / raw)
  To: Liliana Marie Prikler, 66099; +Cc: rg, maxim.cournoyer

The new eudev now can install hwdb files. Upower has some, but they should get
installed in upower’s output, not eudev’s.

The phases needed a rework. Now the 32-bit-specific test fix is always there,
except it may be empty. A test needs to be disabled.

* gnu/packages/gnome.scm (upower): Update to 1.90.2.
[#:configure-flags]: Set udevhwdbdir.
[#:phases] <adjust-test-for-excess-precision>: Add this phase
unconditionnally
<disable-failing-test>: Disable the test.
[inputs]: Remove dbus-glib.
[native-inputs]: Add dbus for the tests.
---
 gnu/packages/gnome.scm | 41 +++++++++++++++++++++++++----------------
 1 file changed, 25 insertions(+), 16 deletions(-)

diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index 4ea3dc455a..d4628d01b2 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -5727,7 +5727,7 @@ (define-public geocode-glib-with-libsoup2
 (define-public upower
   (package
     (name "upower")
-    (version "1.90.0")
+    (version "1.90.2")
     (source
      (origin
        (method git-fetch)
@@ -5736,7 +5736,7 @@ (define-public upower
              (commit (string-append "v" version))))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "1g17rm91p8vfpjyb0k2shylrs55nccn3fa890vlk4n9s71sghbzq"))
+        (base32 "13xp423ycv8imf2cmgf6lii9f01p7x2v19cny7acrmczkc0cqv7d"))
        (modules '((guix build utils)))
        (snippet
         ;; Upstream commit <https://cgit.freedesktop.org/upower/commit/
@@ -5759,19 +5759,27 @@ (define-public upower
               ;; If not specified, udev will try putting history information
               ;; in /gnu/store.
               "-Dhistorydir=/var/lib/upower"
-              (string-append "-Dudevrulesdir=" #$output "/bin/udev/rules.d"))
-      #:phases (if (target-x86-32?)
-                   #~(modify-phases %standard-phases
-                       (add-after 'unpack 'adjust-test-for-excess-precision
-                         (lambda _
-                           ;; Address test failure caused by excess precision
-                           ;; on i686:
-                           ;; <https://gitlab.freedesktop.org/upower/upower/-/issues/214>.
-                           (substitute* "src/linux/integration-test.py"
-                             (("assertEqual(.*)40\\.0" _ middle)
-                              (string-append
-                               "assertAlmostEqual" middle "40.0"))))))
-                   #~%standard-phases)))
+              (string-append "-Dudevrulesdir=" #$output "/bin/udev/rules.d")
+              (string-append "-Dudevhwdbdir=" #$output "/lib/udev/hwdb.d"))
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'disable-failing-test
+            (lambda _
+              ;; This test calls an unimplemented bluez dbus method
+              (substitute* "src/linux/integration-test.py"
+                (("test_bluetooth_hidpp_mouse")
+                 "disabled_test_bluetooth_hidpp_mouse"))))
+          (add-after 'unpack 'adjust-test-for-excess-precision
+            (lambda _
+              #$@(if (target-x86-32?)
+                     ;; Address test failure caused by excess precision
+                     ;; on i686:
+                     ;; <https://gitlab.freedesktop.org/upower/upower/-/issues/214>.
+                     '((substitute* "src/linux/integration-test.py"
+                         (("assertEqual(.*)40\\.0" _ middle)
+                          (string-append
+                           "assertAlmostEqual" middle "40.0"))))
+                     '(*unspecified*)))))))
     (native-inputs
      (list `(,glib "bin")               ; for gdbus-codegen
            gobject-introspection
@@ -5785,12 +5793,13 @@ (define-public upower
            python-packaging
            python-pygobject
            umockdev
+           dbus
            ;; For man pages.
            docbook-xsl
            libxslt                      ; for 'xsltproc'
            libxml2))                    ; for 'XML_CATALOG_FILES'
     (inputs
-     (list dbus-glib libgudev libusb))
+     (list libgudev libusb))
     (propagated-inputs
      ;; In Requires of upower-glib.pc.
      (list glib))
-- 
2.41.0




^ permalink raw reply related	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v5 4/4] gnu: upower: Update to 1.90.2.
  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         ` 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
  3 siblings, 0 replies; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-09-19 11:32 UTC (permalink / raw)
  To: Liliana Marie Prikler, maxim.cournoyer, 66099; +Cc: rg

The new eudev now can install hwdb files. Upower has some, but they should get
installed in upower’s output, not eudev’s.

The phases needed a rework. Now the 32-bit-specific test fix is always there,
except it may be empty.

test_bluetooth_hidpp_mouse fails, after calling into a bluez dbus method.

* gnu/packages/gnome.scm (upower): Update to 1.90.2.
[#:configure-flags]: Set udevhwdbdir.
[#:phases] <adjust-test-for-excess-precision>: Add this phase
unconditionnally
<disable-failing-test>: Disable test_bluetooth_hidpp_mouse.
[inputs]: Remove dbus-glib.
[native-inputs]: Add dbus.
---
 gnu/packages/gnome.scm | 39 +++++++++++++++++++++++----------------
 1 file changed, 23 insertions(+), 16 deletions(-)

diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index 4ea3dc455a..3f773aae8a 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -5727,7 +5727,7 @@ (define-public geocode-glib-with-libsoup2
 (define-public upower
   (package
     (name "upower")
-    (version "1.90.0")
+    (version "1.90.2")
     (source
      (origin
        (method git-fetch)
@@ -5736,7 +5736,7 @@ (define-public upower
              (commit (string-append "v" version))))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "1g17rm91p8vfpjyb0k2shylrs55nccn3fa890vlk4n9s71sghbzq"))
+        (base32 "13xp423ycv8imf2cmgf6lii9f01p7x2v19cny7acrmczkc0cqv7d"))
        (modules '((guix build utils)))
        (snippet
         ;; Upstream commit <https://cgit.freedesktop.org/upower/commit/
@@ -5759,19 +5759,25 @@ (define-public upower
               ;; If not specified, udev will try putting history information
               ;; in /gnu/store.
               "-Dhistorydir=/var/lib/upower"
-              (string-append "-Dudevrulesdir=" #$output "/bin/udev/rules.d"))
-      #:phases (if (target-x86-32?)
-                   #~(modify-phases %standard-phases
-                       (add-after 'unpack 'adjust-test-for-excess-precision
-                         (lambda _
-                           ;; Address test failure caused by excess precision
-                           ;; on i686:
-                           ;; <https://gitlab.freedesktop.org/upower/upower/-/issues/214>.
-                           (substitute* "src/linux/integration-test.py"
-                             (("assertEqual(.*)40\\.0" _ middle)
-                              (string-append
-                               "assertAlmostEqual" middle "40.0"))))))
-                   #~%standard-phases)))
+              (string-append "-Dudevrulesdir=" #$output "/bin/udev/rules.d")
+              (string-append "-Dudevhwdbdir=" #$output "/lib/udev/hwdb.d"))
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'adjust-test-suite
+            (lambda _
+              ;; This test calls an unimplemented bluez dbus method.
+              (substitute* "src/linux/integration-test.py"
+                (("test_bluetooth_hidpp_mouse")
+                 "disabled_test_bluetooth_hidpp_mouse"))
+              #$@(if (target-x86-32?)
+                     ;; Address test failure caused by excess precision
+                     ;; on i686:
+                     ;; <https://gitlab.freedesktop.org/upower/upower/-/issues/214>.
+                     '((substitute* "src/linux/integration-test.py"
+                         (("assertEqual(.*)40\\.0" _ middle)
+                          (string-append
+                           "assertAlmostEqual" middle "40.0"))))
+                     '()))))))
     (native-inputs
      (list `(,glib "bin")               ; for gdbus-codegen
            gobject-introspection
@@ -5785,12 +5791,13 @@ (define-public upower
            python-packaging
            python-pygobject
            umockdev
+           dbus
            ;; For man pages.
            docbook-xsl
            libxslt                      ; for 'xsltproc'
            libxml2))                    ; for 'XML_CATALOG_FILES'
     (inputs
-     (list dbus-glib libgudev libusb))
+     (list libgudev libusb))
     (propagated-inputs
      ;; In Requires of upower-glib.pc.
      (list glib))
-- 
2.41.0




^ permalink raw reply related	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v6 5/5] gnu: upower: Update to 1.90.2.
  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-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               ` 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-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
  4 siblings, 0 replies; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-09-19 11:32 UTC (permalink / raw)
  To: Liliana Marie Prikler, maxim.cournoyer, 66099; +Cc: rg

The new eudev now can install hwdb files. Upower has some, but they should get
installed in upower’s output, not eudev’s.

The phases needed a rework. Now the 32-bit-specific test fix is always there,
except it may be empty.

test_bluetooth_hidpp_mouse fails, after calling into a bluez dbus method.

* gnu/packages/gnome.scm (upower): Update to 1.90.2.
[#:configure-flags]: Set udevhwdbdir.
[#:phases] <adjust-test-for-excess-precision>: Add this phase
unconditionnally
<disable-failing-test>: Disable test_bluetooth_hidpp_mouse.
[inputs]: Remove dbus-glib.
[native-inputs]: Add dbus.
---
 gnu/packages/gnome.scm | 39 +++++++++++++++++++++++----------------
 1 file changed, 23 insertions(+), 16 deletions(-)

diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index 4ea3dc455a..3f773aae8a 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -5727,7 +5727,7 @@ (define-public geocode-glib-with-libsoup2
 (define-public upower
   (package
     (name "upower")
-    (version "1.90.0")
+    (version "1.90.2")
     (source
      (origin
        (method git-fetch)
@@ -5736,7 +5736,7 @@ (define-public upower
              (commit (string-append "v" version))))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "1g17rm91p8vfpjyb0k2shylrs55nccn3fa890vlk4n9s71sghbzq"))
+        (base32 "13xp423ycv8imf2cmgf6lii9f01p7x2v19cny7acrmczkc0cqv7d"))
        (modules '((guix build utils)))
        (snippet
         ;; Upstream commit <https://cgit.freedesktop.org/upower/commit/
@@ -5759,19 +5759,25 @@ (define-public upower
               ;; If not specified, udev will try putting history information
               ;; in /gnu/store.
               "-Dhistorydir=/var/lib/upower"
-              (string-append "-Dudevrulesdir=" #$output "/bin/udev/rules.d"))
-      #:phases (if (target-x86-32?)
-                   #~(modify-phases %standard-phases
-                       (add-after 'unpack 'adjust-test-for-excess-precision
-                         (lambda _
-                           ;; Address test failure caused by excess precision
-                           ;; on i686:
-                           ;; <https://gitlab.freedesktop.org/upower/upower/-/issues/214>.
-                           (substitute* "src/linux/integration-test.py"
-                             (("assertEqual(.*)40\\.0" _ middle)
-                              (string-append
-                               "assertAlmostEqual" middle "40.0"))))))
-                   #~%standard-phases)))
+              (string-append "-Dudevrulesdir=" #$output "/bin/udev/rules.d")
+              (string-append "-Dudevhwdbdir=" #$output "/lib/udev/hwdb.d"))
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'adjust-test-suite
+            (lambda _
+              ;; This test calls an unimplemented bluez dbus method.
+              (substitute* "src/linux/integration-test.py"
+                (("test_bluetooth_hidpp_mouse")
+                 "disabled_test_bluetooth_hidpp_mouse"))
+              #$@(if (target-x86-32?)
+                     ;; Address test failure caused by excess precision
+                     ;; on i686:
+                     ;; <https://gitlab.freedesktop.org/upower/upower/-/issues/214>.
+                     '((substitute* "src/linux/integration-test.py"
+                         (("assertEqual(.*)40\\.0" _ middle)
+                          (string-append
+                           "assertAlmostEqual" middle "40.0"))))
+                     '()))))))
     (native-inputs
      (list `(,glib "bin")               ; for gdbus-codegen
            gobject-introspection
@@ -5785,12 +5791,13 @@ (define-public upower
            python-packaging
            python-pygobject
            umockdev
+           dbus
            ;; For man pages.
            docbook-xsl
            libxslt                      ; for 'xsltproc'
            libxml2))                    ; for 'XML_CATALOG_FILES'
     (inputs
-     (list dbus-glib libgudev libusb))
+     (list libgudev libusb))
     (propagated-inputs
      ;; In Requires of upower-glib.pc.
      (list glib))
-- 
2.41.0




^ permalink raw reply related	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v7 5/5] gnu: upower: Update to 1.90.2.
  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-09-19 11:32                     ` [bug#66099] [PATCH gnome-team v7 4/5] gnu: libgudev: Update to 238 Vivien Kraus via Guix-patches via
@ 2023-09-19 11:32                     ` 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
                                       ` (2 subsequent siblings)
  5 siblings, 1 reply; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-09-19 11:32 UTC (permalink / raw)
  To: Liliana Marie Prikler, maxim.cournoyer, 66099; +Cc: rg

The new eudev now can install hwdb files. Upower has some, but they should get
installed in upower’s output, not eudev’s.

The phases needed a rework. Now the 32-bit-specific test fix is always there,
except it may be empty.

test_bluetooth_hidpp_mouse fails, after calling into a bluez dbus method.

* gnu/packages/gnome.scm (upower): Update to 1.90.2.
[#:configure-flags]: Set udevhwdbdir.
[#:phases] <adjust-test-for-excess-precision>: Add this phase
unconditionnally
<disable-failing-test>: Disable test_bluetooth_hidpp_mouse.
[inputs]: Remove dbus-glib.
[native-inputs]: Add dbus.
---
 gnu/packages/gnome.scm | 39 +++++++++++++++++++++++----------------
 1 file changed, 23 insertions(+), 16 deletions(-)

diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index 4ea3dc455a..3f773aae8a 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -5727,7 +5727,7 @@ (define-public geocode-glib-with-libsoup2
 (define-public upower
   (package
     (name "upower")
-    (version "1.90.0")
+    (version "1.90.2")
     (source
      (origin
        (method git-fetch)
@@ -5736,7 +5736,7 @@ (define-public upower
              (commit (string-append "v" version))))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "1g17rm91p8vfpjyb0k2shylrs55nccn3fa890vlk4n9s71sghbzq"))
+        (base32 "13xp423ycv8imf2cmgf6lii9f01p7x2v19cny7acrmczkc0cqv7d"))
        (modules '((guix build utils)))
        (snippet
         ;; Upstream commit <https://cgit.freedesktop.org/upower/commit/
@@ -5759,19 +5759,25 @@ (define-public upower
               ;; If not specified, udev will try putting history information
               ;; in /gnu/store.
               "-Dhistorydir=/var/lib/upower"
-              (string-append "-Dudevrulesdir=" #$output "/bin/udev/rules.d"))
-      #:phases (if (target-x86-32?)
-                   #~(modify-phases %standard-phases
-                       (add-after 'unpack 'adjust-test-for-excess-precision
-                         (lambda _
-                           ;; Address test failure caused by excess precision
-                           ;; on i686:
-                           ;; <https://gitlab.freedesktop.org/upower/upower/-/issues/214>.
-                           (substitute* "src/linux/integration-test.py"
-                             (("assertEqual(.*)40\\.0" _ middle)
-                              (string-append
-                               "assertAlmostEqual" middle "40.0"))))))
-                   #~%standard-phases)))
+              (string-append "-Dudevrulesdir=" #$output "/bin/udev/rules.d")
+              (string-append "-Dudevhwdbdir=" #$output "/lib/udev/hwdb.d"))
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'adjust-test-suite
+            (lambda _
+              ;; This test calls an unimplemented bluez dbus method.
+              (substitute* "src/linux/integration-test.py"
+                (("test_bluetooth_hidpp_mouse")
+                 "disabled_test_bluetooth_hidpp_mouse"))
+              #$@(if (target-x86-32?)
+                     ;; Address test failure caused by excess precision
+                     ;; on i686:
+                     ;; <https://gitlab.freedesktop.org/upower/upower/-/issues/214>.
+                     '((substitute* "src/linux/integration-test.py"
+                         (("assertEqual(.*)40\\.0" _ middle)
+                          (string-append
+                           "assertAlmostEqual" middle "40.0"))))
+                     '()))))))
     (native-inputs
      (list `(,glib "bin")               ; for gdbus-codegen
            gobject-introspection
@@ -5785,12 +5791,13 @@ (define-public upower
            python-packaging
            python-pygobject
            umockdev
+           dbus
            ;; For man pages.
            docbook-xsl
            libxslt                      ; for 'xsltproc'
            libxml2))                    ; for 'XML_CATALOG_FILES'
     (inputs
-     (list dbus-glib libgudev libusb))
+     (list libgudev libusb))
     (propagated-inputs
      ;; In Requires of upower-glib.pc.
      (list glib))
-- 
2.41.0




^ permalink raw reply related	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v8 6/6] gnu: upower: Update to 1.90.2.
  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-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                           ` 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
                                             ` (3 subsequent siblings)
  6 siblings, 1 reply; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-09-19 11:32 UTC (permalink / raw)
  To: Liliana Marie Prikler, Maxim Cournoyer, 66099; +Cc: rg

The new eudev now can install hwdb files. Upower has some, but they should get
installed in upower’s output, not eudev’s.

The phases needed a rework. Now the 32-bit-specific test fix is always there,
except it may be empty.

test_bluetooth_hidpp_mouse fails, after calling into a bluez dbus method.

* gnu/packages/gnome.scm (upower): Update to 1.90.2.
[#:configure-flags]: Set udevhwdbdir.
[#:phases] <adjust-test-for-excess-precision>: Add this phase
unconditionnally
<disable-failing-test>: Disable test_bluetooth_hidpp_mouse.
[inputs]: Remove dbus-glib.
[native-inputs]: Add dbus.
---
 gnu/packages/gnome.scm | 39 +++++++++++++++++++++++----------------
 1 file changed, 23 insertions(+), 16 deletions(-)

diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index 4ea3dc455a..3f773aae8a 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -5727,7 +5727,7 @@ (define-public geocode-glib-with-libsoup2
 (define-public upower
   (package
     (name "upower")
-    (version "1.90.0")
+    (version "1.90.2")
     (source
      (origin
        (method git-fetch)
@@ -5736,7 +5736,7 @@ (define-public upower
              (commit (string-append "v" version))))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "1g17rm91p8vfpjyb0k2shylrs55nccn3fa890vlk4n9s71sghbzq"))
+        (base32 "13xp423ycv8imf2cmgf6lii9f01p7x2v19cny7acrmczkc0cqv7d"))
        (modules '((guix build utils)))
        (snippet
         ;; Upstream commit <https://cgit.freedesktop.org/upower/commit/
@@ -5759,19 +5759,25 @@ (define-public upower
               ;; If not specified, udev will try putting history information
               ;; in /gnu/store.
               "-Dhistorydir=/var/lib/upower"
-              (string-append "-Dudevrulesdir=" #$output "/bin/udev/rules.d"))
-      #:phases (if (target-x86-32?)
-                   #~(modify-phases %standard-phases
-                       (add-after 'unpack 'adjust-test-for-excess-precision
-                         (lambda _
-                           ;; Address test failure caused by excess precision
-                           ;; on i686:
-                           ;; <https://gitlab.freedesktop.org/upower/upower/-/issues/214>.
-                           (substitute* "src/linux/integration-test.py"
-                             (("assertEqual(.*)40\\.0" _ middle)
-                              (string-append
-                               "assertAlmostEqual" middle "40.0"))))))
-                   #~%standard-phases)))
+              (string-append "-Dudevrulesdir=" #$output "/bin/udev/rules.d")
+              (string-append "-Dudevhwdbdir=" #$output "/lib/udev/hwdb.d"))
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'adjust-test-suite
+            (lambda _
+              ;; This test calls an unimplemented bluez dbus method.
+              (substitute* "src/linux/integration-test.py"
+                (("test_bluetooth_hidpp_mouse")
+                 "disabled_test_bluetooth_hidpp_mouse"))
+              #$@(if (target-x86-32?)
+                     ;; Address test failure caused by excess precision
+                     ;; on i686:
+                     ;; <https://gitlab.freedesktop.org/upower/upower/-/issues/214>.
+                     '((substitute* "src/linux/integration-test.py"
+                         (("assertEqual(.*)40\\.0" _ middle)
+                          (string-append
+                           "assertAlmostEqual" middle "40.0"))))
+                     '()))))))
     (native-inputs
      (list `(,glib "bin")               ; for gdbus-codegen
            gobject-introspection
@@ -5785,12 +5791,13 @@ (define-public upower
            python-packaging
            python-pygobject
            umockdev
+           dbus
            ;; For man pages.
            docbook-xsl
            libxslt                      ; for 'xsltproc'
            libxml2))                    ; for 'XML_CATALOG_FILES'
     (inputs
-     (list dbus-glib libgudev libusb))
+     (list libgudev libusb))
     (propagated-inputs
      ;; In Requires of upower-glib.pc.
      (list glib))
-- 
2.41.0




^ permalink raw reply related	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v9 6/7] gnu: upower: Update to 1.90.2.
  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                                 ` 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
                                                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-09-19 11:32 UTC (permalink / raw)
  To: Liliana Marie Prikler, Maxim Cournoyer, 66099; +Cc: rg

Upower has an extra hardware description file for use with udev.  It should be
installed under upower’s output, not eudev’s.

A test is disabled, for calling an unimplemented bluez method.  The
conditional 'adjust-test-for-excess-precision phase is included in the new
'adjust-test-suite, so that the list of phases is always the same.

* gnu/packages/gnome.scm (upower): Update to 1.90.2.
[#:configure-flags]: Set udevhwdbdir.
[#:phases] <adjust-test-for-excess-precision>: Add this phase
unconditionnally
<disable-failing-test>: Disable test_bluetooth_hidpp_mouse.
[inputs]: Remove dbus-glib.
[native-inputs]: Add dbus.
---
 gnu/packages/gnome.scm | 39 +++++++++++++++++++++++----------------
 1 file changed, 23 insertions(+), 16 deletions(-)

diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index 4ea3dc455a..3f773aae8a 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -5727,7 +5727,7 @@ (define-public geocode-glib-with-libsoup2
 (define-public upower
   (package
     (name "upower")
-    (version "1.90.0")
+    (version "1.90.2")
     (source
      (origin
        (method git-fetch)
@@ -5736,7 +5736,7 @@ (define-public upower
              (commit (string-append "v" version))))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "1g17rm91p8vfpjyb0k2shylrs55nccn3fa890vlk4n9s71sghbzq"))
+        (base32 "13xp423ycv8imf2cmgf6lii9f01p7x2v19cny7acrmczkc0cqv7d"))
        (modules '((guix build utils)))
        (snippet
         ;; Upstream commit <https://cgit.freedesktop.org/upower/commit/
@@ -5759,19 +5759,25 @@ (define-public upower
               ;; If not specified, udev will try putting history information
               ;; in /gnu/store.
               "-Dhistorydir=/var/lib/upower"
-              (string-append "-Dudevrulesdir=" #$output "/bin/udev/rules.d"))
-      #:phases (if (target-x86-32?)
-                   #~(modify-phases %standard-phases
-                       (add-after 'unpack 'adjust-test-for-excess-precision
-                         (lambda _
-                           ;; Address test failure caused by excess precision
-                           ;; on i686:
-                           ;; <https://gitlab.freedesktop.org/upower/upower/-/issues/214>.
-                           (substitute* "src/linux/integration-test.py"
-                             (("assertEqual(.*)40\\.0" _ middle)
-                              (string-append
-                               "assertAlmostEqual" middle "40.0"))))))
-                   #~%standard-phases)))
+              (string-append "-Dudevrulesdir=" #$output "/bin/udev/rules.d")
+              (string-append "-Dudevhwdbdir=" #$output "/lib/udev/hwdb.d"))
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'adjust-test-suite
+            (lambda _
+              ;; This test calls an unimplemented bluez dbus method.
+              (substitute* "src/linux/integration-test.py"
+                (("test_bluetooth_hidpp_mouse")
+                 "disabled_test_bluetooth_hidpp_mouse"))
+              #$@(if (target-x86-32?)
+                     ;; Address test failure caused by excess precision
+                     ;; on i686:
+                     ;; <https://gitlab.freedesktop.org/upower/upower/-/issues/214>.
+                     '((substitute* "src/linux/integration-test.py"
+                         (("assertEqual(.*)40\\.0" _ middle)
+                          (string-append
+                           "assertAlmostEqual" middle "40.0"))))
+                     '()))))))
     (native-inputs
      (list `(,glib "bin")               ; for gdbus-codegen
            gobject-introspection
@@ -5785,12 +5791,13 @@ (define-public upower
            python-packaging
            python-pygobject
            umockdev
+           dbus
            ;; For man pages.
            docbook-xsl
            libxslt                      ; for 'xsltproc'
            libxml2))                    ; for 'XML_CATALOG_FILES'
     (inputs
-     (list dbus-glib libgudev libusb))
+     (list libgudev libusb))
     (propagated-inputs
      ;; In Requires of upower-glib.pc.
      (list glib))
-- 
2.41.0




^ permalink raw reply related	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v10 6/6] gnu: upower: Update to 1.90.2.
  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                                                 ` Vivien Kraus via Guix-patches via
  0 siblings, 0 replies; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-09-19 11:32 UTC (permalink / raw)
  To: Maxim Cournoyer, Liliana Marie Prikler, 66099; +Cc: rg

Upower has an extra hardware description file for use with udev.  It should be
installed under upower’s output, not eudev’s.

A test is disabled, for calling an unimplemented bluez method.  The
conditional 'adjust-test-for-excess-precision phase is included in the new
'adjust-test-suite, so that the list of phases is always the same.

* gnu/packages/gnome.scm (upower): Update to 1.90.2.
[#:configure-flags]: Set udevhwdbdir.
[#:phases] <adjust-test-for-excess-precision>: Add this phase
unconditionnally
<disable-failing-test>: Disable test_bluetooth_hidpp_mouse.
[inputs]: Remove dbus-glib.
[native-inputs]: Add dbus.
---
 gnu/packages/gnome.scm | 39 +++++++++++++++++++++++----------------
 1 file changed, 23 insertions(+), 16 deletions(-)

diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index d8cdd11bd4..6e3933ec96 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -5727,7 +5727,7 @@ (define-public geocode-glib-with-libsoup2
 (define-public upower
   (package
     (name "upower")
-    (version "1.90.0")
+    (version "1.90.2")
     (source
      (origin
        (method git-fetch)
@@ -5736,7 +5736,7 @@ (define-public upower
              (commit (string-append "v" version))))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "1g17rm91p8vfpjyb0k2shylrs55nccn3fa890vlk4n9s71sghbzq"))
+        (base32 "13xp423ycv8imf2cmgf6lii9f01p7x2v19cny7acrmczkc0cqv7d"))
        (modules '((guix build utils)))
        (snippet
         ;; Upstream commit <https://cgit.freedesktop.org/upower/commit/
@@ -5759,19 +5759,25 @@ (define-public upower
               ;; If not specified, udev will try putting history information
               ;; in /gnu/store.
               "-Dhistorydir=/var/lib/upower"
-              (string-append "-Dudevrulesdir=" #$output "/bin/udev/rules.d"))
-      #:phases (if (target-x86-32?)
-                   #~(modify-phases %standard-phases
-                       (add-after 'unpack 'adjust-test-for-excess-precision
-                         (lambda _
-                           ;; Address test failure caused by excess precision
-                           ;; on i686:
-                           ;; <https://gitlab.freedesktop.org/upower/upower/-/issues/214>.
-                           (substitute* "src/linux/integration-test.py"
-                             (("assertEqual(.*)40\\.0" _ middle)
-                              (string-append
-                               "assertAlmostEqual" middle "40.0"))))))
-                   #~%standard-phases)))
+              (string-append "-Dudevrulesdir=" #$output "/bin/udev/rules.d")
+              (string-append "-Dudevhwdbdir=" #$output "/lib/udev/hwdb.d"))
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'adjust-test-suite
+            (lambda _
+              ;; This test calls an unimplemented bluez dbus method.
+              (substitute* "src/linux/integration-test.py"
+                (("test_bluetooth_hidpp_mouse")
+                 "disabled_test_bluetooth_hidpp_mouse"))
+              #$@(if (target-x86-32?)
+                     ;; Address test failure caused by excess precision
+                     ;; on i686:
+                     ;; <https://gitlab.freedesktop.org/upower/upower/-/issues/214>.
+                     '((substitute* "src/linux/integration-test.py"
+                         (("assertEqual(.*)40\\.0" _ middle)
+                          (string-append
+                           "assertAlmostEqual" middle "40.0"))))
+                     '()))))))
     (native-inputs
      (list `(,glib "bin")               ; for gdbus-codegen
            gobject-introspection
@@ -5785,12 +5791,13 @@ (define-public upower
            python-packaging
            python-pygobject
            umockdev
+           dbus
            ;; For man pages.
            docbook-xsl
            libxslt                      ; for 'xsltproc'
            libxml2))                    ; for 'XML_CATALOG_FILES'
     (inputs
-     (list dbus-glib libgudev libusb))
+     (list libgudev libusb))
     (propagated-inputs
      ;; In Requires of upower-glib.pc.
      (list glib))
-- 
2.41.0




^ permalink raw reply related	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team 0/3] Update upower
@ 2023-09-19 11:35 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
                   ` (4 more replies)
  0 siblings, 5 replies; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-09-19 11:35 UTC (permalink / raw)
  To: 66099; +Cc: liliana.prikler, maxim.cournoyer, rg

Dear guix,

Here is how I would update eudev, so as to be able to build a newer libgudev
and then a newer upower.

What do you think?

Best regards,

Vivien

Vivien Kraus (3):
  gnu: eudev: Update libudev version to 251.
  gnu: libgudev: Update to 238.
  gnu: upower: Update to 1.90.2.

 gnu/local.mk                                 |   1 +
 gnu/packages/gnome.scm                       |   8 +-
 gnu/packages/linux.scm                       |  22 ++-
 gnu/packages/patches/eudev-bump-to-251.patch | 134 +++++++++++++++++++
 4 files changed, 155 insertions(+), 10 deletions(-)
 create mode 100644 gnu/packages/patches/eudev-bump-to-251.patch


base-commit: e9ff5d51e3297089e66c124195e1f1b42dbded65
-- 
2.41.0




^ permalink raw reply	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team 3/3] gnu: upower: Update to 1.90.2.
  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
  0 siblings, 0 replies; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-09-19 15:51 UTC (permalink / raw)
  To: 66099

Le mardi 19 septembre 2023 à 13:32 +0200, Vivien Kraus a écrit :
> * gnu/packages/gnome.scm (upower): Update to 1.90.2.

Sorry, I just realized that upower fails spectacularly. I will have to
fix it.

Vivien




^ permalink raw reply	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team 0/3] Update upower
  2023-09-19 11:35 [bug#66099] [PATCH gnome-team 0/3] Update upower Vivien Kraus via Guix-patches via
                   ` (2 preceding siblings ...)
  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-21 17:06 ` Liliana Marie Prikler
  2023-09-21 21:05   ` 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
  4 siblings, 1 reply; 91+ messages in thread
From: Liliana Marie Prikler @ 2023-09-21 17:06 UTC (permalink / raw)
  To: Vivien Kraus, 66099; +Cc: rg, maxim.cournoyer

Am Dienstag, dem 19.09.2023 um 13:35 +0200 schrieb Vivien Kraus:
> Dear guix,
> 
> Here is how I would update eudev, so as to be able to build a newer
> libgudev and then a newer upower.
> 
> What do you think?
> 
> Best regards,
> 
> Vivien
> 
> Vivien Kraus (3):
>   gnu: eudev: Update libudev version to 251.
>   gnu: libgudev: Update to 238.
>   gnu: upower: Update to 1.90.2.
Does upower use GNOME versioning or Semver?  If so, 1.90 is potentially
experimental.  eudev and libgudev versions LGTM.

Cheers




^ permalink raw reply	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team 0/3] Update upower
  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
  0 siblings, 1 reply; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-09-21 21:05 UTC (permalink / raw)
  To: Liliana Marie Prikler, 66099; +Cc: rg, maxim.cournoyer

Le jeudi 21 septembre 2023 à 19:06 +0200, Liliana Marie Prikler a
écrit :
> Does upower use GNOME versioning or Semver?  If so, 1.90 is
> potentially
> experimental.  eudev and libgudev versions LGTM.
Unfortunately, neither upower 1.90.0 nor 1.90.2 build with updated
eudev and libgudev.

Vivien




^ permalink raw reply	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team 0/3] Update upower
  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
  0 siblings, 1 reply; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-09-21 22:03 UTC (permalink / raw)
  To: Liliana Marie Prikler, 66099; +Cc: rg, maxim.cournoyer

Le jeudi 21 septembre 2023 à 23:05 +0200, Vivien Kraus a écrit :
> Le jeudi 21 septembre 2023 à 19:06 +0200, Liliana Marie Prikler a
> écrit :
> > eudev and libgudev versions LGTM.
> Unfortunately, neither upower 1.90.0 nor 1.90.2 build with updated
> eudev and libgudev.

I think the problem is with hwdb. If I install upower before checking
it, I get:

phase `build' succeeded after 2.5 seconds
starting phase `install'
[0/1] Installing files.
Traceback (most recent call last):
  File "/gnu/store/brxy70m8k3g8pxf5qj312amsnnj9njb8-meson-
1.1.0/lib/python3.10/site-packages/mesonbuild/mesonmain.py", line 194,
in run
    return options.run_func(options)
  File "/gnu/store/brxy70m8k3g8pxf5qj312amsnnj9njb8-meson-
1.1.0/lib/python3.10/site-packages/mesonbuild/minstall.py", line 835,
in run
    installer.do_install(datafilename)
  File "/gnu/store/brxy70m8k3g8pxf5qj312amsnnj9njb8-meson-
1.1.0/lib/python3.10/site-packages/mesonbuild/minstall.py", line 547,
in do_install
    self.install_data(d, dm, destdir, fullprefix)
  File "/gnu/store/brxy70m8k3g8pxf5qj312amsnnj9njb8-meson-
1.1.0/lib/python3.10/site-packages/mesonbuild/minstall.py", line 620,
in install_data
    if self.do_copyfile(fullfilename, outfilename, makedirs=(dm,
outdir)):
  File "/gnu/store/brxy70m8k3g8pxf5qj312amsnnj9njb8-meson-
1.1.0/lib/python3.10/site-packages/mesonbuild/minstall.py", line 422,
in do_copyfile
    self.copy2(from_file, to_file)
  File "/gnu/store/brxy70m8k3g8pxf5qj312amsnnj9njb8-meson-
1.1.0/lib/python3.10/site-packages/mesonbuild/minstall.py", line 322,
in copy2
    shutil.copy2(*args, **kwargs)
  File "/gnu/store/dy3xh053ahkhrp2jamggq8cpsyvp8mg0-python-
3.10.7/lib/python3.10/shutil.py", line 434, in copy2
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/gnu/store/dy3xh053ahkhrp2jamggq8cpsyvp8mg0-python-
3.10.7/lib/python3.10/shutil.py", line 256, in copyfile
    with open(dst, 'wb') as fdst:
PermissionError: [Errno 13] Permission denied:
'/gnu/store/grx741bq3w2hq9dp61gbphghffzq5ywp-eudev-
3.2.14.beta/lib/udev/hwdb.d/95-upower-hid.hwdb'

So, presumably, upower tries to install itself into eudev stuff, which
fails. Now, it should install into upower’s prefix, but I’m not sure
how udevadm hwdb --update can be made to find hwdb files both from
eudev and from upower. Maybe we need to introduce a search path, but
I’m not sure udevadm understands any search path.

I asked on #eudev in IRC, let’s see...

Vivien




^ permalink raw reply	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team 0/3] Update upower
  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-30 14:20         ` [bug#66099] [PATCH gnome-team v3 0/3] Update eudev and upower Vivien Kraus via Guix-patches via
  0 siblings, 2 replies; 91+ messages in thread
From: Liliana Marie Prikler @ 2023-09-22  4:22 UTC (permalink / raw)
  To: Vivien Kraus, 66099; +Cc: rg, maxim.cournoyer

Am Freitag, dem 22.09.2023 um 00:03 +0200 schrieb Vivien Kraus:
> So, presumably, upower tries to install itself into eudev stuff,
> which fails. Now, it should install into upower’s prefix, but I’m not
> sure how udevadm hwdb --update can be made to find hwdb files both
> from eudev and from upower. Maybe we need to introduce a search path,
> but I’m not sure udevadm understands any search path.
This is a mostly solved problem on the Guix side.  We either use search
paths, or in case a single file is really, absolutely, positively
needed, we can also make do with a profile hook or some other lookup
mechanism (see below).  In either case, we let packages write to *their
own* output directory rather than some other packages'.

For udev specifically, we have configuration files that specify where
to look up stuff generated by udev-service-type.  You might want to
place hwdb-related logic there.

Cheers




^ permalink raw reply	[flat|nested] 91+ messages in thread

* [bug#66099] [WIP PATCH gnome-team v2 0/3] Nicer eudev, upower still fails
  2023-09-22  4:22       ` Liliana Marie Prikler
@ 2023-09-30 10:43         ` 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
                             ` (2 more replies)
  2023-09-30 14:20         ` [bug#66099] [PATCH gnome-team v3 0/3] Update eudev and upower Vivien Kraus via Guix-patches via
  1 sibling, 3 replies; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-09-30 10:43 UTC (permalink / raw)
  To: Liliana Marie Prikler, 66099; +Cc: rg, maxim.cournoyer

Dear guix,

I fixed eudev so that the "hwdb" can be used with a search path. However, we
still need a profile hook to generate the indexed hwdb.bin file and set
UDEV_HWDB_BIN. I don’t know how to do that, do you have any pointers?

Unfortunately, upower still fails to build. I don’t know what is happening.

Vivien Kraus (3):
  gnu: eudev: Update libudev version to 251.
  gnu: libgudev: Update to 238.
  gnu: upower: Update to 1.90.2.

 gnu/local.mk                                  |   2 +
 gnu/packages/gnome.scm                        |  56 +++-
 gnu/packages/linux.scm                        |  32 +-
 gnu/packages/patches/eudev-bump-to-251.patch  | 134 ++++++++
 .../patches/eudev-hwdb-bin-path.patch         | 309 ++++++++++++++++++
 5 files changed, 502 insertions(+), 31 deletions(-)
 create mode 100644 gnu/packages/patches/eudev-bump-to-251.patch
 create mode 100644 gnu/packages/patches/eudev-hwdb-bin-path.patch


base-commit: b18b2d13488f2a92331ccad2dc8cbb54ee15582f
-- 
2.41.0




^ permalink raw reply	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v3 0/3] Update eudev and upower
  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-30 14:20         ` 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
                             ` (2 more replies)
  1 sibling, 3 replies; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-09-30 14:20 UTC (permalink / raw)
  To: Liliana Marie Prikler, 66099; +Cc: rg, maxim.cournoyer

Dear guix,

I managed to learn about profile hooks and fix eudev and upower. Now it should
work! It is still possible that I missed a few things, as this is the first
time I’m writing a profile hook.

What do you think?

Best regards,

Vivien

Vivien Kraus (3):
  gnu: eudev: Update libudev version to 251.
  gnu: libgudev: Update to 238.
  gnu: upower: Update to 1.90.2.

 gnu/local.mk                                  |   3 +
 gnu/packages/gnome.scm                        |  42 ++-
 gnu/packages/linux.scm                        |  38 ++-
 gnu/packages/patches/eudev-bump-to-251.patch  | 134 ++++++++
 .../patches/eudev-hwdb-bin-path.patch         | 309 ++++++++++++++++++
 gnu/packages/patches/eudev-pr-255.patch       |  39 +++
 guix/profiles.scm                             |  29 ++
 7 files changed, 563 insertions(+), 31 deletions(-)
 create mode 100644 gnu/packages/patches/eudev-bump-to-251.patch
 create mode 100644 gnu/packages/patches/eudev-hwdb-bin-path.patch
 create mode 100644 gnu/packages/patches/eudev-pr-255.patch


base-commit: b18b2d13488f2a92331ccad2dc8cbb54ee15582f
-- 
2.41.0




^ permalink raw reply	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v3 1/3] gnu: eudev: Update libudev version to 251.
  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
  1 sibling, 0 replies; 91+ messages in thread
From: Liliana Marie Prikler @ 2023-09-30 17:59 UTC (permalink / raw)
  To: Vivien Kraus, 66099; +Cc: rg, maxim.cournoyer

Am Dienstag, dem 19.09.2023 um 13:23 +0200 schrieb Vivien Kraus:
> Support for version 251 is only provided as a merge request for now:
> 
> https://github.com/eudev-project/eudev/pull/253
> 
> This merge request bumps the eudev version to 3.2.14, but it has not
> been released yet.
> 
> Eudev now has a hardware database that installs descriptions of
> hardware in /etc, but they should go to /lib prior to being used. I
> added a phase to copy all the /etc files to /lib.
> 
> I submitted 3 patches to make udev hwdb more guix-friendly, fused in
> eudev-hwdb-bin-path.patch. libudev requires an indexed binary file
> that knows about all devices, and this file is generated by udevadm
> hwdb --update -o <prefix>/lib/udev/hwdb.bin. This udevadm hwdb
> command respects the UDEV_HWDB_PATH to collect all entries for the
> hwdb. Then, libudev can use UDEV_HWDB_BIN to select the database at
> run-time.
> 
> Another unreleased patch for PR 255 is also included.
> 
> I think everything could work out for Guix if we add a new profile
> hook that:
> 1. Calls udevadm hwdb --update -o <profile>/lib/udev/hwdb.bin;
> 2. Set UDEV_HWDB_BIN to <profile>/lib/udev/hwdb.bin.
> 
> This is why there are actually 2 search paths: one for
> UDEV_HWDB_PATH, and one for UDEV_HWDB_BIN (the latter accepting only
> 1 value).
Move personal comments below the --- line, keeping explanations above
the ChangeLog.

> * gnu/packages/linux.scm (eudev): Update to v3.2.12, but bump version
> to 3.2.14.beta.
Why not simply use git-version and a commit?  Or alternative have
v3.2.12 as the version while cherry-picking those commits.
> [#:phases] <allow-eudev-hwdb>: New phase.
> <build-hwdb>: Update accordingly.
> [native-search-paths]: Add UDEV_HWDB_PATH.
> * gnu/packages/patches/eudev-bump-to-251.patch: New file.
> * gnu/packages/patches/eudev-hwdb-bin-path.patch: New file.
> * gnu/packages/patches/eudev-pr-255.patch: New file.
You might want to rename these patches to explain what they do in the
file name, e.g. "eudev-libudev251-compat.patch".
> * gnu/packages/linux.scm (eudev): Use them here.
> * gnu/local.mk (dist_patch_DATA): Register them here.
> * guix/profiles.scm (udev-hwdb-bin): New profile hook to generate
> hwdb.bin.
> (%default-profile-hooks): Register it here.
Unless it's absolutely required to make use of eudev, you might want to
separate this hook into a separate patch.


Cheers




^ permalink raw reply	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v4 2/4] guix: Add udev-hwdb-bin profile hook.
  2023-10-01 20:20 ` [bug#66099] [PATCH gnome-team v4 0/4] Update eudev and upower Vivien Kraus via Guix-patches via
                     ` (2 preceding siblings ...)
  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-09-30 19:32   ` Vivien Kraus via Guix-patches via
  3 siblings, 0 replies; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-09-30 19:32 UTC (permalink / raw)
  To: Liliana Marie Prikler, 66099; +Cc: rg, maxim.cournoyer

The new eudev introduced an index for a hardware database. This index file
must be unique.

* guix/profiles.scm (udev-hwdb-bin): New profile hook to generate hwdb.bin.
(%default-profile-hooks): Register it here.
---
 guix/profiles.scm | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/guix/profiles.scm b/guix/profiles.scm
index c88672c25a..d308e7fb88 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -1905,6 +1905,34 @@ (define (texlive-font-maps manifest)
                             (hook . texlive-font-maps)))
         (return #f))))
 
+(define (udev-hwdb-bin manifest)
+  "Return a derivation that builds lib/udev/hwdb.bin."
+  (define eudev
+    (module-ref (resolve-interface '(gnu packages linux)) 'eudev))
+  (define build
+    (with-imported-modules
+        (source-module-closure '((guix build utils)))
+      #~(begin
+          (use-modules (guix build utils))
+          (let* ((inputs '#$(manifest-inputs manifest))
+                 (hwdb-directories
+                  (filter
+                   file-exists?
+                   (map (lambda (directory)
+                          (string-append directory "/lib/udev/hwdb.d"))
+                        inputs))))
+            (setenv "UDEV_HWDB_PATH"
+                    (string-join hwdb-directories ":")))
+          (invoke #$(file-append eudev "/bin/udevadm")
+                  "hwdb" "--update"
+                  "-o" (string-append #$output "/lib/udev/hwdb.bin")))))
+  (gexp->derivation "udev-hwdb-bin" build
+                    #:substitutable? #f
+                    #:local-build? #t
+                    #:properties
+                    `((type . profile-hook)
+                      (hook . udev-hwdb-bin))))
+
 (define %default-profile-hooks
   ;; This is the list of derivation-returning procedures that are called by
   ;; default when making a non-empty profile.
@@ -1919,6 +1947,7 @@ (define %default-profile-hooks
         gtk-icon-themes
         gtk-im-modules
         texlive-font-maps
+        udev-hwdb-bin
         xdg-desktop-database
         xdg-mime-database))
 
-- 
2.41.0




^ permalink raw reply related	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v4 0/4] Update eudev and upower
  2023-09-19 11:35 [bug#66099] [PATCH gnome-team 0/3] Update upower Vivien Kraus via Guix-patches via
                   ` (3 preceding siblings ...)
  2023-09-21 17:06 ` [bug#66099] [PATCH gnome-team 0/3] Update upower Liliana Marie Prikler
@ 2023-10-01 20:20 ` 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
                     ` (3 more replies)
  4 siblings, 4 replies; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-10-01 20:20 UTC (permalink / raw)
  To: Liliana Marie Prikler, 66099; +Cc: rg, maxim.cournoyer

Dear guix,

eudev now has merged the search path support, so I can use an unreleased
commit and avoid 2 patch files.

I noticed the dbus-glib dependency is unused.

Best regards,

Vivien

Vivien Kraus (4):
  gnu: eudev: Update libudev version to 251.
  guix: Add udev-hwdb-bin profile hook.
  gnu: libgudev: Update to 238.
  gnu: upower: Update to 1.90.2.

 gnu/local.mk                                  |   1 +
 gnu/packages/gnome.scm                        |  45 ++++---
 gnu/packages/linux.scm                        |  39 ++++---
 .../patches/eudev-libudev-251-compat.patch    | 110 ++++++++++++++++++
 .../patches/eudev-rules-directory.patch       |   9 +-
 guix/profiles.scm                             |  29 +++++
 6 files changed, 197 insertions(+), 36 deletions(-)
 create mode 100644 gnu/packages/patches/eudev-libudev-251-compat.patch


base-commit: b18b2d13488f2a92331ccad2dc8cbb54ee15582f
-- 
2.41.0




^ permalink raw reply	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v3 2/3] gnu: libgudev: Update to 238.
  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
  0 siblings, 0 replies; 91+ messages in thread
From: Maxim Cournoyer @ 2023-10-01 20:32 UTC (permalink / raw)
  To: Vivien Kraus; +Cc: 66099, Liliana Marie Prikler, rg

Hi,

Vivien Kraus <vivien@planete-kraus.eu> writes:

> * gnu/packages/gnome.scm (libgudev): Update to 238.
> ---
>  gnu/packages/gnome.scm | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
> index eaceb76e1e..4ea3dc455a 100644
> --- a/gnu/packages/gnome.scm
> +++ b/gnu/packages/gnome.scm
> @@ -6899,14 +6899,14 @@ (define-public eog-plugins
>  (define-public libgudev
>    (package
>      (name "libgudev")
> -    (version "236")
> +    (version "238")
>      (source (origin
>                (method url-fetch)
>                (uri (string-append "mirror://gnome/sources/" name "/"
>                                    version "/" name "-" version ".tar.xz"))
>                (sha256
>                 (base32
> -                "094mgjmwgsgqrr1i0vd20ynvlkihvs3vgbmpbrhswjsrdp86j0z5"))))
> +                "1laxgdkgmr30aw44sm4rgpsdybwxx5rszcm8c2y3vmy9myqnl9k1"))))
>      (build-system meson-build-system)
>      (native-inputs
>       `(("glib:bin" ,glib "bin") ; for glib-genmarshal, etc.

LGTM!

-- 
Thanks,
Maxim




^ permalink raw reply	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v3 1/3] gnu: eudev: Update libudev version to 251.
  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
  1 sibling, 1 reply; 91+ messages in thread
From: Maxim Cournoyer @ 2023-10-01 22:02 UTC (permalink / raw)
  To: Vivien Kraus; +Cc: 66099, Liliana Marie Prikler, rg

Hi,

Vivien Kraus <vivien@planete-kraus.eu> writes:

> Support for version 251 is only provided as a merge request for now:
>
> https://github.com/eudev-project/eudev/pull/253
>
> This merge request bumps the eudev version to 3.2.14, but it has not been
> released yet.
>
> Eudev now has a hardware database that installs descriptions of hardware in
> /etc, but they should go to /lib prior to being used. I added a phase to copy
> all the /etc files to /lib.
>
> I submitted 3 patches to make udev hwdb more guix-friendly, fused in
> eudev-hwdb-bin-path.patch. libudev requires an indexed binary file that knows
> about all devices, and this file is generated by udevadm hwdb --update -o
> <prefix>/lib/udev/hwdb.bin. This udevadm hwdb command respects the
> UDEV_HWDB_PATH to collect all entries for the hwdb. Then, libudev can use
> UDEV_HWDB_BIN to select the database at run-time.
>
> Another unreleased patch for PR 255 is also included.
>
> I think everything could work out for Guix if we add a new profile hook that:
> 1. Calls udevadm hwdb --update -o <profile>/lib/udev/hwdb.bin;
> 2. Set UDEV_HWDB_BIN to <profile>/lib/udev/hwdb.bin.
>
> This is why there are actually 2 search paths: one for UDEV_HWDB_PATH, and one
> for UDEV_HWDB_BIN (the latter accepting only 1 value).
>
> * gnu/packages/linux.scm (eudev): Update to v3.2.12, but bump version to
> 3.2.14.beta.
> [#:phases] <allow-eudev-hwdb>: New phase.
> <build-hwdb>: Update accordingly.
> [native-search-paths]: Add UDEV_HWDB_PATH.
> * gnu/packages/patches/eudev-bump-to-251.patch: New file.
> * gnu/packages/patches/eudev-hwdb-bin-path.patch: New file.
> * gnu/packages/patches/eudev-pr-255.patch: New file.
> * gnu/packages/linux.scm (eudev): Use them here.
> * gnu/local.mk (dist_patch_DATA): Register them here.
> * guix/profiles.scm (udev-hwdb-bin): New profile hook to generate hwdb.bin.
> (%default-profile-hooks): Register it here.

Impressive work!  It seems your patches were warmly welcomed (already
merged!) in eudev, which is excellent (and should mean a v4 doesn't need
patches anymore, using a specific commit with a git-version computed
version.

[...]

>      (build-system gnu-build-system)
>      (arguments
>       (list
> @@ -4297,18 +4300,25 @@ (define-public eudev
>                  (substitute* (string-append #$output "/lib/libudev.la")
>                    (("old_library=.*")
>                     "old_library=''\n")))))
> -          (add-after 'install 'build-hwdb
> +          (add-after 'install 'allow-eudev-hwdb
>              (lambda _
> -              ;; Build OUT/etc/udev/hwdb.bin.  This allows 'lsusb' and
> -              ;; similar tools to display product names.
> -              ;;
> -              ;; XXX: This can't be done when cross-compiling. Find another way
> -              ;; to generate hwdb.bin for cross-built systems.
> -              #$@(if (%current-target-system)
> -                     #~(#t)
> -                     #~((invoke (string-append #$output "/bin/udevadm")
> -                                "hwdb" "--update"))))))
> +              ;; eudev distributes the hwdb, but each file has to be enabled
> +              ;; by being copied under /lib/udev/hwdb.d. We accept all of
> +              ;; them.
> +              (symlink (string-append #$output "/etc/udev/hwdb.d")
> +                       (string-append #$output "/lib/udev/hwdb.d")))))
>         #:configure-flags #~(list "--enable-manpages")))
> +    (native-search-paths
> +      (list (search-path-specification
> +              (variable "UDEV_HWDB_PATH")
> +              (files '("lib/udev/hwdb.d")))
> +            ;; Never install a hwdb.bin file, always let the udev-hwdb-bin
> +            ;; profile hook generate it.
> +            (search-path-specification
> +              (variable "UDEV_HWDB_BIN")
> +              (files '("lib/udev/hwdb.bin"))
> +              (file-type 'regular)
> +              (separator #f))))

Maybe add a ;singled valued comment to the end of the above line.  Note
that given that file is to be generated in a profile hook, UDEV_HWDB_BIN
would never be set at *build* time, but that should not matter
much (the build environment being containerized and all).)

[...]

> diff --git a/guix/profiles.scm b/guix/profiles.scm
> index c88672c25a..d308e7fb88 100644
> --- a/guix/profiles.scm
> +++ b/guix/profiles.scm
> @@ -1905,6 +1905,34 @@ (define (texlive-font-maps manifest)
>                              (hook . texlive-font-maps)))
>          (return #f))))
>  
> +(define (udev-hwdb-bin manifest)
> +  "Return a derivation that builds lib/udev/hwdb.bin."
                                      ^
                                      @file{lib/udev/hwdb.bin}

> +  (define eudev
> +    (module-ref (resolve-interface '(gnu packages linux)) 'eudev))
> +  (define build
> +    (with-imported-modules
> +        (source-module-closure '((guix build utils)))
> +      #~(begin
> +          (use-modules (guix build utils))
> +          (let* ((inputs '#$(manifest-inputs manifest))
> +                 (hwdb-directories
> +                  (filter
> +                   file-exists?
> +                   (map (lambda (directory)
> +                          (string-append directory "/lib/udev/hwdb.d"))
> +                        inputs))))
> +            (setenv "UDEV_HWDB_PATH"
> +                    (string-join hwdb-directories ":")))

It'd be nicer to user 'evaluate-search-paths' with the UDEV_HWDB_PATH
search path.

> +          (invoke #$(file-append eudev "/bin/udevadm")
> +                  "hwdb" "--update"
> +                  "-o" (string-append #$output "/lib/udev/hwdb.bin")))))
> +  (gexp->derivation "udev-hwdb-bin" build
> +                    #:substitutable? #f
> +                    #:local-build? #t
> +                    #:properties
> +                    `((type . profile-hook)
> +                      (hook . udev-hwdb-bin))))
>
>  (define %default-profile-hooks
>    ;; This is the list of derivation-returning procedures that are called by
>    ;; default when making a non-empty profile.
> @@ -1919,6 +1947,7 @@ (define %default-profile-hooks
>          gtk-icon-themes
>          gtk-im-modules
>          texlive-font-maps
> +        udev-hwdb-bin
>          xdg-desktop-database
>          xdg-mime-database))

My only issue with this hook is that it introduces 'eudev' as a hard
dependency for generating guix profiles.  Would it make sense to follow
the approach used in 'gdk-pixbuf-loaders-cache-file', which is to look
if eudev is already part of the profile inputs (transitively), and skip
the hook if it isn't?

-- 
Thanks,
Maxim




^ permalink raw reply	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v3 1/3] gnu: eudev: Update libudev version to 251.
  2023-10-01 22:02             ` Maxim Cournoyer
@ 2023-10-02 17:02               ` Liliana Marie Prikler
  0 siblings, 0 replies; 91+ messages in thread
From: Liliana Marie Prikler @ 2023-10-02 17:02 UTC (permalink / raw)
  To: Maxim Cournoyer, Vivien Kraus; +Cc: 66099, rg

Am Sonntag, dem 01.10.2023 um 18:02 -0400 schrieb Maxim Cournoyer:
> > +            (search-path-specification
> > +              (variable "UDEV_HWDB_BIN")
> > +              (files '("lib/udev/hwdb.bin"))
> > +              (file-type 'regular)
> > +              (separator #f))))
> 
> Maybe add a ;singled valued comment to the end of the above line. 
> Note that given that file is to be generated in a profile hook,
> UDEV_HWDB_BIN would never be set at *build* time, but that should not
> matter much (the build environment being containerized and all).)
> 
> [...]
> 
> > +          (invoke #$(file-append eudev "/bin/udevadm")
> > +                  "hwdb" "--update"
> > +                  "-o" (string-append #$output
> > "/lib/udev/hwdb.bin")))))
> > +  (gexp->derivation "udev-hwdb-bin" build
> > +                    #:substitutable? #f
> > +                    #:local-build? #t
> > +                    #:properties
> > +                    `((type . profile-hook)
> > +                      (hook . udev-hwdb-bin))))
> > 
> >  (define %default-profile-hooks
> >    ;; This is the list of derivation-returning procedures that are
> > called by
> >    ;; default when making a non-empty profile.
> > @@ -1919,6 +1947,7 @@ (define %default-profile-hooks
> >          gtk-icon-themes
> >          gtk-im-modules
> >          texlive-font-maps
> > +        udev-hwdb-bin
> >          xdg-desktop-database
> >          xdg-mime-database))
> 
> My only issue with this hook is that it introduces 'eudev' as a hard
> dependency for generating guix profiles.  Would it make sense to
> follow the approach used in 'gdk-pixbuf-loaders-cache-file', which is
> to look if eudev is already part of the profile inputs
> (transitively), and skip the hook if it isn't?
Speaking of which, since eudev is basically system config stuff, I
think it might be better *not* to have the variable and the hook and
instead build the hwdb as part of udev-service-type.  Assuming, of
course, that we can already specify a fallback via config file – if no
such switch exists, we'd have to add it.

Cheers

^ permalink raw reply	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v4 1/4] gnu: eudev: Update libudev version to 251.
  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
  0 siblings, 1 reply; 91+ messages in thread
From: Liliana Marie Prikler @ 2023-10-02 17:12 UTC (permalink / raw)
  To: Vivien Kraus, 66099; +Cc: rg, maxim.cournoyer

Am Dienstag, dem 19.09.2023 um 13:23 +0200 schrieb Vivien Kraus:
> +    (native-search-paths
> +      (list (search-path-specification
> +              (variable "UDEV_HWDB_PATH")
> +              (files '("lib/udev/hwdb.d")))
Question for understanding this correctly: Is UDEV_HWDB_PATH honoured
for more than just UDEV_HWDB_BIN below or is this a "first file wins"
kind of deal?

> +            ;; Never install a hwdb.bin file, always let the udev-
> hwdb-bin
> +            ;; profile hook generate it.
> +            (search-path-specification
> +              (variable "UDEV_HWDB_BIN")
> +              (files '("lib/udev/hwdb.bin"))
> +              (file-type 'regular)
> +              (separator #f))))
As stated in my reply to Maxim, we probably don't want to set this in a
profile hook, but rather on a system/home config level.

Cheers

^ permalink raw reply	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v4 4/4] gnu: upower: Update to 1.90.2.
  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
  0 siblings, 1 reply; 91+ messages in thread
From: Liliana Marie Prikler @ 2023-10-02 17:17 UTC (permalink / raw)
  To: Vivien Kraus, 66099; +Cc: rg, maxim.cournoyer

Am Dienstag, dem 19.09.2023 um 13:32 +0200 schrieb Vivien Kraus:
> The new eudev now can install hwdb files. Upower has some, but they
> should get installed in upower’s output, not eudev’s.
> 
> The phases needed a rework. Now the 32-bit-specific test fix is
> always there,
> except it may be empty. A test needs to be disabled.
"A test" is not helpful here.
> 
> * gnu/packages/gnome.scm (upower): Update to 1.90.2.
> [#:configure-flags]: Set udevhwdbdir.
> [#:phases] <adjust-test-for-excess-precision>: Add this phase
> unconditionnally
> <disable-failing-test>: Disable the test.
We should probably merge these two into a single fix-test-suite
phase.  Then we can disable the failing test and adjust the other one
for excess precession on those arches where it's needed.
> [inputs]: Remove dbus-glib.
Okay.
> [native-inputs]: Add dbus for the tests.
> ---
"Add dbus." suffices.

Cheers




^ permalink raw reply	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v5 2/4] gnu: udev-service-type: accept hwdb file extensions.
  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
                           ` (2 preceding siblings ...)
  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         ` Vivien Kraus via Guix-patches via
  2023-10-04 16:52           ` Liliana Marie Prikler
  3 siblings, 1 reply; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-10-02 19:08 UTC (permalink / raw)
  To: Liliana Marie Prikler, maxim.cournoyer, 66099; +Cc: rg

The "rules" field in the udev-configuration record can now hold both rules and
hwdb files.

The udev-rules-union has been made generic, so that it works with either rules
or hwdb files.

Some udev-related auxiliary functions in (gnu services base) had non-texinfo
variable references in their docstrings ("FILE-NAME" instead of
"@var{file-name}").

udev-rule and file->udev-rule have very similar effects. file->udev-rule
operates on a file-like, and udev-rule on plain string contents. Now udev-rule
calls file->udev-rule with a plain-file file-like object.

The contents of the /etc directory now includes hwdb.d and hwdb.bin, which is
computed immediately.

The documentation has been reworked so as to explain why creating udev rules
or hwdb needs helper functions for configuration or extension.

The hwdb.bin file is conditionally computed by a native version of eudev, that
may be configured in the udev-service-type configuration. The condition is
that both target and native eudev have the same version. If so, we can
reasonably expect that the hwdb.bin file created by native eudev can later be
read by target eudev.

* gnu/services/base.scm (udev-things-union): Make udev-rules-union generic.
(udev-rules-union): Use udev-things-union.
(udev-hwdb-union): New function.
(udev-rule): Fix docstring and call file->udev-rule.
(udev-hwdb): New function.
(file->udev-rule): Fix docstring.
(file->udev-hwdb): New function.
(udev-rules-service): Fix docstring.
(udev-hwdb-service): New function.
(udev-etc): Add hwdb.d and hwdb.bin.
(module): Export udev-hwdb, file->udev-hwdb, and udev-hwdb-service.
(<udev-configuration>): Add the native-udev field.
* doc/guix.texi (Base Services)[udev-service-type]: Explain configuration and
extension values.
* doc/guix.texi (Base Services)[udev-hwdb]: Document it.
[udev-hwdb-service]: Same.
* doc/guix.texi (Base Services)[udev-configuration]: Document the native-udev
field.
---
 doc/guix.texi         |  52 +++++++++++++++++----
 gnu/services/base.scm | 103 +++++++++++++++++++++++++++++++++---------
 2 files changed, 123 insertions(+), 32 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 46591b2f64..3310271ec8 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -19322,9 +19322,23 @@ Base Services
 @file{/dev} directory dynamically, whose value is a
 @code{<udev-configuration>} object.
 
-This service type can be @emph{extended} using procedures
-@code{udev-rules-service} along with @code{file->udev-rule} or
-@code{udev-rule} which simplify the process of writing udev rules.
+Since the file names for udev rules and hwdb files matters, the
+configuration items for rules and hwdb cannot simply be plain file-like
+objects with the rules content, because the name would be
+ignored. Instead, they are directory file-like objects that contain
+optional rules in @code{lib/udev/rules.d} and optional hwdb files in
+@code{lib/udev/hwdb.d}. This way, the service can be configured with
+whole packages from which to take rules and hwdb files.
+
+The @code{udev-service-type} can be @emph{extended} with file-like
+directories that respect this hierarchy. However, to generate a
+configuration or an extension, it is advised to use @code{udev-rule} and
+@code{file->udev-rule} for rules, and @code{udev-hwdb} and
+@code{file->udev-hwdb} for hwdb files.
+
+In an operating-system declaration, this service type can be
+@emph{extended} using procedures @code{udev-rules-service} and
+@code{udev-hwdb-service}.
 @end defvar
 
 @deftp {Data Type} udev-configuration
@@ -19334,8 +19348,18 @@ Base Services
 @item @code{udev} (default: @code{eudev}) (type: file-like)
 Package object of the udev service.
 
+@item @code{native-udev} (default: @code{eudev}) (type: file-like)
+Native udev package to compile @code{hwdb.bin}. The trie format used for
+@code{hwdb.bin} must be compatible with the @code{udev} and
+@code{native-udev} fields of the udev configuration. To avoid generating
+@code{hwdb.bin}, pass @code{#f} as the @code{native-udev} field.
+
+In any case, if the package version string differs between @code{udev}
+and @code{native-udev}, @code{hwdb.bin} is @strong{not} created.
+
 @item @code{rules} (default: @var{'()}) (type: list-of-file-like)
-List of file-like objects denoting udev-rule files.
+List of file-like objects denoting udev-rule or udev-hwdb files under a
+sub-directory.
 
 @end table
 @end deftp
@@ -19358,6 +19382,11 @@ Base Services
 @end lisp
 @end deffn
 
+@deffn {Procedure} udev-hwdb @var{file-name} @var{contents}
+Return a udev-hwdb file named @var{file-name} containing the hardware
+information @var{contents}.
+@end deffn
+
 @deffn {Procedure} udev-rules-service @var{name} @var{rules} [#:groups '()]
 Return a service that extends @code{udev-service-type} with @var{rules}
 and @code{account-service-type} with @var{groups} as system groups.
@@ -19377,6 +19406,11 @@ Base Services
 @end lisp
 @end deffn
 
+@deffn {Procedure} udev-hwdb-service @var{name} @var{hwdb}
+Return a service that extends @code{udev-service-type} with
+@var{hwdb}. The service name is @code{@var{name}-udev-hwdb}.
+@end deffn
+
 @deffn {Procedure} file->udev-rule @var{file-name} @var{file}
 Return a udev-rule file named @var{file-name} containing the rules
 defined within @var{file}, a file-like object.
@@ -19401,12 +19435,10 @@ Base Services
 @end lisp
 @end deffn
 
-Additionally, Guix package definitions can be included in @var{rules} in
-order to extend the udev rules with the definitions found under their
-@file{lib/udev/rules.d} sub-directory.  In lieu of the previous
-@var{file->udev-rule} example, we could have used the
-@var{android-udev-rules} package which exists in Guix in the @code{(gnu
-packages android)} module.
+@deffn {Procedure} file->udev-hwdb @var{file-name} @var{file}
+Return a udev-hwdb file named @var{file-name} containing the rules
+defined within @var{file}, a file-like object.
+@end deffn
 
 The following example shows how to use the @var{android-udev-rules}
 package so that the Android tool @command{adb} can detect devices
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index b3f2d2e8b8..c813293697 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -81,6 +81,7 @@ (define-module (gnu services base)
                 #:select (mount-flags->bit-mask
                           swap-space->flags-bit-mask))
   #:use-module (guix gexp)
+  #:use-module ((guix packages) #:select (package-version))
   #:use-module (guix records)
   #:use-module (guix modules)
   #:use-module (guix pki)
@@ -153,8 +154,11 @@ (define-module (gnu services base)
             udev-service-type
             udev-service  ; deprecated
             udev-rule
+            udev-hwdb
             file->udev-rule
+            file->udev-hwdb
             udev-rules-service
+            udev-hwdb-service
 
             login-configuration
             login-configuration?
@@ -2181,11 +2185,14 @@ (define-record-type* <udev-configuration>
   udev-configuration?
   (udev   udev-configuration-udev                 ;file-like
           (default eudev))
-  (rules  udev-configuration-rules                ;list of file-like
+  (native-udev udev-configuration-native-udev
+               (default eudev))
+  (rules  udev-configuration-rules                ;list of rule- and
+                                                  ;hwdb-providing packages
           (default '())))
 
-(define (udev-rules-union packages)
-  "Return the union of the @code{lib/udev/rules.d} directories found in each
+(define (udev-things-union what packages)
+  "Return the union of the @code{lib/udev/@var{what}.d} directories found in each
 item of @var{packages}."
   (define build
     (with-imported-modules '((guix build union)
@@ -2197,7 +2204,8 @@ (define (udev-rules-union packages)
                        (srfi srfi-26))
 
           (define %standard-locations
-            '("/lib/udev/rules.d" "/libexec/udev/rules.d"))
+            '(#$(string-append "/lib/udev/" what ".d")
+                #$(string-append "/libexec/udev/" what ".d")))
 
           (define (rules-sub-directory directory)
             ;; Return the sub-directory of DIRECTORY containing udev rules, or
@@ -2208,10 +2216,27 @@ (define (udev-rules-union packages)
           (union-build #$output
                        (filter-map rules-sub-directory '#$packages)))))
 
-  (computed-file "udev-rules" build))
+  (computed-file (string-append "udev-" what) build))
+
+(define (udev-rules-union packages)
+  (udev-things-union "rules" packages))
+
+(define (udev-hwdb-union packages)
+  (udev-things-union "hwdb" packages))
 
 (define (udev-rule file-name contents)
-  "Return a directory with a udev rule file FILE-NAME containing CONTENTS."
+  "Return a directory with a udev rule file @var{file-name} containing
+@var{contents}."
+  (file->udev-rule file-name (plain-file file-name contents)))
+
+(define (udev-hwdb file-name contents)
+  "Return a directory with a udev hwdb file @var{file-name} containing
+@var{contents}."
+  (file->udev-hwdb file-name (plain-file file-name contents)))
+
+(define (file->udev-rule file-name file)
+  "Return a directory with a udev rule file @var{file-name} which is a copy of
+@var{file}."
   (computed-file file-name
                  (with-imported-modules '((guix build utils))
                    #~(begin
@@ -2220,26 +2245,27 @@ (define (udev-rule file-name contents)
                        (define rules.d
                          (string-append #$output "/lib/udev/rules.d"))
 
+                       (define file-copy-dest
+                         (string-append rules.d "/" #$file-name))
+
                        (mkdir-p rules.d)
-                       (call-with-output-file
-                           (string-append rules.d "/" #$file-name)
-                         (lambda (port)
-                           (display #$contents port)))))))
+                       (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."
+(define (file->udev-hwdb file-name file)
+  "Return a directory with a udev hwdb file @var{file-name} which is a copy of
+@var{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 hwdb.d
+                         (string-append #$output "/lib/udev/hwdb.d"))
 
                        (define file-copy-dest
-                         (string-append rules.d "/" #$file-name))
+                         (string-append hwdb.d "/" #$file-name))
 
-                       (mkdir-p rules.d)
+                       (mkdir-p hwdb.d)
                        (copy-file #$file file-copy-dest)))))
 
 (define kvm-udev-rule
@@ -2349,13 +2375,33 @@ (define udev.conf
 
 (define (udev-etc config)
   (match-record config <udev-configuration>
-    (udev rules)
+    (udev native-udev rules)
+    (let* ((hwdb.d
+            (udev-hwdb-union (cons* udev rules)))
+           (hwdb.bin
+            (and native-udev
+                 (equal? (package-version udev)
+                         (package-version native-udev))
+                 (computed-file
+                  "hwdb.bin"
+                  (with-imported-modules '((guix build utils))
+                    #~(begin
+                        (use-modules (guix build utils))
+                        (setenv "UDEV_HWDB_PATH" #$hwdb.d)
+                        (invoke #+(file-append native-udev "/bin/udevadm")
+                                "hwdb"
+                                "--update"
+                                "-o" #$output)))))))
     `(("udev"
        ,(file-union "udev"
                     `(("udev.conf" ,udev.conf)
                       ("rules.d"
                        ,(udev-rules-union (cons* udev kvm-udev-rule
-                                                 rules)))))))))
+                                                 rules)))
+                      ("hwdb.d" ,hwdb.d)
+                      ,@(if hwdb.bin
+                            `(("hwdb.bin" ,hwdb.bin))
+                            '()))))))))
 
 (define udev-service-type
   (service-type (name 'udev)
@@ -2384,10 +2430,10 @@ (define-deprecated (udev-service #:key (udev eudev) (rules '()))
            (udev-configuration (udev udev) (rules rules))))
 
 (define* (udev-rules-service name rules #:key (groups '()))
-  "Return a service that extends udev-service-type with RULES and
-account-service-type with GROUPS as system groups.  This works by creating a
-singleton service type NAME-udev-rules, of which the returned service is an
-instance."
+  "Return a service that extends udev-service-type with @var{rules} and
+@code{account-service-type} with @var{groups} as system groups.  This works by
+creating a singleton service type @code{@var{name}-udev-rules}, of which the
+returned service is an instance."
   (let* ((name (symbol-append name '-udev-rules))
          (account-extension
           (const (map (lambda (group)
@@ -2404,6 +2450,19 @@ (define* (udev-rules-service name rules #:key (groups '()))
                 (description "This service adds udev rules."))))
     (service type #f)))
 
+(define (udev-hwdb-service name hwdb-files)
+  "Return a service that extends udev-service-type with @var{hwdb-files}, named
+@code{@var{name}-udev-hwdb}."
+  (let* ((name (symbol-append name '-udev-hwdb))
+         (udev-extension (const (list hwdb-files)))
+         (type (service-type
+                (name name)
+                (extensions (list
+                             (service-extension
+                              udev-service-type udev-extension)))
+                (description "This service adds udev hwdb files."))))
+    (service type #f)))
+
 (define (swap-space->shepherd-service-name space)
   (let ((target (swap-space-target space)))
     (symbol-append 'swap-
-- 
2.41.0




^ permalink raw reply related	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v6 3/5] gnu: udev-service-type: accept hwdb file extensions.
  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
                                 ` (2 preceding siblings ...)
  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               ` Vivien Kraus via Guix-patches via
  2023-10-05  5:42                 ` 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
  4 siblings, 1 reply; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-10-02 19:08 UTC (permalink / raw)
  To: Liliana Marie Prikler, maxim.cournoyer, 66099; +Cc: rg

The "rules" field in the udev-configuration record can now hold both rules and
hwdb files.

The udev-rules-union has been made generic, and renamed to
udev-configuration-union, so that it works with either rules or hwdb files.

Some udev-related auxiliary functions in (gnu services base) had non-texinfo
variable references in their docstrings ("FILE-NAME" instead of
"@var{file-name}").

The contents of the /etc directory now includes hwdb.d and hwdb.bin, which is
computed immediately.

The documentation has been reworked so as to explain why creating udev rules
or hwdb needs helper functions for configuration or extension.

The hwdb.bin file is conditionally computed by a native version of eudev, that
may be configured in the udev-service-type configuration. The condition is
that both target and native eudev have the same version. If so, we can
reasonably expect that the hwdb.bin file created by native eudev can later be
read by target eudev.

* gnu/services/base.scm (udev-configuration-union): Make udev-rules-union generic.
(udev-hwdb): New function.
(file->udev-rule): Fix docstring.
(file->udev-hwdb): New function.
(udev-rules-service): Fix docstring.
(udev-hwdb-service): New function.
(udev-etc): Add hwdb.d and hwdb.bin.
(module): Export udev-hwdb, file->udev-hwdb, and udev-hwdb-service.
(<udev-configuration>): Add the native-udev field.
* doc/guix.texi (Base Services)[udev-service-type]: Explain configuration and
extension values.
* doc/guix.texi (Base Services)[udev-hwdb]: Document it.
[udev-hwdb-service]: Same.
* doc/guix.texi (Base Services)[udev-configuration]: Document the native-udev
field.
---
 doc/guix.texi         | 52 +++++++++++++++++++-----
 gnu/services/base.scm | 94 ++++++++++++++++++++++++++++++++++++-------
 2 files changed, 122 insertions(+), 24 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 46591b2f64..3310271ec8 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -19322,9 +19322,23 @@ Base Services
 @file{/dev} directory dynamically, whose value is a
 @code{<udev-configuration>} object.
 
-This service type can be @emph{extended} using procedures
-@code{udev-rules-service} along with @code{file->udev-rule} or
-@code{udev-rule} which simplify the process of writing udev rules.
+Since the file names for udev rules and hwdb files matters, the
+configuration items for rules and hwdb cannot simply be plain file-like
+objects with the rules content, because the name would be
+ignored. Instead, they are directory file-like objects that contain
+optional rules in @code{lib/udev/rules.d} and optional hwdb files in
+@code{lib/udev/hwdb.d}. This way, the service can be configured with
+whole packages from which to take rules and hwdb files.
+
+The @code{udev-service-type} can be @emph{extended} with file-like
+directories that respect this hierarchy. However, to generate a
+configuration or an extension, it is advised to use @code{udev-rule} and
+@code{file->udev-rule} for rules, and @code{udev-hwdb} and
+@code{file->udev-hwdb} for hwdb files.
+
+In an operating-system declaration, this service type can be
+@emph{extended} using procedures @code{udev-rules-service} and
+@code{udev-hwdb-service}.
 @end defvar
 
 @deftp {Data Type} udev-configuration
@@ -19334,8 +19348,18 @@ Base Services
 @item @code{udev} (default: @code{eudev}) (type: file-like)
 Package object of the udev service.
 
+@item @code{native-udev} (default: @code{eudev}) (type: file-like)
+Native udev package to compile @code{hwdb.bin}. The trie format used for
+@code{hwdb.bin} must be compatible with the @code{udev} and
+@code{native-udev} fields of the udev configuration. To avoid generating
+@code{hwdb.bin}, pass @code{#f} as the @code{native-udev} field.
+
+In any case, if the package version string differs between @code{udev}
+and @code{native-udev}, @code{hwdb.bin} is @strong{not} created.
+
 @item @code{rules} (default: @var{'()}) (type: list-of-file-like)
-List of file-like objects denoting udev-rule files.
+List of file-like objects denoting udev-rule or udev-hwdb files under a
+sub-directory.
 
 @end table
 @end deftp
@@ -19358,6 +19382,11 @@ Base Services
 @end lisp
 @end deffn
 
+@deffn {Procedure} udev-hwdb @var{file-name} @var{contents}
+Return a udev-hwdb file named @var{file-name} containing the hardware
+information @var{contents}.
+@end deffn
+
 @deffn {Procedure} udev-rules-service @var{name} @var{rules} [#:groups '()]
 Return a service that extends @code{udev-service-type} with @var{rules}
 and @code{account-service-type} with @var{groups} as system groups.
@@ -19377,6 +19406,11 @@ Base Services
 @end lisp
 @end deffn
 
+@deffn {Procedure} udev-hwdb-service @var{name} @var{hwdb}
+Return a service that extends @code{udev-service-type} with
+@var{hwdb}. The service name is @code{@var{name}-udev-hwdb}.
+@end deffn
+
 @deffn {Procedure} file->udev-rule @var{file-name} @var{file}
 Return a udev-rule file named @var{file-name} containing the rules
 defined within @var{file}, a file-like object.
@@ -19401,12 +19435,10 @@ Base Services
 @end lisp
 @end deffn
 
-Additionally, Guix package definitions can be included in @var{rules} in
-order to extend the udev rules with the definitions found under their
-@file{lib/udev/rules.d} sub-directory.  In lieu of the previous
-@var{file->udev-rule} example, we could have used the
-@var{android-udev-rules} package which exists in Guix in the @code{(gnu
-packages android)} module.
+@deffn {Procedure} file->udev-hwdb @var{file-name} @var{file}
+Return a udev-hwdb file named @var{file-name} containing the rules
+defined within @var{file}, a file-like object.
+@end deffn
 
 The following example shows how to use the @var{android-udev-rules}
 package so that the Android tool @command{adb} can detect devices
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 190803b780..00916a35e4 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -81,6 +81,7 @@ (define-module (gnu services base)
                 #:select (mount-flags->bit-mask
                           swap-space->flags-bit-mask))
   #:use-module (guix gexp)
+  #:use-module ((guix packages) #:select (package-version))
   #:use-module (guix records)
   #:use-module (guix modules)
   #:use-module (guix pki)
@@ -153,8 +154,11 @@ (define-module (gnu services base)
             udev-service-type
             udev-service  ; deprecated
             udev-rule
+            udev-hwdb
             file->udev-rule
+            file->udev-hwdb
             udev-rules-service
+            udev-hwdb-service
 
             login-configuration
             login-configuration?
@@ -2181,12 +2185,15 @@ (define-record-type* <udev-configuration>
   udev-configuration?
   (udev   udev-configuration-udev                 ;file-like
           (default eudev))
-  (rules  udev-configuration-rules                ;list of file-like
+  (native-udev udev-configuration-native-udev
+               (default eudev))
+  (rules  udev-configuration-rules                ;list of rule- and
+                                                  ;hwdb-providing packages
           (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-configuration-union subdirectory packages)
+  "Return the union of the @code{lib/udev/@var{subdirectory}.d} directories found
+in each item of @var{packages}."
   (define build
     (with-imported-modules '((guix build union)
                              (guix build utils))
@@ -2197,7 +2204,8 @@ (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
@@ -2208,15 +2216,21 @@ (define (udev-rules-union packages)
           (union-build #$output
                        (filter-map rules-sub-directory '#$packages)))))
 
-  (computed-file "udev-rules" build))
+  (computed-file (string-append "udev-" subdirectory) build))
 
 (define (udev-rule file-name contents)
   "Return a directory with a udev rule file @var{file-name} containing
 @var{contents}."
   (file->udev-rule file-name (plain-file file-name contents)))
 
+(define (udev-hwdb file-name contents)
+  "Return a directory with a udev hwdb file @var{file-name} containing
+@var{contents}."
+  (file->udev-hwdb file-name (plain-file 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."
+  "Return a directory with a udev rule file @var{file-name} which is a copy of
+@var{file}."
   (computed-file file-name
                  (with-imported-modules '((guix build utils))
                    #~(begin
@@ -2231,6 +2245,23 @@ (define (file->udev-rule file-name file)
                        (mkdir-p rules.d)
                        (copy-file #$file file-copy-dest)))))
 
+(define (file->udev-hwdb file-name file)
+  "Return a directory with a udev hwdb file @var{file-name} which is a copy of
+@var{file}."
+  (computed-file file-name
+                 (with-imported-modules '((guix build utils))
+                   #~(begin
+                       (use-modules (guix build utils))
+
+                       (define hwdb.d
+                         (string-append #$output "/lib/udev/hwdb.d"))
+
+                       (define file-copy-dest
+                         (string-append hwdb.d "/" #$file-name))
+
+                       (mkdir-p hwdb.d)
+                       (copy-file #$file file-copy-dest)))))
+
 (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,
@@ -2338,13 +2369,35 @@ (define udev.conf
 
 (define (udev-etc config)
   (match-record config <udev-configuration>
-    (udev rules)
+    (udev native-udev rules)
+    (let* ((hwdb.d
+            (udev-configuration-union "hwdb" (cons* udev rules)))
+           (hwdb.bin
+            (and native-udev
+                 (equal? (package-version udev)
+                         (package-version native-udev))
+                 (computed-file
+                  "hwdb.bin"
+                  (with-imported-modules '((guix build utils))
+                    #~(begin
+                        (use-modules (guix build utils))
+                        (setenv "UDEV_HWDB_PATH" #$hwdb.d)
+                        (invoke #+(file-append native-udev "/bin/udevadm")
+                                "hwdb"
+                                "--update"
+                                "-o" #$output)))))))
     `(("udev"
        ,(file-union "udev"
                     `(("udev.conf" ,udev.conf)
                       ("rules.d"
-                       ,(udev-rules-union (cons* udev kvm-udev-rule
-                                                 rules)))))))))
+                       ,(udev-configuration-union
+                         "rules"
+                         (cons* udev kvm-udev-rule
+                                rules)))
+                      ("hwdb.d" ,hwdb.d)
+                      ,@(if hwdb.bin
+                            `(("hwdb.bin" ,hwdb.bin))
+                            '()))))))))
 
 (define udev-service-type
   (service-type (name 'udev)
@@ -2373,10 +2426,10 @@ (define-deprecated (udev-service #:key (udev eudev) (rules '()))
            (udev-configuration (udev udev) (rules rules))))
 
 (define* (udev-rules-service name rules #:key (groups '()))
-  "Return a service that extends udev-service-type with RULES and
-account-service-type with GROUPS as system groups.  This works by creating a
-singleton service type NAME-udev-rules, of which the returned service is an
-instance."
+  "Return a service that extends udev-service-type with @var{rules} and
+@code{account-service-type} with @var{groups} as system groups.  This works by
+creating a singleton service type @code{@var{name}-udev-rules}, of which the
+returned service is an instance."
   (let* ((name (symbol-append name '-udev-rules))
          (account-extension
           (const (map (lambda (group)
@@ -2393,6 +2446,19 @@ (define* (udev-rules-service name rules #:key (groups '()))
                 (description "This service adds udev rules."))))
     (service type #f)))
 
+(define (udev-hwdb-service name hwdb-files)
+  "Return a service that extends udev-service-type with @var{hwdb-files}, named
+@code{@var{name}-udev-hwdb}."
+  (let* ((name (symbol-append name '-udev-hwdb))
+         (udev-extension (const (list hwdb-files)))
+         (type (service-type
+                (name name)
+                (extensions (list
+                             (service-extension
+                              udev-service-type udev-extension)))
+                (description "This service adds udev hwdb files."))))
+    (service type #f)))
+
 (define (swap-space->shepherd-service-name space)
   (let ((target (swap-space-target space)))
     (symbol-append 'swap-
-- 
2.41.0




^ permalink raw reply related	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v7 3/5] gnu: udev-service-type: accept hwdb file extensions.
  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
                                       ` (2 preceding siblings ...)
  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-02 19:08                     ` Vivien Kraus via Guix-patches via
  2023-10-05 14:31                       ` Maxim Cournoyer
  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  5:54                     ` [bug#66099] [PATCH gnome-team v7 0/5] Update eudev with a snippet, udev-service-type, upower Liliana Marie Prikler
  5 siblings, 1 reply; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-10-02 19:08 UTC (permalink / raw)
  To: Liliana Marie Prikler, maxim.cournoyer, 66099; +Cc: rg

The "rules" field in the udev-configuration record can now hold both rules and
hwdb files.

The udev-rules-union has been made generic, and renamed to
udev-configuration-union, so that it works with either rules or hwdb files.

Some udev-related auxiliary functions in (gnu services base) had non-texinfo
variable references in their docstrings ("FILE-NAME" instead of
"@var{file-name}").

The contents of the /etc directory now includes hwdb.d and hwdb.bin, which is
computed immediately.

The documentation has been reworked so as to explain why creating udev rules
or hwdb needs helper functions for configuration or extension.

The hwdb.bin file is conditionally computed by a native version of eudev, that
may be configured in the udev-service-type configuration. The condition is
that both target and native eudev have the same version. If so, we can
reasonably expect that the hwdb.bin file created by native eudev can later be
read by target eudev.

* gnu/services/base.scm (udev-configuration-union): Make udev-rules-union generic.
(udev-hwdb): New function.
(file->udev-rule): Fix docstring.
(file->udev-hwdb): New function.
(udev-rules-service): Fix docstring.
(udev-hwdb-service): New function.
(udev-etc): Add hwdb.d and hwdb.bin.
(module): Export udev-hwdb, file->udev-hwdb, and udev-hwdb-service.
(<udev-configuration>): Add the native-udev field.
* doc/guix.texi (Base Services)[udev-service-type]: Explain configuration and
extension values.
* doc/guix.texi (Base Services)[udev-hwdb]: Document it.
[udev-hwdb-service]: Same.
* doc/guix.texi (Base Services)[udev-configuration]: Document the native-udev
field.
---
 doc/guix.texi         | 52 +++++++++++++++++++-----
 gnu/services/base.scm | 94 ++++++++++++++++++++++++++++++++++++-------
 2 files changed, 122 insertions(+), 24 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 46591b2f64..3310271ec8 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -19322,9 +19322,23 @@ Base Services
 @file{/dev} directory dynamically, whose value is a
 @code{<udev-configuration>} object.
 
-This service type can be @emph{extended} using procedures
-@code{udev-rules-service} along with @code{file->udev-rule} or
-@code{udev-rule} which simplify the process of writing udev rules.
+Since the file names for udev rules and hwdb files matters, the
+configuration items for rules and hwdb cannot simply be plain file-like
+objects with the rules content, because the name would be
+ignored. Instead, they are directory file-like objects that contain
+optional rules in @code{lib/udev/rules.d} and optional hwdb files in
+@code{lib/udev/hwdb.d}. This way, the service can be configured with
+whole packages from which to take rules and hwdb files.
+
+The @code{udev-service-type} can be @emph{extended} with file-like
+directories that respect this hierarchy. However, to generate a
+configuration or an extension, it is advised to use @code{udev-rule} and
+@code{file->udev-rule} for rules, and @code{udev-hwdb} and
+@code{file->udev-hwdb} for hwdb files.
+
+In an operating-system declaration, this service type can be
+@emph{extended} using procedures @code{udev-rules-service} and
+@code{udev-hwdb-service}.
 @end defvar
 
 @deftp {Data Type} udev-configuration
@@ -19334,8 +19348,18 @@ Base Services
 @item @code{udev} (default: @code{eudev}) (type: file-like)
 Package object of the udev service.
 
+@item @code{native-udev} (default: @code{eudev}) (type: file-like)
+Native udev package to compile @code{hwdb.bin}. The trie format used for
+@code{hwdb.bin} must be compatible with the @code{udev} and
+@code{native-udev} fields of the udev configuration. To avoid generating
+@code{hwdb.bin}, pass @code{#f} as the @code{native-udev} field.
+
+In any case, if the package version string differs between @code{udev}
+and @code{native-udev}, @code{hwdb.bin} is @strong{not} created.
+
 @item @code{rules} (default: @var{'()}) (type: list-of-file-like)
-List of file-like objects denoting udev-rule files.
+List of file-like objects denoting udev-rule or udev-hwdb files under a
+sub-directory.
 
 @end table
 @end deftp
@@ -19358,6 +19382,11 @@ Base Services
 @end lisp
 @end deffn
 
+@deffn {Procedure} udev-hwdb @var{file-name} @var{contents}
+Return a udev-hwdb file named @var{file-name} containing the hardware
+information @var{contents}.
+@end deffn
+
 @deffn {Procedure} udev-rules-service @var{name} @var{rules} [#:groups '()]
 Return a service that extends @code{udev-service-type} with @var{rules}
 and @code{account-service-type} with @var{groups} as system groups.
@@ -19377,6 +19406,11 @@ Base Services
 @end lisp
 @end deffn
 
+@deffn {Procedure} udev-hwdb-service @var{name} @var{hwdb}
+Return a service that extends @code{udev-service-type} with
+@var{hwdb}. The service name is @code{@var{name}-udev-hwdb}.
+@end deffn
+
 @deffn {Procedure} file->udev-rule @var{file-name} @var{file}
 Return a udev-rule file named @var{file-name} containing the rules
 defined within @var{file}, a file-like object.
@@ -19401,12 +19435,10 @@ Base Services
 @end lisp
 @end deffn
 
-Additionally, Guix package definitions can be included in @var{rules} in
-order to extend the udev rules with the definitions found under their
-@file{lib/udev/rules.d} sub-directory.  In lieu of the previous
-@var{file->udev-rule} example, we could have used the
-@var{android-udev-rules} package which exists in Guix in the @code{(gnu
-packages android)} module.
+@deffn {Procedure} file->udev-hwdb @var{file-name} @var{file}
+Return a udev-hwdb file named @var{file-name} containing the rules
+defined within @var{file}, a file-like object.
+@end deffn
 
 The following example shows how to use the @var{android-udev-rules}
 package so that the Android tool @command{adb} can detect devices
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 190803b780..00916a35e4 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -81,6 +81,7 @@ (define-module (gnu services base)
                 #:select (mount-flags->bit-mask
                           swap-space->flags-bit-mask))
   #:use-module (guix gexp)
+  #:use-module ((guix packages) #:select (package-version))
   #:use-module (guix records)
   #:use-module (guix modules)
   #:use-module (guix pki)
@@ -153,8 +154,11 @@ (define-module (gnu services base)
             udev-service-type
             udev-service  ; deprecated
             udev-rule
+            udev-hwdb
             file->udev-rule
+            file->udev-hwdb
             udev-rules-service
+            udev-hwdb-service
 
             login-configuration
             login-configuration?
@@ -2181,12 +2185,15 @@ (define-record-type* <udev-configuration>
   udev-configuration?
   (udev   udev-configuration-udev                 ;file-like
           (default eudev))
-  (rules  udev-configuration-rules                ;list of file-like
+  (native-udev udev-configuration-native-udev
+               (default eudev))
+  (rules  udev-configuration-rules                ;list of rule- and
+                                                  ;hwdb-providing packages
           (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-configuration-union subdirectory packages)
+  "Return the union of the @code{lib/udev/@var{subdirectory}.d} directories found
+in each item of @var{packages}."
   (define build
     (with-imported-modules '((guix build union)
                              (guix build utils))
@@ -2197,7 +2204,8 @@ (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
@@ -2208,15 +2216,21 @@ (define (udev-rules-union packages)
           (union-build #$output
                        (filter-map rules-sub-directory '#$packages)))))
 
-  (computed-file "udev-rules" build))
+  (computed-file (string-append "udev-" subdirectory) build))
 
 (define (udev-rule file-name contents)
   "Return a directory with a udev rule file @var{file-name} containing
 @var{contents}."
   (file->udev-rule file-name (plain-file file-name contents)))
 
+(define (udev-hwdb file-name contents)
+  "Return a directory with a udev hwdb file @var{file-name} containing
+@var{contents}."
+  (file->udev-hwdb file-name (plain-file 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."
+  "Return a directory with a udev rule file @var{file-name} which is a copy of
+@var{file}."
   (computed-file file-name
                  (with-imported-modules '((guix build utils))
                    #~(begin
@@ -2231,6 +2245,23 @@ (define (file->udev-rule file-name file)
                        (mkdir-p rules.d)
                        (copy-file #$file file-copy-dest)))))
 
+(define (file->udev-hwdb file-name file)
+  "Return a directory with a udev hwdb file @var{file-name} which is a copy of
+@var{file}."
+  (computed-file file-name
+                 (with-imported-modules '((guix build utils))
+                   #~(begin
+                       (use-modules (guix build utils))
+
+                       (define hwdb.d
+                         (string-append #$output "/lib/udev/hwdb.d"))
+
+                       (define file-copy-dest
+                         (string-append hwdb.d "/" #$file-name))
+
+                       (mkdir-p hwdb.d)
+                       (copy-file #$file file-copy-dest)))))
+
 (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,
@@ -2338,13 +2369,35 @@ (define udev.conf
 
 (define (udev-etc config)
   (match-record config <udev-configuration>
-    (udev rules)
+    (udev native-udev rules)
+    (let* ((hwdb.d
+            (udev-configuration-union "hwdb" (cons* udev rules)))
+           (hwdb.bin
+            (and native-udev
+                 (equal? (package-version udev)
+                         (package-version native-udev))
+                 (computed-file
+                  "hwdb.bin"
+                  (with-imported-modules '((guix build utils))
+                    #~(begin
+                        (use-modules (guix build utils))
+                        (setenv "UDEV_HWDB_PATH" #$hwdb.d)
+                        (invoke #+(file-append native-udev "/bin/udevadm")
+                                "hwdb"
+                                "--update"
+                                "-o" #$output)))))))
     `(("udev"
        ,(file-union "udev"
                     `(("udev.conf" ,udev.conf)
                       ("rules.d"
-                       ,(udev-rules-union (cons* udev kvm-udev-rule
-                                                 rules)))))))))
+                       ,(udev-configuration-union
+                         "rules"
+                         (cons* udev kvm-udev-rule
+                                rules)))
+                      ("hwdb.d" ,hwdb.d)
+                      ,@(if hwdb.bin
+                            `(("hwdb.bin" ,hwdb.bin))
+                            '()))))))))
 
 (define udev-service-type
   (service-type (name 'udev)
@@ -2373,10 +2426,10 @@ (define-deprecated (udev-service #:key (udev eudev) (rules '()))
            (udev-configuration (udev udev) (rules rules))))
 
 (define* (udev-rules-service name rules #:key (groups '()))
-  "Return a service that extends udev-service-type with RULES and
-account-service-type with GROUPS as system groups.  This works by creating a
-singleton service type NAME-udev-rules, of which the returned service is an
-instance."
+  "Return a service that extends udev-service-type with @var{rules} and
+@code{account-service-type} with @var{groups} as system groups.  This works by
+creating a singleton service type @code{@var{name}-udev-rules}, of which the
+returned service is an instance."
   (let* ((name (symbol-append name '-udev-rules))
          (account-extension
           (const (map (lambda (group)
@@ -2393,6 +2446,19 @@ (define* (udev-rules-service name rules #:key (groups '()))
                 (description "This service adds udev rules."))))
     (service type #f)))
 
+(define (udev-hwdb-service name hwdb-files)
+  "Return a service that extends udev-service-type with @var{hwdb-files}, named
+@code{@var{name}-udev-hwdb}."
+  (let* ((name (symbol-append name '-udev-hwdb))
+         (udev-extension (const (list hwdb-files)))
+         (type (service-type
+                (name name)
+                (extensions (list
+                             (service-extension
+                              udev-service-type udev-extension)))
+                (description "This service adds udev hwdb files."))))
+    (service type #f)))
+
 (define (swap-space->shepherd-service-name space)
   (let ((target (swap-space-target space)))
     (symbol-append 'swap-
-- 
2.41.0




^ permalink raw reply related	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v8 4/6] gnu: udev-service-type: accept hardware description file extensions.
  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
                                             ` (2 preceding siblings ...)
  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-02 19:08                           ` 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
                                             ` (2 subsequent siblings)
  6 siblings, 1 reply; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-10-02 19:08 UTC (permalink / raw)
  To: Liliana Marie Prikler, Maxim Cournoyer, 66099; +Cc: rg

The udev-configuration record now has a hardware field.

The contents of the /etc directory now includes hwdb.d and hwdb.bin, which is
computed immediately.

The documentation has been reworked so as to explain why creating udev rules
or hwdb needs helper functions for configuration or extension.

The hwdb.bin file is conditionally computed by a native version of eudev, that
may be configured in the udev-service-type configuration. The condition is
that both target and native eudev have the same version. If so, we can
reasonably expect that the hwdb.bin file created by native eudev can later be
read by target eudev.

* gnu/services/base.scm (udev-hardware): New function.
(file->udev-hardware): New function.
(udev-hardware-service): New function.
(udev-etc): Add hwdb.d and hwdb.bin.
(module): Export udev-hardware, file->udev-hardware, and udev-hardware-service.
(<udev-configuration>): Add the native-udev field.
(udev-service-type) [extend]: Populate the hardware field.
* doc/guix.texi (Base Services)[udev-service-type]: Explain configuration and
extension values.
* doc/guix.texi (Base Services)[udev-hardware]: Document it.
[udev-hardware-service]: Same.
* doc/guix.texi (Base Services)[udev-configuration]: Document the native-udev
field.
---
 doc/guix.texi         | 57 +++++++++++++++++++++++++++++++--------
 gnu/services/base.scm | 62 ++++++++++++++++++++++++++++++++++++++-----
 2 files changed, 101 insertions(+), 18 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 46591b2f64..ec0bd688f0 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -19322,9 +19322,23 @@ Base Services
 @file{/dev} directory dynamically, whose value is a
 @code{<udev-configuration>} object.
 
-This service type can be @emph{extended} using procedures
-@code{udev-rules-service} along with @code{file->udev-rule} or
-@code{udev-rule} which simplify the process of writing udev rules.
+Since the file names for udev rules and hardware description files
+matter, the configuration items for rules and hardware cannot simply be
+plain file-like objects with the rules content, because the name would
+be ignored.  Instead, they are directory file-like objects that contain
+optional rules in @file{lib/udev/rules.d} and optional hardware files in
+@file{lib/udev/hwdb.d}.  This way, the service can be configured with
+whole packages from which to take rules and hwdb files.
+
+The @code{udev-service-type} can be @emph{extended} with file-like
+directories that respect this hierarchy.  For convenience, the
+@code{udev-rule} and @code{file->udev-rule} can be used to construct
+udev rules, while @code{udev-hardware} and @code{file->udev-hardware}
+can be used to construct hardware description files.
+
+In an @code{operating-system} declaration, this service type can be
+@emph{extended} using procedures @code{udev-rules-service} and
+@code{udev-hardware-service}.
 @end defvar
 
 @deftp {Data Type} udev-configuration
@@ -19332,10 +19346,17 @@ Base Services
 
 @table @asis
 @item @code{udev} (default: @code{eudev}) (type: file-like)
-Package object of the udev service.
+Package object of the udev service.  This package is used at run-time,
+when compiled for the target system.  In order to generate the
+@file{hwdb.bin} hardware index, it is also used when generating the
+system definition, compiled for the current system.
 
 @item @code{rules} (default: @var{'()}) (type: list-of-file-like)
-List of file-like objects denoting udev-rule files.
+List of file-like objects denoting udev rule files under a sub-directory.
+
+@item @code{hardware} (default: @var{'()}) (type: list-of-file-like)
+List of file-like objects denoting udev hardware description files under
+a sub-directory.
 
 @end table
 @end deftp
@@ -19358,6 +19379,11 @@ Base Services
 @end lisp
 @end deffn
 
+@deffn {Procedure} udev-hardware @var{file-name} @var{contents}
+Return a udev hardware description file named @var{file-name} containing
+the hardware information @var{contents}.
+@end deffn
+
 @deffn {Procedure} udev-rules-service @var{name} @var{rules} [#:groups '()]
 Return a service that extends @code{udev-service-type} with @var{rules}
 and @code{account-service-type} with @var{groups} as system groups.
@@ -19377,6 +19403,11 @@ Base Services
 @end lisp
 @end deffn
 
+@deffn {Procedure} udev-hardware-service @var{name} @var{hardware}
+Return a service that extends @code{udev-service-type} with
+@var{hardware}.  The service name is @code{@var{name}-udev-hardware}.
+@end deffn
+
 @deffn {Procedure} file->udev-rule @var{file-name} @var{file}
 Return a udev-rule file named @var{file-name} containing the rules
 defined within @var{file}, a file-like object.
@@ -19401,12 +19432,16 @@ Base Services
 @end lisp
 @end deffn
 
-Additionally, Guix package definitions can be included in @var{rules} in
-order to extend the udev rules with the definitions found under their
-@file{lib/udev/rules.d} sub-directory.  In lieu of the previous
-@var{file->udev-rule} example, we could have used the
-@var{android-udev-rules} package which exists in Guix in the @code{(gnu
-packages android)} module.
+Since guix package definitions can be included in @var{rules} in order
+to use all their rules under the @file{lib/udev/rules.d} sub-directory,
+then in lieu of the previous @var{file->udev-rule} example, we could
+have used the @var{android-udev-rules} package which exists in Guix in
+the @code{(gnu packages android)} module.
+
+@deffn {Procedure} file->udev-hardware @var{file-name} @var{file}
+Return a udev hardware description file named @var{file-name} containing
+the rules defined within @var{file}, a file-like object.
+@end deffn
 
 The following example shows how to use the @var{android-udev-rules}
 package so that the Android tool @command{adb} can detect devices
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 0bf0568a4e..0ca7f2af4a 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -81,6 +81,7 @@ (define-module (gnu services base)
                 #:select (mount-flags->bit-mask
                           swap-space->flags-bit-mask))
   #:use-module (guix gexp)
+  #:use-module ((guix packages) #:select (package-version))
   #:use-module (guix records)
   #:use-module (guix modules)
   #:use-module (guix pki)
@@ -150,11 +151,15 @@ (define-module (gnu services base)
             udev-configuration
             udev-configuration?
             udev-configuration-rules
+            udev-configuration-hardware
             udev-service-type
             udev-service  ; deprecated
             udev-rule
+            udev-hardware
             file->udev-rule
+            file->udev-hardware
             udev-rules-service
+            udev-hardware-service
 
             login-configuration
             login-configuration?
@@ -2181,8 +2186,10 @@ (define-record-type* <udev-configuration>
   udev-configuration?
   (udev   udev-configuration-udev                 ;file-like
           (default eudev))
-  (rules  udev-configuration-rules                ;list of file-like
-          (default '())))
+  (rules  udev-configuration-rules                ;package-like file-like
+          (default '()))
+  (hardware  udev-configuration-hardware          ;package-like file-like
+             (default '())))
 
 (define (udev-configurations-union subdirectory packages)
   "Return the union of the lib/udev/SUBDIRECTORY.d directories found in each
@@ -2224,6 +2231,10 @@ (define (udev-rule file-name contents)
   "Return a directory with a udev rule file FILE-NAME containing CONTENTS."
   (udev-configuration-file "rules" file-name contents))
 
+(define (udev-hardware file-name contents)
+  "Return a directory with a udev hardware file FILE-NAME containing CONTENTS."
+  (udev-configuration-file "hwdb" file-name contents))
+
 (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."
@@ -2248,6 +2259,10 @@ (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 (file->udev-hardware file-name file)
+  "Return a directory with a udev hardware file FILE-NAME which is a copy of FILE."
+  (file->udev-configuration-file "hwdb" 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,
@@ -2355,13 +2370,30 @@ (define udev.conf
 
 (define (udev-etc config)
   (match-record config <udev-configuration>
-    (udev rules)
+    (udev rules hardware)
+    (let* ((hwdb.d
+            (udev-configurations-union "hwdb" (cons* udev hardware)))
+           (hwdb.bin
+            (computed-file
+             "hwdb.bin"
+             (with-imported-modules '((guix build utils))
+               #~(begin
+                   (use-modules (guix build utils))
+                   (setenv "UDEV_HWDB_PATH" #$hwdb.d)
+                   (invoke #+(file-append udev "/bin/udevadm")
+                           "hwdb"
+                           "--update"
+                           "-o" #$output))))))
     `(("udev"
        ,(file-union "udev"
                     `(("udev.conf" ,udev.conf)
                       ("rules.d"
                        ,(udev-rules-union (cons* udev kvm-udev-rule
-                                                 rules)))))))))
+                                                 rules)))
+                      ("hwdb.d" ,hwdb.d)
+                      ,@(if hwdb.bin
+                            `(("hwdb.bin" ,hwdb.bin))
+                            '()))))))))
 
 (define udev-service-type
   (service-type (name 'udev)
@@ -2370,12 +2402,15 @@ (define udev-service-type
                                           udev-shepherd-service)
                        (service-extension etc-service-type udev-etc)))
                 (compose concatenate)           ;concatenate the list of rules
-                (extend (lambda (config rules)
+                (extend (lambda (config extensions)
                           (let ((initial-rules
-                                 (udev-configuration-rules config)))
+                                 (udev-configuration-rules config))
+                                (initial-hardware
+                                 (udev-configuration-hardware config)))
                             (udev-configuration
                              (inherit config)
-                             (rules (append initial-rules rules))))))
+                             (rules (append initial-rules extensions))
+                             (hardware (append initial-hardware extensions))))))
                 (default-value (udev-configuration))
                 (description
                  "Run @command{udev}, which populates the @file{/dev}
@@ -2410,6 +2445,19 @@ (define* (udev-rules-service name rules #:key (groups '()))
                 (description "This service adds udev rules."))))
     (service type #f)))
 
+(define (udev-hardware-service name hardware-files)
+  "Return a service that extends udev-service-type with HARDWARE-FILES, named
+NAME-udev-hardware."
+  (let* ((name (symbol-append name '-udev-hardware))
+         (udev-extension (const (list hardware-files)))
+         (type (service-type
+                (name name)
+                (extensions (list
+                             (service-extension
+                              udev-service-type udev-extension)))
+                (description "This service adds udev hardware files."))))
+    (service type #f)))
+
 (define (swap-space->shepherd-service-name space)
   (let ((target (swap-space-target space)))
     (symbol-append 'swap-
-- 
2.41.0




^ permalink raw reply related	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v9 4/7] gnu: udev-service-type: accept hardware description file extensions.
  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
                                                   ` (2 preceding siblings ...)
  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                                 ` 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
                                                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-10-02 19:08 UTC (permalink / raw)
  To: Liliana Marie Prikler, Maxim Cournoyer, 66099; +Cc: rg

The udev-configuration record now has a hardware field.

The contents of the /etc/udev directory now includes hwdb.bin, which is
computed when the system is instanciated (prior to system activation).  The
hardware description files used to generate hwdb.bin are not installed in
/etc, because they are not required at run-time.

The documentation has been reworked so as to explain why creating udev rules
or hardware needs helper functions for configuration or extension.

* gnu/services/base.scm (udev-hardware): New function.
(file->udev-hardware): New function.
(udev-hardware-service): New function.
(udev-etc): Add hwdb.d and hwdb.bin.
(module): Export udev-hardware, file->udev-hardware, and udev-hardware-service.
(<udev-configuration>): Add the native-udev field.
(udev-service-type) [extend]: Populate the hardware field.
* doc/guix.texi (Base Services)[udev-service-type]: Explain configuration and
extension values.
* doc/guix.texi (Base Services)[udev-hardware]: Document it.
[udev-hardware-service]: Same.
* doc/guix.texi (Base Services)[udev-configuration]: Document the native-udev
field.
---
 doc/guix.texi         | 57 +++++++++++++++++++++++++++-------
 gnu/services/base.scm | 72 ++++++++++++++++++++++++++++++++++---------
 2 files changed, 104 insertions(+), 25 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 46591b2f64..ec0bd688f0 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -19322,9 +19322,23 @@ Base Services
 @file{/dev} directory dynamically, whose value is a
 @code{<udev-configuration>} object.
 
-This service type can be @emph{extended} using procedures
-@code{udev-rules-service} along with @code{file->udev-rule} or
-@code{udev-rule} which simplify the process of writing udev rules.
+Since the file names for udev rules and hardware description files
+matter, the configuration items for rules and hardware cannot simply be
+plain file-like objects with the rules content, because the name would
+be ignored.  Instead, they are directory file-like objects that contain
+optional rules in @file{lib/udev/rules.d} and optional hardware files in
+@file{lib/udev/hwdb.d}.  This way, the service can be configured with
+whole packages from which to take rules and hwdb files.
+
+The @code{udev-service-type} can be @emph{extended} with file-like
+directories that respect this hierarchy.  For convenience, the
+@code{udev-rule} and @code{file->udev-rule} can be used to construct
+udev rules, while @code{udev-hardware} and @code{file->udev-hardware}
+can be used to construct hardware description files.
+
+In an @code{operating-system} declaration, this service type can be
+@emph{extended} using procedures @code{udev-rules-service} and
+@code{udev-hardware-service}.
 @end defvar
 
 @deftp {Data Type} udev-configuration
@@ -19332,10 +19346,17 @@ Base Services
 
 @table @asis
 @item @code{udev} (default: @code{eudev}) (type: file-like)
-Package object of the udev service.
+Package object of the udev service.  This package is used at run-time,
+when compiled for the target system.  In order to generate the
+@file{hwdb.bin} hardware index, it is also used when generating the
+system definition, compiled for the current system.
 
 @item @code{rules} (default: @var{'()}) (type: list-of-file-like)
-List of file-like objects denoting udev-rule files.
+List of file-like objects denoting udev rule files under a sub-directory.
+
+@item @code{hardware} (default: @var{'()}) (type: list-of-file-like)
+List of file-like objects denoting udev hardware description files under
+a sub-directory.
 
 @end table
 @end deftp
@@ -19358,6 +19379,11 @@ Base Services
 @end lisp
 @end deffn
 
+@deffn {Procedure} udev-hardware @var{file-name} @var{contents}
+Return a udev hardware description file named @var{file-name} containing
+the hardware information @var{contents}.
+@end deffn
+
 @deffn {Procedure} udev-rules-service @var{name} @var{rules} [#:groups '()]
 Return a service that extends @code{udev-service-type} with @var{rules}
 and @code{account-service-type} with @var{groups} as system groups.
@@ -19377,6 +19403,11 @@ Base Services
 @end lisp
 @end deffn
 
+@deffn {Procedure} udev-hardware-service @var{name} @var{hardware}
+Return a service that extends @code{udev-service-type} with
+@var{hardware}.  The service name is @code{@var{name}-udev-hardware}.
+@end deffn
+
 @deffn {Procedure} file->udev-rule @var{file-name} @var{file}
 Return a udev-rule file named @var{file-name} containing the rules
 defined within @var{file}, a file-like object.
@@ -19401,12 +19432,16 @@ Base Services
 @end lisp
 @end deffn
 
-Additionally, Guix package definitions can be included in @var{rules} in
-order to extend the udev rules with the definitions found under their
-@file{lib/udev/rules.d} sub-directory.  In lieu of the previous
-@var{file->udev-rule} example, we could have used the
-@var{android-udev-rules} package which exists in Guix in the @code{(gnu
-packages android)} module.
+Since guix package definitions can be included in @var{rules} in order
+to use all their rules under the @file{lib/udev/rules.d} sub-directory,
+then in lieu of the previous @var{file->udev-rule} example, we could
+have used the @var{android-udev-rules} package which exists in Guix in
+the @code{(gnu packages android)} module.
+
+@deffn {Procedure} file->udev-hardware @var{file-name} @var{file}
+Return a udev hardware description file named @var{file-name} containing
+the rules defined within @var{file}, a file-like object.
+@end deffn
 
 The following example shows how to use the @var{android-udev-rules}
 package so that the Android tool @command{adb} can detect devices
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index f674d48496..32a89fb190 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -81,6 +81,7 @@ (define-module (gnu services base)
                 #:select (mount-flags->bit-mask
                           swap-space->flags-bit-mask))
   #:use-module (guix gexp)
+  #:use-module ((guix packages) #:select (package-version))
   #:use-module (guix records)
   #:use-module (guix modules)
   #:use-module (guix pki)
@@ -150,11 +151,15 @@ (define-module (gnu services base)
             udev-configuration
             udev-configuration?
             udev-configuration-rules
+            udev-configuration-hardware
             udev-service-type
             udev-service  ; deprecated
             udev-rule
+            udev-hardware
             file->udev-rule
+            file->udev-hardware
             udev-rules-service
+            udev-hardware-service
 
             login-configuration
             login-configuration?
@@ -2182,10 +2187,12 @@ (define-record-type* <udev-configuration>
   (udev   udev-configuration-udev                 ;file-like
           (default eudev))
   (rules  udev-configuration-rules                ;list of file-like
-          (default '())))
+          (default '()))
+  (hardware  udev-configuration-hardware          ;list of file-like
+             (default '())))
 
 (define (udev-configurations-union subdirectory packages)
-  "Return the union of the lib/udev/SUBDIRECTORY.d directories found in each
+  "Return the union of the lib/udev/SUBDIRECTORY directories found in each
 item of PACKAGES."
   (define build
     (with-imported-modules '((guix build union)
@@ -2197,8 +2204,8 @@ (define (udev-configurations-union subdirectory packages)
                        (srfi srfi-26))
 
           (define %standard-locations
-            '(#$(string-append "/lib/udev/" subdirectory ".d")
-                #$(string-append "/libexec/udev/" subdirectory ".d")))
+            '(#$(string-append "/lib/udev/" subdirectory)
+                #$(string-append "/libexec/udev/" subdirectory)))
 
           (define (configuration-sub-directory directory)
             ;; Return the sub-directory of DIRECTORY containing udev
@@ -2214,7 +2221,7 @@ (define (udev-configurations-union subdirectory packages)
 (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))
+  (udev-configurations-union "rules.d" packages))
 
 (define (udev-configuration-file subdirectory file-name contents)
   "Return a directory with a udev configuration file FILE-NAME containing CONTENTS."
@@ -2222,7 +2229,11 @@ (define (udev-configuration-file subdirectory file-name contents)
 
 (define (udev-rule file-name contents)
   "Return a directory with a udev rule file FILE-NAME containing CONTENTS."
-  (udev-configuration-file "rules" file-name contents))
+  (udev-configuration-file "rules.d" file-name contents))
+
+(define (udev-hardware file-name contents)
+  "Return a directory with a udev hardware file FILE-NAME containing CONTENTS."
+  (udev-configuration-file "hwdb.d" file-name contents))
 
 (define (file->udev-configuration-file subdirectory file-name file)
   "Return a directory with a udev configuration file FILE-NAME which is a copy
@@ -2235,8 +2246,7 @@ (define (file->udev-configuration-file subdirectory file-name file)
                        (define configuration-directory
                          (string-append #$output
                                         "/lib/udev/"
-                                        #$subdirectory
-                                        ".d"))
+                                        #$subdirectory))
 
                        (define file-copy-dest
                          (string-append configuration-directory "/" #$file-name))
@@ -2246,7 +2256,11 @@ (define (file->udev-configuration-file subdirectory file-name file)
 
 (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))
+  (file->udev-configuration-file "rules.d" file-name file))
+
+(define (file->udev-hardware file-name file)
+  "Return a directory with a udev hardware file FILE-NAME which is a copy of FILE."
+  (file->udev-configuration-file "hwdb.d" file-name file))
 
 (define kvm-udev-rule
   ;; Return a directory with a udev rule that changes the group of /dev/kvm to
@@ -2355,13 +2369,27 @@ (define udev.conf
 
 (define (udev-etc config)
   (match-record config <udev-configuration>
-    (udev rules)
+    (udev rules hardware)
+    (let* ((hardware
+            (udev-configurations-union "hwdb.d" (cons* udev hardware)))
+           (hwdb.bin
+            (computed-file
+             "hwdb.bin"
+             (with-imported-modules '((guix build utils))
+               #~(begin
+                   (use-modules (guix build utils))
+                   (setenv "UDEV_HWDB_PATH" #$hardware)
+                   (invoke #+(file-append udev "/bin/udevadm")
+                           "hwdb"
+                           "--update"
+                           "-o" #$output))))))
     `(("udev"
        ,(file-union "udev"
                     `(("udev.conf" ,udev.conf)
                       ("rules.d"
                        ,(udev-rules-union (cons* udev kvm-udev-rule
-                                                 rules)))))))))
+                                                 rules)))
+                      ("hwdb.bin" ,hwdb.bin))))))))
 
 (define udev-service-type
   (service-type (name 'udev)
@@ -2370,12 +2398,15 @@ (define udev-service-type
                                           udev-shepherd-service)
                        (service-extension etc-service-type udev-etc)))
                 (compose concatenate)           ;concatenate the list of rules
-                (extend (lambda (config rules)
+                (extend (lambda (config extensions)
                           (let ((initial-rules
-                                 (udev-configuration-rules config)))
+                                 (udev-configuration-rules config))
+                                (initial-hardware
+                                 (udev-configuration-hardware config)))
                             (udev-configuration
                              (inherit config)
-                             (rules (append initial-rules rules))))))
+                             (rules (append initial-rules extensions))
+                             (hardware (append initial-hardware extensions))))))
                 (default-value (udev-configuration))
                 (description
                  "Run @command{udev}, which populates the @file{/dev}
@@ -2410,6 +2441,19 @@ (define* (udev-rules-service name rules #:key (groups '()))
                 (description "This service adds udev rules."))))
     (service type #f)))
 
+(define (udev-hardware-service name hardware-files)
+  "Return a service that extends udev-service-type with HARDWARE-FILES, named
+NAME-udev-hardware."
+  (let* ((name (symbol-append name '-udev-hardware))
+         (udev-extension (const (list hardware-files)))
+         (type (service-type
+                (name name)
+                (extensions (list
+                             (service-extension
+                              udev-service-type udev-extension)))
+                (description "This service adds udev hardware files."))))
+    (service type #f)))
+
 (define (swap-space->shepherd-service-name space)
   (let ((target (swap-space-target space)))
     (symbol-append 'swap-
-- 
2.41.0




^ permalink raw reply related	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v10 4/6] gnu: udev-service-type: accept hardware description file extensions.
  2023-10-05 17:24                                           ` [bug#66099] [PATCH gnome-team v10 3/6] services: udev: Make udev-rule helper functions generic Vivien Kraus via Guix-patches via
@ 2023-10-02 19:08                                             ` 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
  0 siblings, 1 reply; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-10-02 19:08 UTC (permalink / raw)
  To: Maxim Cournoyer, Liliana Marie Prikler, 66099; +Cc: rg

The udev-configuration record now has a hardware field.

The contents of the /etc/udev directory now includes hwdb.bin, which is
computed when the system is instanciated (prior to system activation).  The
hardware description files used to generate hwdb.bin are not installed in
/etc, because they are not required at run-time.

The documentation has been reworked so as to explain why creating udev rules
or hardware needs helper functions for configuration or extension.

* gnu/services/base.scm (udev-hardware): New function.
(file->udev-hardware): New function.
(udev-hardware-service): New function.
(udev-etc): Add hwdb.d and hwdb.bin.
(module): Export udev-hardware, file->udev-hardware, and udev-hardware-service.
(<udev-configuration>): Add the native-udev field.
(udev-service-type) [extend]: Populate the hardware field.
* doc/guix.texi (Base Services)[udev-service-type]: Explain configuration and
extension values.
* doc/guix.texi (Base Services)[udev-hardware]: Document it.
[udev-hardware-service]: Same.
* doc/guix.texi (Base Services)[udev-configuration]: Document the native-udev
field.
---
 doc/guix.texi         | 57 +++++++++++++++++++++++++++-------
 gnu/services/base.scm | 72 ++++++++++++++++++++++++++++++++++---------
 2 files changed, 104 insertions(+), 25 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index ad26a29513..3530d317ec 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -19362,9 +19362,23 @@ Base Services
 @file{/dev} directory dynamically, whose value is a
 @code{<udev-configuration>} object.
 
-This service type can be @emph{extended} using procedures
-@code{udev-rules-service} along with @code{file->udev-rule} or
-@code{udev-rule} which simplify the process of writing udev rules.
+Since the file names for udev rules and hardware description files
+matter, the configuration items for rules and hardware cannot simply be
+plain file-like objects with the rules content, because the name would
+be ignored.  Instead, they are directory file-like objects that contain
+optional rules in @file{lib/udev/rules.d} and optional hardware files in
+@file{lib/udev/hwdb.d}.  This way, the service can be configured with
+whole packages from which to take rules and hwdb files.
+
+The @code{udev-service-type} can be @emph{extended} with file-like
+directories that respect this hierarchy.  For convenience, the
+@code{udev-rule} and @code{file->udev-rule} can be used to construct
+udev rules, while @code{udev-hardware} and @code{file->udev-hardware}
+can be used to construct hardware description files.
+
+In an @code{operating-system} declaration, this service type can be
+@emph{extended} using procedures @code{udev-rules-service} and
+@code{udev-hardware-service}.
 @end defvar
 
 @deftp {Data Type} udev-configuration
@@ -19372,10 +19386,17 @@ Base Services
 
 @table @asis
 @item @code{udev} (default: @code{eudev}) (type: file-like)
-Package object of the udev service.
+Package object of the udev service.  This package is used at run-time,
+when compiled for the target system.  In order to generate the
+@file{hwdb.bin} hardware index, it is also used when generating the
+system definition, compiled for the current system.
 
 @item @code{rules} (default: @var{'()}) (type: list-of-file-like)
-List of file-like objects denoting udev-rule files.
+List of file-like objects denoting udev rule files under a sub-directory.
+
+@item @code{hardware} (default: @var{'()}) (type: list-of-file-like)
+List of file-like objects denoting udev hardware description files under
+a sub-directory.
 
 @end table
 @end deftp
@@ -19398,6 +19419,11 @@ Base Services
 @end lisp
 @end deffn
 
+@deffn {Procedure} udev-hardware @var{file-name} @var{contents}
+Return a udev hardware description file named @var{file-name} containing
+the hardware information @var{contents}.
+@end deffn
+
 @deffn {Procedure} udev-rules-service @var{name} @var{rules} [#:groups '()]
 Return a service that extends @code{udev-service-type} with @var{rules}
 and @code{account-service-type} with @var{groups} as system groups.
@@ -19417,6 +19443,11 @@ Base Services
 @end lisp
 @end deffn
 
+@deffn {Procedure} udev-hardware-service @var{name} @var{hardware}
+Return a service that extends @code{udev-service-type} with
+@var{hardware}.  The service name is @code{@var{name}-udev-hardware}.
+@end deffn
+
 @deffn {Procedure} file->udev-rule @var{file-name} @var{file}
 Return a udev-rule file named @var{file-name} containing the rules
 defined within @var{file}, a file-like object.
@@ -19441,12 +19472,16 @@ Base Services
 @end lisp
 @end deffn
 
-Additionally, Guix package definitions can be included in @var{rules} in
-order to extend the udev rules with the definitions found under their
-@file{lib/udev/rules.d} sub-directory.  In lieu of the previous
-@var{file->udev-rule} example, we could have used the
-@var{android-udev-rules} package which exists in Guix in the @code{(gnu
-packages android)} module.
+Since guix package definitions can be included in @var{rules} in order
+to use all their rules under the @file{lib/udev/rules.d} sub-directory,
+then in lieu of the previous @var{file->udev-rule} example, we could
+have used the @var{android-udev-rules} package which exists in Guix in
+the @code{(gnu packages android)} module.
+
+@deffn {Procedure} file->udev-hardware @var{file-name} @var{file}
+Return a udev hardware description file named @var{file-name} containing
+the rules defined within @var{file}, a file-like object.
+@end deffn
 
 The following example shows how to use the @var{android-udev-rules}
 package so that the Android tool @command{adb} can detect devices
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 10e7383475..db22ac848e 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -82,6 +82,7 @@ (define-module (gnu services base)
                 #:select (mount-flags->bit-mask
                           swap-space->flags-bit-mask))
   #:use-module (guix gexp)
+  #:use-module ((guix packages) #:select (package-version))
   #:use-module (guix records)
   #:use-module (guix modules)
   #:use-module (guix pki)
@@ -152,11 +153,15 @@ (define-module (gnu services base)
             udev-configuration
             udev-configuration?
             udev-configuration-rules
+            udev-configuration-hardware
             udev-service-type
             udev-service  ; deprecated
             udev-rule
+            udev-hardware
             file->udev-rule
+            file->udev-hardware
             udev-rules-service
+            udev-hardware-service
 
             login-configuration
             login-configuration?
@@ -2232,10 +2237,12 @@ (define-record-type* <udev-configuration>
   (udev   udev-configuration-udev                 ;file-like
           (default eudev))
   (rules  udev-configuration-rules                ;list of file-like
-          (default '())))
+          (default '()))
+  (hardware  udev-configuration-hardware          ;list of file-like
+             (default '())))
 
 (define (udev-configurations-union subdirectory packages)
-  "Return the union of the lib/udev/SUBDIRECTORY.d directories found in each
+  "Return the union of the lib/udev/SUBDIRECTORY directories found in each
 item of PACKAGES."
   (define build
     (with-imported-modules '((guix build union)
@@ -2247,8 +2254,8 @@ (define (udev-configurations-union subdirectory packages)
                        (srfi srfi-26))
 
           (define %standard-locations
-            '(#$(string-append "/lib/udev/" subdirectory ".d")
-                #$(string-append "/libexec/udev/" subdirectory ".d")))
+            '(#$(string-append "/lib/udev/" subdirectory)
+                #$(string-append "/libexec/udev/" subdirectory)))
 
           (define (configuration-sub-directory directory)
             ;; Return the sub-directory of DIRECTORY containing udev
@@ -2264,7 +2271,7 @@ (define (udev-configurations-union subdirectory packages)
 (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))
+  (udev-configurations-union "rules.d" packages))
 
 (define (udev-configuration-file subdirectory file-name contents)
   "Return a directory with a udev configuration file FILE-NAME containing CONTENTS."
@@ -2272,7 +2279,11 @@ (define (udev-configuration-file subdirectory file-name contents)
 
 (define (udev-rule file-name contents)
   "Return a directory with a udev rule file FILE-NAME containing CONTENTS."
-  (udev-configuration-file "rules" file-name contents))
+  (udev-configuration-file "rules.d" file-name contents))
+
+(define (udev-hardware file-name contents)
+  "Return a directory with a udev hardware file FILE-NAME containing CONTENTS."
+  (udev-configuration-file "hwdb.d" file-name contents))
 
 (define (file->udev-configuration-file subdirectory file-name file)
   "Return a directory with a udev configuration file FILE-NAME which is a copy
@@ -2285,8 +2296,7 @@ (define (file->udev-configuration-file subdirectory file-name file)
                        (define configuration-directory
                          (string-append #$output
                                         "/lib/udev/"
-                                        #$subdirectory
-                                        ".d"))
+                                        #$subdirectory))
 
                        (define file-copy-dest
                          (string-append configuration-directory "/" #$file-name))
@@ -2296,7 +2306,11 @@ (define (file->udev-configuration-file subdirectory file-name file)
 
 (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))
+  (file->udev-configuration-file "rules.d" file-name file))
+
+(define (file->udev-hardware file-name file)
+  "Return a directory with a udev hardware file FILE-NAME which is a copy of FILE."
+  (file->udev-configuration-file "hwdb.d" file-name file))
 
 (define kvm-udev-rule
   ;; Return a directory with a udev rule that changes the group of /dev/kvm to
@@ -2405,13 +2419,27 @@ (define udev.conf
 
 (define (udev-etc config)
   (match-record config <udev-configuration>
-    (udev rules)
+    (udev rules hardware)
+    (let* ((hardware
+            (udev-configurations-union "hwdb.d" (cons* udev hardware)))
+           (hwdb.bin
+            (computed-file
+             "hwdb.bin"
+             (with-imported-modules '((guix build utils))
+               #~(begin
+                   (use-modules (guix build utils))
+                   (setenv "UDEV_HWDB_PATH" #$hardware)
+                   (invoke #+(file-append udev "/bin/udevadm")
+                           "hwdb"
+                           "--update"
+                           "-o" #$output))))))
     `(("udev"
        ,(file-union "udev"
                     `(("udev.conf" ,udev.conf)
                       ("rules.d"
                        ,(udev-rules-union (cons* udev kvm-udev-rule
-                                                 rules)))))))))
+                                                 rules)))
+                      ("hwdb.bin" ,hwdb.bin))))))))
 
 (define udev-service-type
   (service-type (name 'udev)
@@ -2420,12 +2448,15 @@ (define udev-service-type
                                           udev-shepherd-service)
                        (service-extension etc-service-type udev-etc)))
                 (compose concatenate)           ;concatenate the list of rules
-                (extend (lambda (config rules)
+                (extend (lambda (config extensions)
                           (let ((initial-rules
-                                 (udev-configuration-rules config)))
+                                 (udev-configuration-rules config))
+                                (initial-hardware
+                                 (udev-configuration-hardware config)))
                             (udev-configuration
                              (inherit config)
-                             (rules (append initial-rules rules))))))
+                             (rules (append initial-rules extensions))
+                             (hardware (append initial-hardware extensions))))))
                 (default-value (udev-configuration))
                 (description
                  "Run @command{udev}, which populates the @file{/dev}
@@ -2460,6 +2491,19 @@ (define* (udev-rules-service name rules #:key (groups '()))
                 (description "This service adds udev rules."))))
     (service type #f)))
 
+(define (udev-hardware-service name hardware-files)
+  "Return a service that extends udev-service-type with HARDWARE-FILES, named
+NAME-udev-hardware."
+  (let* ((name (symbol-append name '-udev-hardware))
+         (udev-extension (const (list hardware-files)))
+         (type (service-type
+                (name name)
+                (extensions (list
+                             (service-extension
+                              udev-service-type udev-extension)))
+                (description "This service adds udev hardware files."))))
+    (service type #f)))
+
 (define (swap-space->shepherd-service-name space)
   (let ((target (swap-space-target space)))
     (symbol-append 'swap-
-- 
2.41.0




^ permalink raw reply related	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v4 1/4] gnu: eudev: Update libudev version to 251.
  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
  0 siblings, 1 reply; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-10-02 19:33 UTC (permalink / raw)
  To: Liliana Marie Prikler, 66099; +Cc: rg, maxim.cournoyer

Hi!

Le lundi 02 octobre 2023 à 19:12 +0200, Liliana Marie Prikler a écrit :
> Am Dienstag, dem 19.09.2023 um 13:23 +0200 schrieb Vivien Kraus:
> > +    (native-search-paths
> > +      (list (search-path-specification
> > +              (variable "UDEV_HWDB_PATH")
> > +              (files '("lib/udev/hwdb.d")))
> Question for understanding this correctly: Is UDEV_HWDB_PATH honoured
> for more than just UDEV_HWDB_BIN below or is this a "first file wins"
> kind of deal?

Every entry in UDEV_HWDB_PATH is search for files named "*.hwdb". All
files from any entry in UDEV_HWDB_PATH is used to generate hwdb.bin,
but if two files have the same name in different directories, then only
the first file is considered. This is just for udevadm hwdb --update.

UDEV_HWDB_BIN is the single location for a hwdb.bin for libudev at run-
time. Since hwdb.bin is a complete index, eudev only loads 1 instance
in memory, so there is no need for it to be a search path. This is a
simple environment variable.

I will update the udev-service-type instead of a profile hook.

Best regards,

Vivien




^ permalink raw reply	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v4 1/4] gnu: eudev: Update libudev version to 251.
  2023-10-02 19:33       ` Vivien Kraus via Guix-patches via
@ 2023-10-04  1:00         ` Maxim Cournoyer
  0 siblings, 0 replies; 91+ messages in thread
From: Maxim Cournoyer @ 2023-10-04  1:00 UTC (permalink / raw)
  To: Vivien Kraus; +Cc: 66099, Liliana Marie Prikler, rg

Hi,

Vivien Kraus <vivien@planete-kraus.eu> writes:

> Hi!
>
> Le lundi 02 octobre 2023 à 19:12 +0200, Liliana Marie Prikler a écrit :
>> Am Dienstag, dem 19.09.2023 um 13:23 +0200 schrieb Vivien Kraus:
>> > +    (native-search-paths
>> > +      (list (search-path-specification
>> > +              (variable "UDEV_HWDB_PATH")
>> > +              (files '("lib/udev/hwdb.d")))
>> Question for understanding this correctly: Is UDEV_HWDB_PATH honoured
>> for more than just UDEV_HWDB_BIN below or is this a "first file wins"
>> kind of deal?
>
> Every entry in UDEV_HWDB_PATH is search for files named "*.hwdb". All
> files from any entry in UDEV_HWDB_PATH is used to generate hwdb.bin,
> but if two files have the same name in different directories, then only
> the first file is considered. This is just for udevadm hwdb --update.
>
> UDEV_HWDB_BIN is the single location for a hwdb.bin for libudev at run-
> time. Since hwdb.bin is a complete index, eudev only loads 1 instance
> in memory, so there is no need for it to be a search path. This is a
> simple environment variable.
>
> I will update the udev-service-type instead of a profile hook.

As discussed in #guix, this approach sounds good to me!  Thanks to
Liliana for suggesting it.

-- 
Thanks,
Maxim




^ permalink raw reply	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v5 0/4] Update eudev and udev-service-type
  2023-10-02 17:17     ` Liliana Marie Prikler
@ 2023-10-04 10:00       ` 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
                           ` (3 more replies)
  0 siblings, 4 replies; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-10-04 10:00 UTC (permalink / raw)
  To: Liliana Marie Prikler, maxim.cournoyer, 66099; +Cc: rg

Dear guix,

In this version, I removed the profile hook, and instead generated the
hwdb.bin as part of the udev-service-type.

What do you think?

Best regards,

Vivien

Vivien Kraus (4):
  gnu: eudev: Update libudev version to 251.
  gnu: udev-service-type: accept hwdb file extensions.
  gnu: libgudev: Update to 238.
  gnu: upower: Update to 1.90.2.

 doc/guix.texi                                 |  52 +++++++--
 gnu/local.mk                                  |   1 +
 gnu/packages/gnome.scm                        |  43 +++++---
 gnu/packages/linux.scm                        |  55 +++++++---
 .../patches/eudev-rules-directory.patch       |   9 +-
 .../patches/eudev-set-version-to-3.2.12.patch |  25 +++++
 gnu/services/base.scm                         | 103 ++++++++++++++----
 7 files changed, 217 insertions(+), 71 deletions(-)
 create mode 100644 gnu/packages/patches/eudev-set-version-to-3.2.12.patch


base-commit: b18b2d13488f2a92331ccad2dc8cbb54ee15582f
-- 
2.41.0




^ permalink raw reply	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v5 2/4] gnu: udev-service-type: accept hwdb file extensions.
  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
  0 siblings, 1 reply; 91+ messages in thread
From: Liliana Marie Prikler @ 2023-10-04 16:52 UTC (permalink / raw)
  To: Vivien Kraus, maxim.cournoyer, 66099; +Cc: rg

Am Montag, dem 02.10.2023 um 21:08 +0200 schrieb Vivien Kraus:
> The "rules" field in the udev-configuration record can now hold both
> rules and hwdb files.
> 
> The udev-rules-union has been made generic, so that it works with
> either rules or hwdb files.
Maybe we should rename this to udev-configuration-union and deprecate
the former in favor of the latter (if it can be used outside of the
module)?

> Some udev-related auxiliary functions in (gnu services base) had non-
> texinfo variable references in their docstrings ("FILE-NAME" instead
> of "@var{file-name}").
> 
> udev-rule and file->udev-rule have very similar effects. file->udev-
> rule operates on a file-like, and udev-rule on plain string contents.
> Now udev-rule calls file->udev-rule with a plain-file file-like
> object.
I think the patch would be a little easier to read if you did this
refactoring in a separate one.  The commit log would read something
like:

"services: udev: unify udev-rule and fine->udev-rule.

* gnu/services/base.scm (udev-rule): Implement in terms of 
file->udev-rule.  Use texinfo in docstring."

> The contents of the /etc directory now includes hwdb.d and hwdb.bin,
> which is computed immediately.
> 
> The documentation has been reworked so as to explain why creating
> udev rules or hwdb needs helper functions for configuration or
> extension.
> 
> The hwdb.bin file is conditionally computed by a native version of
> eudev, that may be configured in the udev-service-type configuration.
> The condition is that both target and native eudev have the same
> version. If so, we can reasonably expect that the hwdb.bin file
> created by native eudev can later be read by target eudev.
> 
> * gnu/services/base.scm (udev-things-union): Make udev-rules-union
> generic.
> (udev-rules-union): Use udev-things-union.
> (udev-hwdb-union): New function.
> (udev-rule): Fix docstring and call file->udev-rule.
> (udev-hwdb): New function.
> (file->udev-rule): Fix docstring.
> (file->udev-hwdb): New function.
> (udev-rules-service): Fix docstring.
> (udev-hwdb-service): New function.
> (udev-etc): Add hwdb.d and hwdb.bin.
> (module): Export udev-hwdb, file->udev-hwdb, and udev-hwdb-service.
> (<udev-configuration>): Add the native-udev field.
> * doc/guix.texi (Base Services)[udev-service-type]: Explain
> configuration and
> extension values.
> * doc/guix.texi (Base Services)[udev-hwdb]: Document it.
> [udev-hwdb-service]: Same.
> * doc/guix.texi (Base Services)[udev-configuration]: Document the
> native-udev field.
> ---
>  doc/guix.texi         |  52 +++++++++++++++++----
>  gnu/services/base.scm | 103 +++++++++++++++++++++++++++++++++-------
> --
>  2 files changed, 123 insertions(+), 32 deletions(-)
> 
> diff --git a/doc/guix.texi b/doc/guix.texi
> index 46591b2f64..3310271ec8 100644
> --- a/doc/guix.texi
> +++ b/doc/guix.texi
> @@ -19322,9 +19322,23 @@ Base Services
>  @file{/dev} directory dynamically, whose value is a
>  @code{<udev-configuration>} object.
>  
> -This service type can be @emph{extended} using procedures
> -@code{udev-rules-service} along with @code{file->udev-rule} or
> -@code{udev-rule} which simplify the process of writing udev rules.
> +Since the file names for udev rules and hwdb files matters, the
> +configuration items for rules and hwdb cannot simply be plain file-
> like
> +objects with the rules content, because the name would be
> +ignored. Instead, they are directory file-like objects that contain
> +optional rules in @code{lib/udev/rules.d} and optional hwdb files in
> +@code{lib/udev/hwdb.d}. This way, the service can be configured with
> +whole packages from which to take rules and hwdb files.
> +
> +The @code{udev-service-type} can be @emph{extended} with file-like
> +directories that respect this hierarchy. However, to generate a
> +configuration or an extension, it is advised to use @code{udev-rule}
> and
> +@code{file->udev-rule} for rules, and @code{udev-hwdb} and
> +@code{file->udev-hwdb} for hwdb files.
> +
> +In an operating-system declaration, this service type can be
> +@emph{extended} using procedures @code{udev-rules-service} and
> +@code{udev-hwdb-service}.
>  @end defvar
>  
>  @deftp {Data Type} udev-configuration
> @@ -19334,8 +19348,18 @@ Base Services
>  @item @code{udev} (default: @code{eudev}) (type: file-like)
>  Package object of the udev service.
>  
> +@item @code{native-udev} (default: @code{eudev}) (type: file-like)
> +Native udev package to compile @code{hwdb.bin}. The trie format used
> for
> +@code{hwdb.bin} must be compatible with the @code{udev} and
> +@code{native-udev} fields of the udev configuration. To avoid
> generating
> +@code{hwdb.bin}, pass @code{#f} as the @code{native-udev} field.
> +
> +In any case, if the package version string differs between
> @code{udev}
> +and @code{native-udev}, @code{hwdb.bin} is @strong{not} created.
> +
>  @item @code{rules} (default: @var{'()}) (type: list-of-file-like)
> -List of file-like objects denoting udev-rule files.
> +List of file-like objects denoting udev-rule or udev-hwdb files
> under a
> +sub-directory.
>  
>  @end table
>  @end deftp
> @@ -19358,6 +19382,11 @@ Base Services
>  @end lisp
>  @end deffn
>  
> +@deffn {Procedure} udev-hwdb @var{file-name} @var{contents}
> +Return a udev-hwdb file named @var{file-name} containing the
> hardware
> +information @var{contents}.
> +@end deffn
> +
>  @deffn {Procedure} udev-rules-service @var{name} @var{rules}
> [#:groups '()]
>  Return a service that extends @code{udev-service-type} with
> @var{rules}
>  and @code{account-service-type} with @var{groups} as system groups.
> @@ -19377,6 +19406,11 @@ Base Services
>  @end lisp
>  @end deffn
>  
> +@deffn {Procedure} udev-hwdb-service @var{name} @var{hwdb}
> +Return a service that extends @code{udev-service-type} with
> +@var{hwdb}. The service name is @code{@var{name}-udev-hwdb}.
> +@end deffn
> +
>  @deffn {Procedure} file->udev-rule @var{file-name} @var{file}
>  Return a udev-rule file named @var{file-name} containing the rules
>  defined within @var{file}, a file-like object.
> @@ -19401,12 +19435,10 @@ Base Services
>  @end lisp
>  @end deffn
>  
> -Additionally, Guix package definitions can be included in
> @var{rules} in
> -order to extend the udev rules with the definitions found under
> their
> -@file{lib/udev/rules.d} sub-directory.  In lieu of the previous
> -@var{file->udev-rule} example, we could have used the
> -@var{android-udev-rules} package which exists in Guix in the
> @code{(gnu
> -packages android)} module.
> +@deffn {Procedure} file->udev-hwdb @var{file-name} @var{file}
> +Return a udev-hwdb file named @var{file-name} containing the rules
> +defined within @var{file}, a file-like object.
> +@end deffn
>  
>  The following example shows how to use the @var{android-udev-rules}
>  package so that the Android tool @command{adb} can detect devices
> diff --git a/gnu/services/base.scm b/gnu/services/base.scm
> index b3f2d2e8b8..c813293697 100644
> --- a/gnu/services/base.scm
> +++ b/gnu/services/base.scm
> @@ -81,6 +81,7 @@ (define-module (gnu services base)
>                  #:select (mount-flags->bit-mask
>                            swap-space->flags-bit-mask))
>    #:use-module (guix gexp)
> +  #:use-module ((guix packages) #:select (package-version))
>    #:use-module (guix records)
>    #:use-module (guix modules)
>    #:use-module (guix pki)
> @@ -153,8 +154,11 @@ (define-module (gnu services base)
>              udev-service-type
>              udev-service  ; deprecated
>              udev-rule
> +            udev-hwdb
>              file->udev-rule
> +            file->udev-hwdb
>              udev-rules-service
> +            udev-hwdb-service
>  
>              login-configuration
>              login-configuration?
> @@ -2181,11 +2185,14 @@ (define-record-type* <udev-configuration>
>    udev-configuration?
>    (udev   udev-configuration-udev                 ;file-like
>            (default eudev))
> -  (rules  udev-configuration-rules                ;list of file-like
> +  (native-udev udev-configuration-native-udev
> +               (default eudev))
> +  (rules  udev-configuration-rules                ;list of rule- and
> +                                                  ;hwdb-providing
> packages
>            (default '())))
>  
> -(define (udev-rules-union packages)
> -  "Return the union of the @code{lib/udev/rules.d} directories found
> in each
> +(define (udev-things-union what packages)
> +  "Return the union of the @code{lib/udev/@var{what}.d} directories
> found in each
>  item of @var{packages}."
>    (define build
>      (with-imported-modules '((guix build union)
> @@ -2197,7 +2204,8 @@ (define (udev-rules-union packages)
>                         (srfi srfi-26))
>  
>            (define %standard-locations
> -            '("/lib/udev/rules.d" "/libexec/udev/rules.d"))
> +            '(#$(string-append "/lib/udev/" what ".d")
> +                #$(string-append "/libexec/udev/" what ".d")))
>  
>            (define (rules-sub-directory directory)
>              ;; Return the sub-directory of DIRECTORY containing udev
> rules, or
> @@ -2208,10 +2216,27 @@ (define (udev-rules-union packages)
>            (union-build #$output
>                         (filter-map rules-sub-directory
> '#$packages)))))
>  
> -  (computed-file "udev-rules" build))
> +  (computed-file (string-append "udev-" what) build))
> +
> +(define (udev-rules-union packages)
> +  (udev-things-union "rules" packages))
> +
> +(define (udev-hwdb-union packages)
> +  (udev-things-union "hwdb" packages))
>  
>  (define (udev-rule file-name contents)
> -  "Return a directory with a udev rule file FILE-NAME containing
> CONTENTS."
> +  "Return a directory with a udev rule file @var{file-name}
> containing
> +@var{contents}."
> +  (file->udev-rule file-name (plain-file file-name contents)))
> +
> +(define (udev-hwdb file-name contents)
> +  "Return a directory with a udev hwdb file @var{file-name}
> containing
> +@var{contents}."
> +  (file->udev-hwdb file-name (plain-file file-name contents)))
> +
> +(define (file->udev-rule file-name file)
> +  "Return a directory with a udev rule file @var{file-name} which is
> a copy of
> +@var{file}."
>    (computed-file file-name
>                   (with-imported-modules '((guix build utils))
>                     #~(begin
> @@ -2220,26 +2245,27 @@ (define (udev-rule file-name contents)
>                         (define rules.d
>                           (string-append #$output
> "/lib/udev/rules.d"))
>  
> +                       (define file-copy-dest
> +                         (string-append rules.d "/" #$file-name))
> +
>                         (mkdir-p rules.d)
> -                       (call-with-output-file
> -                           (string-append rules.d "/" #$file-name)
> -                         (lambda (port)
> -                           (display #$contents port)))))))
> +                       (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."
> +(define (file->udev-hwdb file-name file)
> +  "Return a directory with a udev hwdb file @var{file-name} which is
> a copy of
> +@var{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 hwdb.d
> +                         (string-append #$output
> "/lib/udev/hwdb.d"))
>  
>                         (define file-copy-dest
> -                         (string-append rules.d "/" #$file-name))
> +                         (string-append hwdb.d "/" #$file-name))
>  
> -                       (mkdir-p rules.d)
> +                       (mkdir-p hwdb.d)
>                         (copy-file #$file file-copy-dest)))))
>  
>  (define kvm-udev-rule
> @@ -2349,13 +2375,33 @@ (define udev.conf
>  
>  (define (udev-etc config)
>    (match-record config <udev-configuration>
> -    (udev rules)
> +    (udev native-udev rules)
> +    (let* ((hwdb.d
> +            (udev-hwdb-union (cons* udev rules)))
> +           (hwdb.bin
> +            (and native-udev
> +                 (equal? (package-version udev)
> +                         (package-version native-udev))
> +                 (computed-file
> +                  "hwdb.bin"
> +                  (with-imported-modules '((guix build utils))
> +                    #~(begin
> +                        (use-modules (guix build utils))
> +                        (setenv "UDEV_HWDB_PATH" #$hwdb.d)
> +                        (invoke #+(file-append native-udev
> "/bin/udevadm")
> +                                "hwdb"
> +                                "--update"
> +                                "-o" #$output)))))))
>      `(("udev"
>         ,(file-union "udev"
>                      `(("udev.conf" ,udev.conf)
>                        ("rules.d"
>                         ,(udev-rules-union (cons* udev kvm-udev-rule
> -                                                 rules)))))))))
> +                                                 rules)))
> +                      ("hwdb.d" ,hwdb.d)
> +                      ,@(if hwdb.bin
> +                            `(("hwdb.bin" ,hwdb.bin))
> +                            '()))))))))
>  
>  (define udev-service-type
>    (service-type (name 'udev)
> @@ -2384,10 +2430,10 @@ (define-deprecated (udev-service #:key (udev
> eudev) (rules '()))
>             (udev-configuration (udev udev) (rules rules))))
>  
>  (define* (udev-rules-service name rules #:key (groups '()))
> -  "Return a service that extends udev-service-type with RULES and
> -account-service-type with GROUPS as system groups.  This works by
> creating a
> -singleton service type NAME-udev-rules, of which the returned
> service is an
> -instance."
> +  "Return a service that extends udev-service-type with @var{rules}
> and
> +@code{account-service-type} with @var{groups} as system groups. 
> This works by
> +creating a singleton service type @code{@var{name}-udev-rules}, of
> which the
> +returned service is an instance."
>    (let* ((name (symbol-append name '-udev-rules))
>           (account-extension
>            (const (map (lambda (group)
> @@ -2404,6 +2450,19 @@ (define* (udev-rules-service name rules #:key
> (groups '()))
>                  (description "This service adds udev rules."))))
>      (service type #f)))
>  
> +(define (udev-hwdb-service name hwdb-files)
> +  "Return a service that extends udev-service-type with @var{hwdb-
> files}, named
> +@code{@var{name}-udev-hwdb}."
> +  (let* ((name (symbol-append name '-udev-hwdb))
> +         (udev-extension (const (list hwdb-files)))
> +         (type (service-type
> +                (name name)
> +                (extensions (list
> +                             (service-extension
> +                              udev-service-type udev-extension)))
> +                (description "This service adds udev hwdb
> files."))))
> +    (service type #f)))
> +
>  (define (swap-space->shepherd-service-name space)
>    (let ((target (swap-space-target space)))
>      (symbol-append 'swap-
Otherwise LGTM.

Cheers

^ permalink raw reply	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v6 2/5] services: udev: unify udev-rule and file->udev-rule.
  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
                                 ` (3 preceding siblings ...)
  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-04 21:05               ` Vivien Kraus via Guix-patches via
  4 siblings, 0 replies; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-10-04 21:05 UTC (permalink / raw)
  To: Liliana Marie Prikler, maxim.cournoyer, 66099; +Cc: rg

* gnu/services/base.scm (udev-rule): Implement in terms of file->udev-rule.
Use texinfo in docstring.
---
 gnu/services/base.scm | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index b3f2d2e8b8..190803b780 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -2211,20 +2211,9 @@ (define (udev-rules-union packages)
   (computed-file "udev-rules" build))
 
 (define (udev-rule file-name contents)
-  "Return a directory with a udev rule file FILE-NAME containing CONTENTS."
-  (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"))
-
-                       (mkdir-p rules.d)
-                       (call-with-output-file
-                           (string-append rules.d "/" #$file-name)
-                         (lambda (port)
-                           (display #$contents port)))))))
+  "Return a directory with a udev rule file @var{file-name} containing
+@var{contents}."
+  (file->udev-rule file-name (plain-file 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."
-- 
2.41.0




^ permalink raw reply related	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v7 2/5] services: udev: unify udev-rule and file->udev-rule.
  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
                                       ` (3 preceding siblings ...)
  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-04 21:05                     ` 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
  5 siblings, 2 replies; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-10-04 21:05 UTC (permalink / raw)
  To: Liliana Marie Prikler, maxim.cournoyer, 66099; +Cc: rg

* gnu/services/base.scm (udev-rule): Implements in terms of file->udev-rule.
Use texinfo in docstring.
---
 gnu/services/base.scm | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index b3f2d2e8b8..190803b780 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -2211,20 +2211,9 @@ (define (udev-rules-union packages)
   (computed-file "udev-rules" build))
 
 (define (udev-rule file-name contents)
-  "Return a directory with a udev rule file FILE-NAME containing CONTENTS."
-  (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"))
-
-                       (mkdir-p rules.d)
-                       (call-with-output-file
-                           (string-append rules.d "/" #$file-name)
-                         (lambda (port)
-                           (display #$contents port)))))))
+  "Return a directory with a udev rule file @var{file-name} containing
+@var{contents}."
+  (file->udev-rule file-name (plain-file 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."
-- 
2.41.0




^ permalink raw reply related	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v6 0/5] Update eudev, udev-service-type, upower
  2023-10-04 16:52           ` Liliana Marie Prikler
@ 2023-10-04 21:37             ` 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
                                 ` (4 more replies)
  0 siblings, 5 replies; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-10-04 21:37 UTC (permalink / raw)
  To: Liliana Marie Prikler, maxim.cournoyer, 66099; +Cc: rg

Dear guix,

Le mercredi 04 octobre 2023 à 18:52 +0200, Liliana Marie Prikler a écrit :
> Am Montag, dem 02.10.2023 um 21:08 +0200 schrieb Vivien Kraus:
> > The "rules" field in the udev-configuration record can now hold both rules
> > and hwdb files.
> >
> > The udev-rules-union has been made generic, so that it works with either
> > rules or hwdb files.
> Maybe we should rename this to udev-configuration-union and deprecate the
> former in favor of the latter (if it can be used outside of the module)?

Yes, we should, "things" is ugly in a function name. However, the udev-*-union
are not accessed from outside of the module, so we can just drop them.

> > Some udev-related auxiliary functions in (gnu services base) had non-
> > texinfo variable references in their docstrings ("FILE-NAME" instead of
> > "@var{file-name}").
> >
> > udev-rule and file->udev-rule have very similar effects.  file->udev-rule
> > operates on a file-like, and udev-rule on plain string contents.  Now
> > udev-rule calls file->udev-rule with a plain-file file-like object.
> I think the patch would be a little easier to read if you did this
> refactoring in a separate one.  The commit log would read something like:
>
> "services: udev: unify udev-rule and fine->udev-rule.
>
> * gnu/services/base.scm (udev-rule): Implement in terms of 
> file->udev-rule.  Use texinfo in docstring."

You are right, it is way better!

Best regards,

Vivien

Vivien Kraus (5):
  gnu: eudev: Update libudev version to 251.
  services: udev: unify udev-rule and file->udev-rule.
  gnu: udev-service-type: accept hwdb file extensions.
  gnu: libgudev: Update to 238.
  gnu: upower: Update to 1.90.2.

 doc/guix.texi                                 |  52 +++++++--
 gnu/local.mk                                  |   1 +
 gnu/packages/gnome.scm                        |  43 +++++---
 gnu/packages/linux.scm                        |  55 +++++++---
 .../patches/eudev-rules-directory.patch       |   9 +-
 .../patches/eudev-set-version-to-3.2.12.patch |  25 +++++
 gnu/services/base.scm                         | 103 ++++++++++++++----
 7 files changed, 215 insertions(+), 73 deletions(-)
 create mode 100644 gnu/packages/patches/eudev-set-version-to-3.2.12.patch


base-commit: b18b2d13488f2a92331ccad2dc8cbb54ee15582f
-- 
2.41.0




^ permalink raw reply	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v6 1/5] gnu: eudev: Update libudev version to 251.
  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
  0 siblings, 1 reply; 91+ messages in thread
From: Liliana Marie Prikler @ 2023-10-05  4:50 UTC (permalink / raw)
  To: Vivien Kraus, maxim.cournoyer, 66099; +Cc: rg

Am Dienstag, dem 19.09.2023 um 13:23 +0200 schrieb Vivien Kraus:
> Eudev has significant improvements from 3.2.12, but they are not
> released yet. The package version number has already been bumped to
> 3.2.14, but since it is not released yet, the version number is
> downgraded to 3.2.12.
Smaller nitpick: I think "we still advertise it as 3.2.12" is better
wording here.  Downgrade would imho imply a removal of functionality
which is not happening here.

> [...]
> * gnu/packages/linux.scm (eudev): Update to a post-v3.2.12 commit.
> [#:phases] <allow-eudev-hwdb>: New phase.
> <install-in-lib>: New phase.
> <build-hwdb>: Remove phase.
> [#:configure-flags]: Set sysconfdir to avoid a prefix.
> [native-search-paths]: Add UDEV_HWDB_PATH.
> * gnu/packages/patches/eudev-set-version-to-3.2.12.patch: New file.
You might want to express this one with a snippet and an explicit
comment to remove it once a release version is used.
> * gnu/packages/linux.scm (eudev): Use it here.
> * gnu/local.mk (dist_patch_DATA): Register it here.
> * gnu/packages/patches/eudev-rules-directory.patch: Rebase it.
> ---

Cheers




^ permalink raw reply	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v7 0/5] Update eudev with a snippet, udev-service-type, upower
  2023-10-05  4:50                 ` Liliana Marie Prikler
@ 2023-10-05  5:04                   ` 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
                                       ` (5 more replies)
  0 siblings, 6 replies; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-10-05  5:04 UTC (permalink / raw)
  To: Liliana Marie Prikler, maxim.cournoyer, 66099; +Cc: rg

Le jeudi 05 octobre 2023 à 06:50 +0200, Liliana Marie Prikler a écrit :
> Am Dienstag, dem 19.09.2023 um 13:23 +0200 schrieb Vivien Kraus:
> > Eudev has significant improvements from 3.2.12, but they are not
> > released yet. The package version number has already been bumped to
> > 3.2.14, but since it is not released yet, the version number is
> > downgraded to 3.2.12.
> Smaller nitpick: I think "we still advertise it as 3.2.12" is better wording
> here.  Downgrade would imho imply a removal of functionality which is not
> happening here.

OK.

> > * gnu/packages/linux.scm (eudev): Update to a post-v3.2.12 commit.
> > [#:phases] <allow-eudev-hwdb>: New phase.
> > <install-in-lib>: New phase.
> > <build-hwdb>: Remove phase.
> > [#:configure-flags]: Set sysconfdir to avoid a prefix.
> > [native-search-paths]: Add UDEV_HWDB_PATH.
> > * gnu/packages/patches/eudev-set-version-to-3.2.12.patch: New file.
> You might want to express this one with a snippet and an explicit comment to
> remove it once a release version is used.

I thougḥt the patch would be more useful as it would then fail to apply, but I
understand the updater could be unsure whether to remove or rebase the
patch. A snippet + comment is more explicit.

Vivien Kraus (5):
  gnu: eudev: Update libudev version to 251.
  services: udev: unify udev-rule and file->udev-rule.
  gnu: udev-service-type: accept hwdb file extensions.
  gnu: libgudev: Update to 238.
  gnu: upower: Update to 1.90.2.

 doc/guix.texi                                 |  52 +++++++--
 gnu/packages/gnome.scm                        |  43 +++++---
 gnu/packages/linux.scm                        |  64 ++++++++---
 .../patches/eudev-rules-directory.patch       |   9 +-
 gnu/services/base.scm                         | 103 ++++++++++++++----
 5 files changed, 198 insertions(+), 73 deletions(-)


base-commit: b18b2d13488f2a92331ccad2dc8cbb54ee15582f
-- 
2.41.0




^ permalink raw reply	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v6 3/5] gnu: udev-service-type: accept hwdb file extensions.
  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
  0 siblings, 1 reply; 91+ messages in thread
From: Liliana Marie Prikler @ 2023-10-05  5:42 UTC (permalink / raw)
  To: Vivien Kraus, maxim.cournoyer, 66099; +Cc: rg

Am Montag, dem 02.10.2023 um 21:08 +0200 schrieb Vivien Kraus:
> The "rules" field in the udev-configuration record can now hold both
> rules and hwdb files.
Yeah, how about we instead have separate fields – one named "rules" and
one named "hardware".  We're already breaking ABI stability anyway, so
we might as well.

Speaking of which, we might want to rename "hwdb.d" to "hardware" in
udev itself to make that name readable, but keep /etc/udev/hwdb.bin as-
is.

Cheers




^ permalink raw reply	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v7 0/5] Update eudev with a snippet, udev-service-type, upower
  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
                                       ` (4 preceding siblings ...)
  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  5:54                     ` Liliana Marie Prikler
  5 siblings, 0 replies; 91+ messages in thread
From: Liliana Marie Prikler @ 2023-10-05  5:54 UTC (permalink / raw)
  To: Vivien Kraus, maxim.cournoyer, 66099; +Cc: rg

Am Donnerstag, dem 05.10.2023 um 07:04 +0200 schrieb Vivien Kraus:
> Le jeudi 05 octobre 2023 à 06:50 +0200, Liliana Marie Prikler a écrit
> :
> > Am Dienstag, dem 19.09.2023 um 13:23 +0200 schrieb Vivien Kraus:
> > > Eudev has significant improvements from 3.2.12, but they are not
> > > released yet. The package version number has already been bumped
> > > to
> > > 3.2.14, but since it is not released yet, the version number is
> > > downgraded to 3.2.12.
> > Smaller nitpick: I think "we still advertise it as 3.2.12" is
> > better wording here.  Downgrade would imho imply a removal of
> > functionality which is not happening here.
> 
> OK.
> 
> > > * gnu/packages/linux.scm (eudev): Update to a post-v3.2.12
> > > commit.
> > > [#:phases] <allow-eudev-hwdb>: New phase.
> > > <install-in-lib>: New phase.
> > > <build-hwdb>: Remove phase.
> > > [#:configure-flags]: Set sysconfdir to avoid a prefix.
> > > [native-search-paths]: Add UDEV_HWDB_PATH.
> > > * gnu/packages/patches/eudev-set-version-to-3.2.12.patch: New
> > > file.
> > You might want to express this one with a snippet and an explicit
> > comment to remove it once a release version is used.
> 
> I thougḥt the patch would be more useful as it would then fail to
> apply, but I understand the updater could be unsure whether to remove
> or rebase the patch. A snippet + comment is more explicit.
Sorry for taking my time on the 3/5, had breakfast :(

> Everything that eudev searches in "sysconf" (/etc/udev/*) is actually
> searched under its installation prefix. The udev-service-type however
> prepares every file in /etc/udev, without a prefix.
Is this a correct statement?  I would assume not.

Cheers




^ permalink raw reply	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v6 3/5] gnu: udev-service-type: accept hwdb file extensions.
  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
  0 siblings, 1 reply; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-10-05  5:55 UTC (permalink / raw)
  To: Liliana Marie Prikler, maxim.cournoyer, 66099; +Cc: rg

Le jeudi 05 octobre 2023 à 07:42 +0200, Liliana Marie Prikler a écrit :
> Am Montag, dem 02.10.2023 um 21:08 +0200 schrieb Vivien Kraus:
> > The "rules" field in the udev-configuration record can now hold
> > both
> > rules and hwdb files.
> Yeah, how about we instead have separate fields – one named "rules"
> and
> one named "hardware".

Since the extensions are untyped anyway, I thought we would not care in
the configuration record itself. Should we also introduce types for the
extension values?

Vivien




^ permalink raw reply	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v6 3/5] gnu: udev-service-type: accept hwdb file extensions.
  2023-10-05  5:55                   ` Vivien Kraus via Guix-patches via
@ 2023-10-05  6:53                     ` Liliana Marie Prikler
  0 siblings, 0 replies; 91+ messages in thread
From: Liliana Marie Prikler @ 2023-10-05  6:53 UTC (permalink / raw)
  To: Vivien Kraus, maxim.cournoyer, 66099; +Cc: rg

Am Donnerstag, dem 05.10.2023 um 07:55 +0200 schrieb Vivien Kraus:
> Le jeudi 05 octobre 2023 à 07:42 +0200, Liliana Marie Prikler a
> écrit :
> > Am Montag, dem 02.10.2023 um 21:08 +0200 schrieb Vivien Kraus:
> > > The "rules" field in the udev-configuration record can now hold
> > > both rules and hwdb files.
> > Yeah, how about we instead have separate fields – one named "rules"
> > and one named "hardware".
> 
> Since the extensions are untyped anyway, I thought we would not care
> in the configuration record itself. Should we also introduce types
> for the extension values?
This is about field semantics rather than type theory, but if you
prefer, I think we can use list-of file-like? or similar for both.

Cheers




^ permalink raw reply	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v7 1/5] gnu: eudev: Update libudev version to 251.
  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
  0 siblings, 0 replies; 91+ messages in thread
From: Maxim Cournoyer @ 2023-10-05 13:28 UTC (permalink / raw)
  To: Vivien Kraus; +Cc: 66099, Liliana Marie Prikler, rg

Hello,

Vivien Kraus <vivien@planete-kraus.eu> writes:

> Eudev has significant improvements from 3.2.12, but they are not released
> yet. The package version number has already been bumped to 3.2.14, but since
> it is not released yet, we still advertise it as 3.2.12.
>
> Everything that eudev searches in "sysconf" (/etc/udev/*) is actually searched
> under its installation prefix. The udev-service-type however prepares every
> file in /etc/udev, without a prefix.
>
> Eudev has a hardware database that installs descriptions of hardware in /etc,
> but they should go to <prefix>/lib prior to being used. The build system can’t
> install to /etc, and should not, because this directory is owned by the
> udev-service-type. So they are installed directly in <prefix>/lib. Another
> file, an empty /etc/udev.conf, is simply ignored.

This sounds more like a limitation/bug in our udev-service-type than in
eudev?  If eudev wants its files installed to /etc, they should be left
there I think.  Going against this is more maintenance down the road,
and surprise from users.

> The hwdb.bin file used to be generated in <prefix>/etc/udev/hwdb.bin, but
> since the sysconf dir is now directly /etc, the hwdb.bin index will not be
> found under <prefix>/etc/udev/hwdb.bin.
>
> * gnu/packages/linux.scm (eudev): Update to a post-v3.2.12 commit.
> [snippet]: New snippet to override the version number.
> [modules]: Import (guix build utils).
> [#:phases] <allow-eudev-hwdb>: New phase.
> <install-in-lib>: New phase.
> <build-hwdb>: Remove phase.
> [#:configure-flags]: Set sysconfdir to avoid a prefix.

The above should be commented in the code.  What prefix?  sysconfdir
typically defaults to /etc, if I recall correctly.

> [native-search-paths]: Add UDEV_HWDB_PATH.
> * gnu/packages/patches/eudev-rules-directory.patch: Rebase it.
> ---
>  gnu/packages/linux.scm                        | 64 ++++++++++++++-----
>  .../patches/eudev-rules-directory.patch       |  9 +--
>  2 files changed, 52 insertions(+), 21 deletions(-)
>
> diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
> index 85e3d9845d..e75ed0b233 100644
> --- a/gnu/packages/linux.scm
> +++ b/gnu/packages/linux.scm
> @@ -4263,18 +4263,31 @@ (define-public earlyoom
>  
>  (define-public eudev
>    ;; The post-systemd fork, maintained by Gentoo.
> +  (define commit
> +    "c5bae0b656513463f92808f324f8fcbe34a0b401")
> +  (define revision "1")
>    (package
>      (name "eudev")
> -    (version "3.2.11")
> +    ;; Remove the snippet when upgrading to a released version
> +    (version (git-version "3.2.12" revision commit))
>      (source (origin
>                (method git-fetch)
>                (uri (git-reference (url "https://github.com/gentoo/eudev")
> -                                  (commit (string-append "v" version))))
> +                                  (commit commit)))
>                (file-name (git-file-name name version))
>                (sha256
>                 (base32
> -                "0dzaqwjnl55f69ird57wb6skahc6l7zs1slsrzqqfhww33icp6av"))
> -              (patches (search-patches "eudev-rules-directory.patch"))))
> +                "0rqyzmp8kcnxiy1hq13pr2syp4krnf6q97xwlr0bwcd6x4grbak4"))
> +              (patches (search-patches "eudev-rules-directory.patch"))
> +              (modules '((guix build utils)))
> +              (snippet
> +               #~(begin
> +                   ;; configure.ac uses 3.2.14 as the version number, but it
> +                   ;; is not released yet. Remove the snippet once a later
> +                   ;; version is released.
> +                   (substitute* "configure.ac"
> +                     (("AC_INIT\\(\\[eudev\\],\\[3.2.14\\]")
> +                      "AC_INIT([eudev],[3.2.12]"))))))
>      (build-system gnu-build-system)
>      (arguments
>       (list
> @@ -4285,6 +4298,28 @@ (define-public eudev
>                (substitute* "man/make.sh"
>                  (("/usr/bin/xsltproc")
>                   (search-input-file (or native-inputs inputs) "/bin/xsltproc")))))
> +          (add-before 'bootstrap 'install-in-lib
> +            (lambda _
> +              ;; eudev wants to install its provided hwdb files in /etc, but
> +              ;; we want them in udevlibexecdir.
> +              (copy-file "hwdb/Makefile.am" "hwdb/files.am")
> +              (call-with-output-file "hwdb/Makefile.am"
> +                (lambda (port)
> +                  (format port "udevhwdblibdir = $(udevlibexecdir)/hwdb.d\n")
> +                  (format port "include ./files.am")))
> +              (substitute* "hwdb/files.am"
> +                (("dist_udevhwdb_DATA =")
> +                 "dist_udevhwdblib_DATA ="))
> +              ;; eudev wants to install a template udev.conf into /etc, but we
> +              ;; do not care.
> +              (substitute* "src/udev/Makefile.am"
> +                (("dist_udevconf_DATA =")
> +                 "dist_noinst_DATA ="))
> +              ;; eudev thinks we want to make sure /etc/udev/rules.d exists
> +              ;; when installing - we do not.
> +              (substitute* "rules/Makefile.am"
> +                (("\\$\\(MKDIR_P\\) \\$\\(DESTDIR\\)\\$\\(udevconfdir\\)/rules\\.d")
> +                 "true"))))

That's rather complex.  Could we instead modify udev-service-type to
only union what it needs under /etc/udev and not the undesired files from
this package?

>            (add-after 'install 'move-static-library
>              (lambda _
>                (let ((source (string-append #$output "/lib/libudev.a"))
> @@ -4296,19 +4331,14 @@ (define-public eudev
>                  ;; such that Libtool looks for it in the usual places.
>                  (substitute* (string-append #$output "/lib/libudev.la")
>                    (("old_library=.*")
> -                   "old_library=''\n")))))
> -          (add-after 'install 'build-hwdb
> -            (lambda _
> -              ;; Build OUT/etc/udev/hwdb.bin.  This allows 'lsusb' and
> -              ;; similar tools to display product names.
> -              ;;
> -              ;; XXX: This can't be done when cross-compiling. Find another way
> -              ;; to generate hwdb.bin for cross-built systems.
> -              #$@(if (%current-target-system)
> -                     #~(#t)
> -                     #~((invoke (string-append #$output "/bin/udevadm")
> -                                "hwdb" "--update"))))))
> -       #:configure-flags #~(list "--enable-manpages")))
> +                   "old_library=''\n"))))))
> +      #:configure-flags
> +      #~(list "--enable-manpages"
> +              "--sysconfdir=/etc")))

See comment above about justifying this flag.

> +    (native-search-paths
> +      (list (search-path-specification
> +              (variable "UDEV_HWDB_PATH")
> +              (files '("lib/udev/hwdb.d")))))
>      (native-inputs
>       (list autoconf
>             automake
> diff --git a/gnu/packages/patches/eudev-rules-directory.patch b/gnu/packages/patches/eudev-rules-directory.patch
> index 54fc01c6d5..c4b1cfae39 100644
> --- a/gnu/packages/patches/eudev-rules-directory.patch
> +++ b/gnu/packages/patches/eudev-rules-directory.patch
> @@ -4,9 +4,9 @@ The old udev 182 supported $UDEV_CONFIG_FILE, which in turn allowed
>  the search path to be customized, but eudev no longer has this, hence
>  this hack.
>  
> ---- eudev-3.1.5/src/udev/udev-rules.c	2015-10-13 06:22:14.000000000 +0800
> -+++ eudev-3.1.5/src/udev/udev-rules.c	2015-10-16 20:45:38.491934336 +0800
> -@@ -47,15 +47,11 @@
> +--- a/src/udev/udev-rules.c
> ++++ b/src/udev/udev-rules.c
> +@@ -48,16 +48,11 @@ struct uid_gid {
>           };
>   };
>   
> @@ -20,11 +20,12 @@ this hack.
>  -        "/lib/udev/rules.d",
>  -        "/usr/lib/udev/rules.d",
>  -#endif
> +-        "/usr/local/lib/udev/rules.d",
>  +        NULL,			/* placeholder for $EUDEV_RULES_DIRECTORY */
>           NULL};
>   
>   struct udev_rules {
> -@@ -1704,6 +1700,9 @@
> +@@ -1718,6 +1713,9 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) {
>   
>           udev_rules_check_timestamp(rules);

It'd be nicer if eudev's build system allowed to configure the above
without patches hard coding things.

-- 
Thanks,
Maxim




^ permalink raw reply	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v7 2/5] services: udev: unify udev-rule and file->udev-rule.
  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
  1 sibling, 0 replies; 91+ messages in thread
From: Maxim Cournoyer @ 2023-10-05 13:30 UTC (permalink / raw)
  To: Vivien Kraus; +Cc: 66099, Liliana Marie Prikler, rg

Hi,

Vivien Kraus <vivien@planete-kraus.eu> writes:

> * gnu/services/base.scm (udev-rule): Implements in terms of file->udev-rule.
> Use texinfo in docstring.
> ---
>  gnu/services/base.scm | 17 +++--------------
>  1 file changed, 3 insertions(+), 14 deletions(-)
>
> diff --git a/gnu/services/base.scm b/gnu/services/base.scm
> index b3f2d2e8b8..190803b780 100644
> --- a/gnu/services/base.scm
> +++ b/gnu/services/base.scm
> @@ -2211,20 +2211,9 @@ (define (udev-rules-union packages)
>    (computed-file "udev-rules" build))
>  
>  (define (udev-rule file-name contents)
> -  "Return a directory with a udev rule file FILE-NAME containing CONTENTS."
> -  (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"))
> -
> -                       (mkdir-p rules.d)
> -                       (call-with-output-file
> -                           (string-append rules.d "/" #$file-name)
> -                         (lambda (port)
> -                           (display #$contents port)))))))
> +  "Return a directory with a udev rule file @var{file-name} containing
> +@var{contents}."
> +  (file->udev-rule file-name (plain-file file-name contents)))

That one LGTM!

-- 
Thanks,
Maxim




^ permalink raw reply	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v7 2/5] services: udev: unify udev-rule and file->udev-rule.
  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
  1 sibling, 0 replies; 91+ messages in thread
From: Maxim Cournoyer @ 2023-10-05 13:33 UTC (permalink / raw)
  To: Vivien Kraus; +Cc: 66099, Liliana Marie Prikler, rg

Oops, I just noted something:

Vivien Kraus <vivien@planete-kraus.eu> writes:

> * gnu/services/base.scm (udev-rule): Implements in terms of file->udev-rule.
> Use texinfo in docstring.
> ---
>  gnu/services/base.scm | 17 +++--------------
>  1 file changed, 3 insertions(+), 14 deletions(-)
>
> diff --git a/gnu/services/base.scm b/gnu/services/base.scm
> index b3f2d2e8b8..190803b780 100644
> --- a/gnu/services/base.scm
> +++ b/gnu/services/base.scm
> @@ -2211,20 +2211,9 @@ (define (udev-rules-union packages)
>    (computed-file "udev-rules" build))
>  
>  (define (udev-rule file-name contents)
> -  "Return a directory with a udev rule file FILE-NAME containing CONTENTS."
> -  (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"))
> -
> -                       (mkdir-p rules.d)
> -                       (call-with-output-file
> -                           (string-append rules.d "/" #$file-name)
> -                         (lambda (port)
> -                           (display #$contents port)))))))
> +  "Return a directory with a udev rule file @var{file-name} containing
> +@var{contents}."
> +  (file->udev-rule file-name (plain-file file-name contents)))

I'm not sure using Texinfo in plain docstrings provides much; there's no
tooling to render them and it's a convention to use FULL CAPS for
variable names in Guile doc strings, at least in the Guix code base.

I'd leave it as is.

-- 
Thanks,
Maxim




^ permalink raw reply	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v7 3/5] gnu: udev-service-type: accept hwdb file extensions.
  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
  0 siblings, 1 reply; 91+ messages in thread
From: Maxim Cournoyer @ 2023-10-05 14:31 UTC (permalink / raw)
  To: Vivien Kraus; +Cc: 66099, Liliana Marie Prikler, rg

Hi Vivien,

Vivien Kraus <vivien@planete-kraus.eu> writes:

> The "rules" field in the udev-configuration record can now hold both rules and
> hwdb files.
>
> The udev-rules-union has been made generic, and renamed to
> udev-configuration-union, so that it works with either rules or hwdb files.
>
> Some udev-related auxiliary functions in (gnu services base) had non-texinfo
> variable references in their docstrings ("FILE-NAME" instead of
> "@var{file-name}").

That's fairly conventional.  Texinfo is used in the manual
documentation, package synopsis/descriptions and services documentation,
not for every doc string in the code base.

> The contents of the /etc directory now includes hwdb.d and hwdb.bin, which is
> computed immediately.
>
> The documentation has been reworked so as to explain why creating udev rules
> or hwdb needs helper functions for configuration or extension.
>
> The hwdb.bin file is conditionally computed by a native version of eudev, that
> may be configured in the udev-service-type configuration. The condition is
> that both target and native eudev have the same version. If so, we can
> reasonably expect that the hwdb.bin file created by native eudev can later be
> read by target eudev.
>
> * gnu/services/base.scm (udev-configuration-union): Make udev-rules-union generic.
> (udev-hwdb): New function.
> (file->udev-rule): Fix docstring.
> (file->udev-hwdb): New function.
> (udev-rules-service): Fix docstring.
> (udev-hwdb-service): New function.
> (udev-etc): Add hwdb.d and hwdb.bin.
> (module): Export udev-hwdb, file->udev-hwdb, and udev-hwdb-service.
> (<udev-configuration>): Add the native-udev field.
> * doc/guix.texi (Base Services)[udev-service-type]: Explain configuration and
> extension values.
> * doc/guix.texi (Base Services)[udev-hwdb]: Document it.
> [udev-hwdb-service]: Same.
> * doc/guix.texi (Base Services)[udev-configuration]: Document the native-udev
> field.
> ---
>  doc/guix.texi         | 52 +++++++++++++++++++-----
>  gnu/services/base.scm | 94 ++++++++++++++++++++++++++++++++++++-------
>  2 files changed, 122 insertions(+), 24 deletions(-)
>
> diff --git a/doc/guix.texi b/doc/guix.texi
> index 46591b2f64..3310271ec8 100644
> --- a/doc/guix.texi
> +++ b/doc/guix.texi
> @@ -19322,9 +19322,23 @@ Base Services
>  @file{/dev} directory dynamically, whose value is a
>  @code{<udev-configuration>} object.
>  
> -This service type can be @emph{extended} using procedures
> -@code{udev-rules-service} along with @code{file->udev-rule} or
> -@code{udev-rule} which simplify the process of writing udev rules.
> +Since the file names for udev rules and hwdb files matters, the

s/matters/matter/

> +configuration items for rules and hwdb cannot simply be plain file-like
> +objects with the rules content, because the name would be
> +ignored. Instead, they are directory file-like objects that contain

Please use double spaces to separate sentences (Guix convention).

> +optional rules in @code{lib/udev/rules.d} and optional hwdb files in
> +@code{lib/udev/hwdb.d}. This way, the service can be configured with

s/@code/@file/

> +whole packages from which to take rules and hwdb files.
> +
> +The @code{udev-service-type} can be @emph{extended} with file-like
> +directories that respect this hierarchy. However, to generate a
> +configuration or an extension, it is advised to use @code{udev-rule}
> and

"However" sounds a bit strange to me.  I'd rephrase the sentence to "For
convenience, the @code{udev-rule} and @code{file->udev-rule} can be used
to construct udev rules, while @code{udev-hwdb} and
@code{file->udev-hwd} can be used to construct hwdb files."

> +@code{file->udev-rule} for rules, and @code{udev-hwdb} and
> +@code{file->udev-hwdb} for hwdb files.
> +
> +In an operating-system declaration, this service type can be

@code{operating-system}

> +@emph{extended} using procedures @code{udev-rules-service} and
> +@code{udev-hwdb-service}.
>  @end defvar
>  
>  @deftp {Data Type} udev-configuration
> @@ -19334,8 +19348,18 @@ Base Services
>  @item @code{udev} (default: @code{eudev}) (type: file-like)
>  Package object of the udev service.
>  
> +@item @code{native-udev} (default: @code{eudev}) (type: file-like)
> +Native udev package to compile @code{hwdb.bin}. The trie format used for
> +@code{hwdb.bin} must be compatible with the @code{udev} and
> +@code{native-udev} fields of the udev configuration. To avoid generating
> +@code{hwdb.bin}, pass @code{#f} as the @code{native-udev} field.
> +
> +In any case, if the package version string differs between @code{udev}
> +and @code{native-udev}, @code{hwdb.bin} is @strong{not} created.

Shouldn't that raise an error with a useful error message?  Then it
doesn't need to be documented here.  Thinking again, why is it necessary
to have an explicite native-udev field?  The gexps mechanism of the
service could perhaps use #+udev instead of #$udev where needed, sharing
the same 'udev' field for both purposes?

>  @item @code{rules} (default: @var{'()}) (type: list-of-file-like)
> -List of file-like objects denoting udev-rule files.
> +List of file-like objects denoting udev-rule or udev-hwdb files under a
> +sub-directory.
>  
>  @end table
>  @end deftp
> @@ -19358,6 +19382,11 @@ Base Services
>  @end lisp
>  @end deffn
>  
> +@deffn {Procedure} udev-hwdb @var{file-name} @var{contents}
> +Return a udev-hwdb file named @var{file-name} containing the hardware
> +information @var{contents}.
> +@end deffn
> +
>  @deffn {Procedure} udev-rules-service @var{name} @var{rules} [#:groups '()]
>  Return a service that extends @code{udev-service-type} with @var{rules}
>  and @code{account-service-type} with @var{groups} as system groups.
> @@ -19377,6 +19406,11 @@ Base Services
>  @end lisp
>  @end deffn
>  
> +@deffn {Procedure} udev-hwdb-service @var{name} @var{hwdb}
> +Return a service that extends @code{udev-service-type} with
> +@var{hwdb}. The service name is @code{@var{name}-udev-hwdb}.
> +@end deffn
> +
>  @deffn {Procedure} file->udev-rule @var{file-name} @var{file}
>  Return a udev-rule file named @var{file-name} containing the rules
>  defined within @var{file}, a file-like object.
> @@ -19401,12 +19435,10 @@ Base Services
>  @end lisp
>  @end deffn
>  
> -Additionally, Guix package definitions can be included in @var{rules} in
> -order to extend the udev rules with the definitions found under their
> -@file{lib/udev/rules.d} sub-directory.  In lieu of the previous
> -@var{file->udev-rule} example, we could have used the
> -@var{android-udev-rules} package which exists in Guix in the @code{(gnu
> -packages android)} module.

I'd preserve the disclaimer that for this example, it's wiser to simply
use the @code{android-udev-rules} package.

> +@deffn {Procedure} file->udev-hwdb @var{file-name} @var{file}
> +Return a udev-hwdb file named @var{file-name} containing the rules
> +defined within @var{file}, a file-like object.
> +@end deffn
>  
>  The following example shows how to use the @var{android-udev-rules}
>  package so that the Android tool @command{adb} can detect devices
> diff --git a/gnu/services/base.scm b/gnu/services/base.scm
> index 190803b780..00916a35e4 100644
> --- a/gnu/services/base.scm
> +++ b/gnu/services/base.scm
> @@ -81,6 +81,7 @@ (define-module (gnu services base)
>                  #:select (mount-flags->bit-mask
>                            swap-space->flags-bit-mask))
>    #:use-module (guix gexp)
> +  #:use-module ((guix packages) #:select (package-version))
>    #:use-module (guix records)
>    #:use-module (guix modules)
>    #:use-module (guix pki)
> @@ -153,8 +154,11 @@ (define-module (gnu services base)
>              udev-service-type
>              udev-service  ; deprecated
>              udev-rule
> +            udev-hwdb
>              file->udev-rule
> +            file->udev-hwdb
>              udev-rules-service
> +            udev-hwdb-service
>  
>              login-configuration
>              login-configuration?
> @@ -2181,12 +2185,15 @@ (define-record-type* <udev-configuration>
>    udev-configuration?
>    (udev   udev-configuration-udev                 ;file-like
>            (default eudev))
> -  (rules  udev-configuration-rules                ;list of file-like
> +  (native-udev udev-configuration-native-udev
> +               (default eudev))

As discussed earlier, I don't think that new field is needed.

> +  (rules  udev-configuration-rules                ;list of rule- and
> +                                                  ;hwdb-providing packages
>            (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-configuration-union subdirectory packages)
> +  "Return the union of the @code{lib/udev/@var{subdirectory}.d} directories found
> +in each item of @var{packages}."
>    (define build
>      (with-imported-modules '((guix build union)
>                               (guix build utils))
> @@ -2197,7 +2204,8 @@ (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
> @@ -2208,15 +2216,21 @@ (define (udev-rules-union packages)
>            (union-build #$output
>                         (filter-map rules-sub-directory '#$packages)))))
>  
> -  (computed-file "udev-rules" build))
> +  (computed-file (string-append "udev-" subdirectory) build))


>  (define (udev-rule file-name contents)
>    "Return a directory with a udev rule file @var{file-name} containing
>  @var{contents}."
>    (file->udev-rule file-name (plain-file file-name contents)))
>  
> +(define (udev-hwdb file-name contents)
> +  "Return a directory with a udev hwdb file @var{file-name} containing
> +@var{contents}."
> +  (file->udev-hwdb file-name (plain-file 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."
> +  "Return a directory with a udev rule file @var{file-name} which is a copy of
> +@var{file}."

As discussed above, I'm not convinced about changing dostrings to use
Texinfo, but I see that was already the cases for some around.  Hm.

>    (computed-file file-name
>                   (with-imported-modules '((guix build utils))
>                     #~(begin
> @@ -2231,6 +2245,23 @@ (define (file->udev-rule file-name file)
>                         (mkdir-p rules.d)
>                         (copy-file #$file file-copy-dest)))))
>  
> +(define (file->udev-hwdb file-name file)
> +  "Return a directory with a udev hwdb file @var{file-name} which is a copy of
> +@var{file}."
> +  (computed-file file-name
> +                 (with-imported-modules '((guix build utils))
> +                   #~(begin
> +                       (use-modules (guix build utils))
> +
> +                       (define hwdb.d
> +                         (string-append #$output "/lib/udev/hwdb.d"))
> +
> +                       (define file-copy-dest
> +                         (string-append hwdb.d "/" #$file-name))
> +
> +                       (mkdir-p hwdb.d)
> +                       (copy-file #$file file-copy-dest)))))
> +
>  (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,
> @@ -2338,13 +2369,35 @@ (define udev.conf
>  
>  (define (udev-etc config)
>    (match-record config <udev-configuration>
> -    (udev rules)
> +    (udev native-udev rules)
> +    (let* ((hwdb.d
> +            (udev-configuration-union "hwdb" (cons* udev rules)))
> +           (hwdb.bin
> +            (and native-udev
> +                 (equal? (package-version udev)
> +                         (package-version native-udev))
> +                 (computed-file
> +                  "hwdb.bin"
> +                  (with-imported-modules '((guix build utils))
> +                    #~(begin
> +                        (use-modules (guix build utils))
> +                        (setenv "UDEV_HWDB_PATH" #$hwdb.d)
> +                        (invoke #+(file-append native-udev "/bin/udevadm")
> +                                "hwdb"
> +                                "--update"
> +                                "-o" #$output)))))))
>      `(("udev"
>         ,(file-union "udev"
>                      `(("udev.conf" ,udev.conf)
>                        ("rules.d"
> -                       ,(udev-rules-union (cons* udev kvm-udev-rule
> -                                                 rules)))))))))
> +                       ,(udev-configuration-union
> +                         "rules"
> +                         (cons* udev kvm-udev-rule
> +                                rules)))
> +                      ("hwdb.d" ,hwdb.d)
> +                      ,@(if hwdb.bin
> +                            `(("hwdb.bin" ,hwdb.bin))
> +                            '()))))))))

As discussed above, this can probably be simplified by dropping
native-udev.  If it's truly needed, the pathological case where
different versions are needed should be handled earliest and an error
raised with a useful message.

>  (define udev-service-type
>    (service-type (name 'udev)
> @@ -2373,10 +2426,10 @@ (define-deprecated (udev-service #:key (udev eudev) (rules '()))
>             (udev-configuration (udev udev) (rules rules))))
>  
>  (define* (udev-rules-service name rules #:key (groups '()))
> -  "Return a service that extends udev-service-type with RULES and
> -account-service-type with GROUPS as system groups.  This works by creating a
> -singleton service type NAME-udev-rules, of which the returned service is an
> -instance."
> +  "Return a service that extends udev-service-type with @var{rules} and
> +@code{account-service-type} with @var{groups} as system groups.  This works by
> +creating a singleton service type @code{@var{name}-udev-rules}, of which the
> +returned service is an instance."

I'd drop this change.

Could you please send a v8 with changes along those suggested?

-- 
Thanks
Maxim




^ permalink raw reply	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v7 4/5] gnu: libgudev: Update to 238.
  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
  0 siblings, 0 replies; 91+ messages in thread
From: Maxim Cournoyer @ 2023-10-05 14:32 UTC (permalink / raw)
  To: Vivien Kraus; +Cc: 66099, Liliana Marie Prikler, rg

Hi,

Vivien Kraus <vivien@planete-kraus.eu> writes:

> * gnu/packages/gnome.scm (libgudev): Update to 238.
> ---
>  gnu/packages/gnome.scm | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
> index eaceb76e1e..4ea3dc455a 100644
> --- a/gnu/packages/gnome.scm
> +++ b/gnu/packages/gnome.scm
> @@ -6899,14 +6899,14 @@ (define-public eog-plugins
>  (define-public libgudev
>    (package
>      (name "libgudev")
> -    (version "236")
> +    (version "238")
>      (source (origin
>                (method url-fetch)
>                (uri (string-append "mirror://gnome/sources/" name "/"
>                                    version "/" name "-" version ".tar.xz"))
>                (sha256
>                 (base32
> -                "094mgjmwgsgqrr1i0vd20ynvlkihvs3vgbmpbrhswjsrdp86j0z5"))))
> +                "1laxgdkgmr30aw44sm4rgpsdybwxx5rszcm8c2y3vmy9myqnl9k1"))))
>      (build-system meson-build-system)
>      (native-inputs
>       `(("glib:bin" ,glib "bin") ; for glib-genmarshal, etc.

LGTM.

-- 
Thanks,
Maxim




^ permalink raw reply	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v7 5/5] gnu: upower: Update to 1.90.2.
  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
  0 siblings, 0 replies; 91+ messages in thread
From: Maxim Cournoyer @ 2023-10-05 14:35 UTC (permalink / raw)
  To: Vivien Kraus; +Cc: 66099, Liliana Marie Prikler, rg

Hi!

Vivien Kraus <vivien@planete-kraus.eu> writes:

> The new eudev now can install hwdb files. Upower has some, but they should get
> installed in upower’s output, not eudev’s.
>
> The phases needed a rework. Now the 32-bit-specific test fix is always there,
> except it may be empty.
>
> test_bluetooth_hidpp_mouse fails, after calling into a bluez dbus method.
>
> * gnu/packages/gnome.scm (upower): Update to 1.90.2.
> [#:configure-flags]: Set udevhwdbdir.
> [#:phases] <adjust-test-for-excess-precision>: Add this phase
> unconditionnally
> <disable-failing-test>: Disable test_bluetooth_hidpp_mouse.
> [inputs]: Remove dbus-glib.
> [native-inputs]: Add dbus.

LGTM!

-- 
Thanks,
Maxim




^ permalink raw reply	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v8 3/6] services: udev: Make udev-rule helper functions generic.
  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
                                             ` (3 preceding siblings ...)
  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-05 17:24                           ` Vivien Kraus via Guix-patches via
  2023-10-07 14:45                             ` Maxim Cournoyer
  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
  6 siblings, 1 reply; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-10-05 17:24 UTC (permalink / raw)
  To: Liliana Marie Prikler, Maxim Cournoyer, 66099; +Cc: rg

* 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* <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))
@@ -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




^ permalink raw reply related	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v9 3/7] services: udev: Make udev-rule helper functions generic.
  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
                                                   ` (3 preceding siblings ...)
  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                                 ` 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
                                                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-10-05 17:24 UTC (permalink / raw)
  To: Liliana Marie Prikler, Maxim Cournoyer, 66099; +Cc: rg

* 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..f674d48496 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -2184,9 +2184,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))
@@ -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 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




^ permalink raw reply related	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v10 3/6] services: udev: Make udev-rule helper functions generic.
  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
  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
  0 siblings, 1 reply; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-10-05 17:24 UTC (permalink / raw)
  To: Maxim Cournoyer, Liliana Marie Prikler, 66099; +Cc: rg

* 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




^ permalink raw reply related	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v8 2/6] services: udev: Rewrite udev-rule to use file->udev-rule.
  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
                                             ` (4 preceding siblings ...)
  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-05 17:33                           ` 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
  6 siblings, 0 replies; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-10-05 17:33 UTC (permalink / raw)
  To: Liliana Marie Prikler, Maxim Cournoyer, 66099; +Cc: rg

* gnu/services/base.scm (udev-rule): Use file->udev-rule.
---
 gnu/services/base.scm | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index b3f2d2e8b8..30372bf1b5 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -2212,19 +2212,7 @@ (define (udev-rules-union packages)
 
 (define (udev-rule file-name contents)
   "Return a directory with a udev rule file FILE-NAME containing CONTENTS."
-  (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"))
-
-                       (mkdir-p rules.d)
-                       (call-with-output-file
-                           (string-append rules.d "/" #$file-name)
-                         (lambda (port)
-                           (display #$contents port)))))))
+  (file->udev-rule file-name (plain-file 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."
-- 
2.41.0




^ permalink raw reply related	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v9 2/7] services: udev: Rewrite udev-rule to use file->udev-rule.
  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
                                                   ` (4 preceding siblings ...)
  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                                 ` 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:27                                 ` [bug#66099] [PATCH gnome-team v9 0/7] Update eudev, upower, udev-service-type, with /lib/udev/hardware Maxim Cournoyer
  7 siblings, 0 replies; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-10-05 17:33 UTC (permalink / raw)
  To: Liliana Marie Prikler, Maxim Cournoyer, 66099; +Cc: rg

* gnu/services/base.scm (udev-rule): Use file->udev-rule.
---
 gnu/services/base.scm | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index b3f2d2e8b8..30372bf1b5 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -2212,19 +2212,7 @@ (define (udev-rules-union packages)
 
 (define (udev-rule file-name contents)
   "Return a directory with a udev rule file FILE-NAME containing CONTENTS."
-  (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"))
-
-                       (mkdir-p rules.d)
-                       (call-with-output-file
-                           (string-append rules.d "/" #$file-name)
-                         (lambda (port)
-                           (display #$contents port)))))))
+  (file->udev-rule file-name (plain-file 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."
-- 
2.41.0




^ permalink raw reply related	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v10 2/6] services: udev: Rewrite udev-rule to use file->udev-rule.
  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                                         ` Vivien Kraus via Guix-patches via
  2023-10-05 17:24                                           ` [bug#66099] [PATCH gnome-team v10 3/6] services: udev: Make udev-rule helper functions generic Vivien Kraus via Guix-patches via
  0 siblings, 1 reply; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-10-05 17:33 UTC (permalink / raw)
  To: Maxim Cournoyer, Liliana Marie Prikler, 66099; +Cc: rg

* gnu/services/base.scm (udev-rule): Use file->udev-rule.
---
 gnu/services/base.scm | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 98d59fd36d..8b54f30ef6 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -2262,19 +2262,7 @@ (define (udev-rules-union packages)
 
 (define (udev-rule file-name contents)
   "Return a directory with a udev rule file FILE-NAME containing CONTENTS."
-  (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"))
-
-                       (mkdir-p rules.d)
-                       (call-with-output-file
-                           (string-append rules.d "/" #$file-name)
-                         (lambda (port)
-                           (display #$contents port)))))))
+  (file->udev-rule file-name (plain-file 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."
-- 
2.41.0




^ permalink raw reply related	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v8 0/6] Update eudev, udev-service-type, upower
  2023-10-05 14:31                       ` Maxim Cournoyer
@ 2023-10-06 16:45                         ` 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
                                             ` (6 more replies)
  0 siblings, 7 replies; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-10-06 16:45 UTC (permalink / raw)
  To: Liliana Marie Prikler, Maxim Cournoyer, 66099; +Cc: rg

Dear guix,

Thank you for your reviews! Since eudev released 3.2.14 in the mean time, I
udpated it. I also reused more code in the udev-service-type helper functions.

Le jeudi 05 octobre 2023 à 07:42 +0200, Liliana Marie Prikler a écrit :
> Am Montag, dem 02.10.2023 um 21:08 +0200 schrieb Vivien Kraus:
> > The "rules" field in the udev-configuration record can now hold
> > both
> > rules and hwdb files.
> Yeah, how about we instead have separate fields – one named "rules" and one
> named "hardware".  We're already breaking ABI stability anyway, so we might
> as well.

Okay. I fixed the udev-service-type function so that both fields are populated
correctly.

> Speaking of which, we might want to rename "hwdb.d" to "hardware" in udev
> itself to make that name readable, but keep /etc/udev/hwdb.bin as-is.

I renamed to "hardware" in Guix documentation, but individual packages (if
they behave like upower) expect to install their hardware files in "hwdb.d",
so I think we should keep "hwdb.d" as the directory name.

Le jeudi 05 octobre 2023 à 08:53 +0200, Liliana Marie Prikler a écrit :
> Am Donnerstag, dem 05.10.2023 um 07:55 +0200 schrieb Vivien Kraus:
> > Le jeudi 05 octobre 2023 à 07:42 +0200, Liliana Marie Prikler a
> > écrit :
> > > Am Montag, dem 02.10.2023 um 21:08 +0200 schrieb Vivien Kraus:
> > > > The "rules" field in the udev-configuration record can now hold
> > > > both rules and hwdb files.
> > > Yeah, how about we instead have separate fields – one named
> > > "rules"
> > > and one named "hardware".
> > 
> > Since the extensions are untyped anyway, I thought we would not
> > care
> > in the configuration record itself. Should we also introduce types
> > for the extension values?
> This is about field semantics rather than type theory, but if you
> prefer, I think we can use list-of file-like? or similar for both.

I addressed the "field semantics" view of the problem.

Le jeudi 05 octobre 2023 à 09:28 -0400, Maxim Cournoyer a écrit :
> > Eudev has a hardware database that installs descriptions of hardware
> > in /etc,
> > but they should go to <prefix>/lib prior to being used. The build
> > system can’t
> > install to /etc, and should not, because this directory is owned by
> > the
> > udev-service-type. So they are installed directly in <prefix>/lib.
> > Another
> > file, an empty /etc/udev.conf, is simply ignored.
> 
> This sounds more like a limitation/bug in our udev-service-type than in
> eudev?  If eudev wants its files installed to /etc, they should be left
> there I think.  Going against this is more maintenance down the road, and
> surprise from users.

As discussed in IRC, we set sysconfdir to /etc so that it can have hardware
files from many packages. So the hardware files are searched from either
"/etc/udev/hwdb.d" or "$individual_package_prefix/lib/udev/hwdb.d". So, the
only standard directory to install hwdb files during a build of a package is
$package_prefix/lib/udev/hwdb.d.

Le jeudi 05 octobre 2023 à 09:28 -0400, Maxim Cournoyer a écrit :
> > The hwdb.bin file used to be generated in
> > <prefix>/etc/udev/hwdb.bin, but
> > since the sysconf dir is now directly /etc, the hwdb.bin index will
> > not be
> > found under <prefix>/etc/udev/hwdb.bin.
> >
> > * gnu/packages/linux.scm (eudev): Update to a post-v3.2.12 commit.
> > [snippet]: New snippet to override the version number.
> > [modules]: Import (guix build utils).
> > [#:phases] <allow-eudev-hwdb>: New phase.
> > <install-in-lib>: New phase.
> > <build-hwdb>: Remove phase.
> > [#:configure-flags]: Set sysconfdir to avoid a prefix.
> 
> The above should be commented in the code.  What prefix?  sysconfdir
> typically defaults to /etc, if I recall correctly.

I added comments in the code. As mentioned in IRC, sysconfdir defaults to
$prefix/etc. If we use $eudev_prefix/etc/udev/hwdb.d as the directory where
the highest priority hardware files are found, then we won’t be able to add
files to it at all, and it will be disconnected from /etc/udev/hwdb.d
(prepared by the udev-service-type).

Le jeudi 05 octobre 2023 à 09:28 -0400, Maxim Cournoyer a écrit :
> > +          (add-before 'bootstrap 'install-in-lib
> > +            (lambda _
[...]
> 
> That's rather complex.  Could we instead modify udev-service-type to only
> union what it needs under /etc/udev and not the undesired files from this
> package?

Considering the steps in this phase other than changing the installation
directory of hardware files, the build system wants to install things to /etc,
which is unaccessible when building the package. So we either have to change
the installation directory of the empty template configuration, or disable the
installation. Same for the mkdir -p, we either have to make the empty
directory in the installation prefix of the package, or disable it. I think
that the empty configuration file and the empty directory are not worth
keeping.

> > +              "--sysconfdir=/etc")))
> 
> See comment above about justifying this flag.

As discussed, we need it. The added comments should help justify it.

> > @@ -20,11 +20,12 @@ this hack.
> >  -        "/lib/udev/rules.d",
> >  -        "/usr/lib/udev/rules.d",
> >  -#endif
> > +-        "/usr/local/lib/udev/rules.d",
> >  +        NULL,			/* placeholder for $EUDEV_RULES_DIRECTORY */
> >           NULL};
> >   
> >   struct udev_rules {
> > -@@ -1704,6 +1700,9 @@
> > +@@ -1718,6 +1713,9 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) {
> >   
> >           udev_rules_check_timestamp(rules);
>
> It'd be nicer if eudev's build system allowed to configure the above without
> patches hard coding things.

Indeed. For now, I think the patch is fine (I know very little about udev
rules though).

Le jeudi 05 octobre 2023 à 09:33 -0400, Maxim Cournoyer a écrit :
> I'm not sure using Texinfo in plain docstrings provides much; there's no
> tooling to render them and it's a convention to use FULL CAPS for variable
> names in Guile doc strings, at least in the Guix code base.

(discussing the docstrings use of texinfo)

Le jeudi 05 octobre 2023 à 10:31 -0400, Maxim Cournoyer a écrit :
> > Some udev-related auxiliary functions in (gnu services base) had
> > non-texinfo
> > variable references in their docstrings ("FILE-NAME" instead of
> > "@var{file-name}").
>
> That's fairly conventional.  Texinfo is used in the manual documentation,
> package synopsis/descriptions and services documentation, not for every doc
> string in the code base.

Since the ,describe top-level guile command does not try to render texinfo, I
think you are right. I reverted the changes.

I changed the documentation as indicated ("matter", double spaces, "@file",
the udev-rule introduction, "@code{operating-system}", the android-udev-rules
comment).

> As discussed above, I'm not convinced about changing dostrings to use
> Texinfo, but I see that was already the cases for some around.  Hm.

I guess that’s from guile people (in guile, the docstrings are extracted to be
included in the manual).

About the texinfocation of the udev-rules-service docstring:
> I'd drop this change.

Done.

> > +@item @code{native-udev} (default: @code{eudev}) (type: file-like)
> > +Native udev package to compile @code{hwdb.bin}. The trie format used for
> > +@code{hwdb.bin} must be compatible with the @code{udev} and
> > +@code{native-udev} fields of the udev configuration. To avoid generating
> > +@code{hwdb.bin}, pass @code{#f} as the @code{native-udev} field.
> > +
> > +In any case, if the package version string differs between @code{udev}
> > +and @code{native-udev}, @code{hwdb.bin} is @strong{not} created.
> 
> Shouldn't that raise an error with a useful error message?  Then it doesn't
> need to be documented here.  Thinking again, why is it necessary to have an
> explicite native-udev field?  The gexps mechanism of the service could
> perhaps use #+udev instead of #$udev where needed, sharing the same 'udev'
> field for both purposes?

Further down, about the native-udev file in the configuration record definition:
> As discussed earlier, I don't think that new field is needed.

And further down:
> > +                        (invoke #+(file-append native-udev "/bin/udevadm")
> > [...]
>
> As discussed above, this can probably be simplified by dropping native-udev.
> If it's truly needed, the pathological case where different versions are
> needed should be handled earliest and an error raised with a useful message.

I dropped the native-udev field, with a warning that it will be used both in
the current system and the target system.

> Could you please send a v8 with changes along those suggested?
Here!

Best regards,

Vivien

Vivien Kraus (6):
  gnu: eudev: Update to 3.2.14.
  services: udev: Rewrite udev-rule to use file->udev-rule.
  services: udev: Make udev-rule helper functions generic.
  gnu: udev-service-type: accept hardware description file extensions.
  gnu: libgudev: Update to 238.
  gnu: upower: Update to 1.90.2.

 doc/guix.texi                                 |  57 ++++++--
 gnu/packages/gnome.scm                        |  43 +++---
 gnu/packages/linux.scm                        |  57 +++++---
 .../patches/eudev-rules-directory.patch       |   9 +-
 gnu/services/base.scm                         | 124 +++++++++++++-----
 5 files changed, 205 insertions(+), 85 deletions(-)


base-commit: b18b2d13488f2a92331ccad2dc8cbb54ee15582f
-- 
2.41.0




^ permalink raw reply	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v8 0/6] Update eudev, udev-service-type, upower
  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
                                             ` (5 preceding siblings ...)
  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                           ` Liliana Marie Prikler
  6 siblings, 0 replies; 91+ messages in thread
From: Liliana Marie Prikler @ 2023-10-06 18:23 UTC (permalink / raw)
  To: Vivien Kraus, Maxim Cournoyer, 66099; +Cc: rg

Am Freitag, dem 06.10.2023 um 18:45 +0200 schrieb Vivien Kraus:
> Le jeudi 05 octobre 2023 à 07:42 +0200, Liliana Marie Prikler a écrit
> :
> > Speaking of which, we might want to rename "hwdb.d" to "hardware"
> > in udev itself to make that name readable, but keep
> > /etc/udev/hwdb.bin as-is.
> 
> I renamed to "hardware" in Guix documentation, but individual
> packages (if they behave like upower) expect to install their
> hardware files in "hwdb.d", so I think we should keep "hwdb.d" as the
> directory name.
We could patch those or supply configuration arguments, but fair enough
if you don't want to.

> Le jeudi 05 octobre 2023 à 08:53 +0200, Liliana Marie Prikler a
> écrit :
> > This sounds more like a limitation/bug in our udev-service-type
> > than in eudev?  If eudev wants its files installed to /etc, they
> > should be left there I think.  Going against this is more
> > maintenance down the road, and surprise from users.
> 
> As discussed in IRC, we set sysconfdir to /etc so that it can have
> hardware files from many packages. So the hardware files are searched
> from either "/etc/udev/hwdb.d" or
> "$individual_package_prefix/lib/udev/hwdb.d".
> So, the only standard directory to install hwdb files during a build
> of a package is $package_prefix/lib/udev/hwdb.d.
Which makes me think we could also make this $prefix/lib/udev/hardware.
But again, if you like ltrsld, I'm fine with that.

> Vivien Kraus (6):
>   gnu: eudev: Update to 3.2.14.
>   services: udev: Rewrite udev-rule to use file->udev-rule.
>   services: udev: Make udev-rule helper functions generic.
>   gnu: udev-service-type: accept hardware description file
> extensions.
>   gnu: libgudev: Update to 238.
>   gnu: upower: Update to 1.90.2.
> 
>  doc/guix.texi                                 |  57 ++++++--
>  gnu/packages/gnome.scm                        |  43 +++---
>  gnu/packages/linux.scm                        |  57 +++++---
>  .../patches/eudev-rules-directory.patch       |   9 +-
>  gnu/services/base.scm                         | 124 +++++++++++++---
> --
>  5 files changed, 205 insertions(+), 85 deletions(-)
Will look at those shortly.

Cheers




^ permalink raw reply	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v8 1/6] gnu: eudev: Update to 3.2.14.
  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
  0 siblings, 0 replies; 91+ messages in thread
From: Liliana Marie Prikler @ 2023-10-06 18:35 UTC (permalink / raw)
  To: Vivien Kraus, Maxim Cournoyer, 66099; +Cc: rg

Am Dienstag, dem 19.09.2023 um 13:23 +0200 schrieb Vivien Kraus:
> Everything that eudev searches in "sysconf" is actually searched
> under /gnu/store/.../etc/udev, as autoconf defines sysconfdir under
> $prefix by default. The udev-service-type however prepares every file
> in /etc/udev, without a prefix. To use /etc/udev as the sysconfdir,
> we must set it as a configure flag.
This comment remains more confusing than helpful.  I get what you're
trying to express (or at least I hope I do), but I could easily read it
the wrong way.  Basically, what you're trying to express is that we set
sysconfdir to /etc/udev so that eudev uses the hwdb from udev-service-
type rather than the one in its own package.  This is fine – although
there are better ways to do so, see below – but the way it's
communicated here, is… strange.

> Eudev has a hardware database that installs descriptions of hardware
> in /etc, but they can also be installed in <prefix>/lib instead. The
> manual page recommends to install all hardware description files into
> <prefix of eudev>/lib/udev/hwdb.d, but this directory will be read-
> only when installing another hardware-providing package.
This should be "Eudev now has a hardware database /etc made up of
descriptions installed in /lib/udev/hwdb.d, and more generally,
UDEV_HWDB_PATH."  We should probably also patch our own manuals to not
make that recommendation.  Perhaps close off with mentioning hwdb --
update.

> The build system tries, but fails, to install hardware files into
> /etc. A fix makes it install the hardware files into <prefix>/lib
> instead. Another file, an empty /etc/udev.conf, is expected to be
> installed in /etc/udev, but it is not needed in guix.
Gratuitous information that's more confusing than helpful.

> The hwdb.bin file used to be generated in <prefix>/etc/udev/hwdb.bin,
> but since the sysconf dir is now directly /etc, the hwdb.bin index
> will not be found under <prefix>/etc/udev/hwdb.bin.
While we choose to do this via sysconfdir, the proper fix would be to
read the path to the hwdb file from /etc/udev/udev.conf and fall back
to $prefix/etc/udev/hwdb.bin if it's undefined.  That saves us some
hacks.

> * gnu/packages/linux.scm (eudev): Update to 3.2.14.
> [modules]: Import (guix build utils).
> [#:phases] <allow-eudev-hwdb>: New phase.
> <install-in-lib>: New phase.
> <build-hwdb>: Remove phase.
> [#:configure-flags]: Set sysconfdir to avoid a prefix.
> [native-search-paths]: Add UDEV_HWDB_PATH.
> * gnu/packages/patches/eudev-rules-directory.patch: Rebase it.
> ---
Cheers




^ permalink raw reply	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v8 4/6] gnu: udev-service-type: accept hardware description file extensions.
  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
  0 siblings, 0 replies; 91+ messages in thread
From: Liliana Marie Prikler @ 2023-10-06 18:42 UTC (permalink / raw)
  To: Vivien Kraus, Maxim Cournoyer, 66099; +Cc: rg

Am Montag, dem 02.10.2023 um 21:08 +0200 schrieb Vivien Kraus:
> The udev-configuration record now has a hardware field.
> 
> The contents of the /etc directory now includes hwdb.d and hwdb.bin,
> which is computed immediately.
Immediately?

> The documentation has been reworked so as to explain why creating
> udev rules or hwdb needs helper functions for configuration or
> extension.
> 
> The hwdb.bin file is conditionally computed by a native version of
> eudev, that may be configured in the udev-service-type configuration.
This no longer holds, as far as I can see?
> The condition is that both target and native eudev have the same
> version. If so, we can reasonably expect that the hwdb.bin file
> created by native eudev can later be read by target eudev.
Continuation of above.

> * gnu/services/base.scm (udev-hardware): New function.
> (file->udev-hardware): New function.
> (udev-hardware-service): New function.
> (udev-etc): Add hwdb.d and hwdb.bin.
> (module): Export udev-hardware, file->udev-hardware, and udev-
> hardware-service.
> (<udev-configuration>): Add the native-udev field.
> (udev-service-type) [extend]: Populate the hardware field.
> * doc/guix.texi (Base Services)[udev-service-type]: Explain
> configuration and
> extension values.
> * doc/guix.texi (Base Services)[udev-hardware]: Document it.
> [udev-hardware-service]: Same.
> * doc/guix.texi (Base Services)[udev-configuration]: Document the
> native-udev
> field.
> ---
>  doc/guix.texi         | 57 +++++++++++++++++++++++++++++++--------
>  gnu/services/base.scm | 62 ++++++++++++++++++++++++++++++++++++++---
> --
>  2 files changed, 101 insertions(+), 18 deletions(-)
> 
> diff --git a/doc/guix.texi b/doc/guix.texi
> index 46591b2f64..ec0bd688f0 100644
> --- a/doc/guix.texi
> +++ b/doc/guix.texi
> @@ -19322,9 +19322,23 @@ Base Services
>  @file{/dev} directory dynamically, whose value is a
>  @code{<udev-configuration>} object.
>  
> -This service type can be @emph{extended} using procedures
> -@code{udev-rules-service} along with @code{file->udev-rule} or
> -@code{udev-rule} which simplify the process of writing udev rules.
> +Since the file names for udev rules and hardware description files
> +matter, the configuration items for rules and hardware cannot simply
> be
> +plain file-like objects with the rules content, because the name
> would
> +be ignored.  Instead, they are directory file-like objects that
> contain
> +optional rules in @file{lib/udev/rules.d} and optional hardware
> files in
> +@file{lib/udev/hwdb.d}.  This way, the service can be configured
> with
> +whole packages from which to take rules and hwdb files.
> +
> +The @code{udev-service-type} can be @emph{extended} with file-like
> +directories that respect this hierarchy.  For convenience, the
> +@code{udev-rule} and @code{file->udev-rule} can be used to construct
> +udev rules, while @code{udev-hardware} and @code{file->udev-
> hardware}
> +can be used to construct hardware description files.
> +
> +In an @code{operating-system} declaration, this service type can be
> +@emph{extended} using procedures @code{udev-rules-service} and
> +@code{udev-hardware-service}.
>  @end defvar
>  
>  @deftp {Data Type} udev-configuration
> @@ -19332,10 +19346,17 @@ Base Services
>  
>  @table @asis
>  @item @code{udev} (default: @code{eudev}) (type: file-like)
> -Package object of the udev service.
> +Package object of the udev service.  This package is used at run-
> time,
> +when compiled for the target system.  In order to generate the
> +@file{hwdb.bin} hardware index, it is also used when generating the
> +system definition, compiled for the current system.
>  
>  @item @code{rules} (default: @var{'()}) (type: list-of-file-like)
> -List of file-like objects denoting udev-rule files.
> +List of file-like objects denoting udev rule files under a sub-
> directory.
> +
> +@item @code{hardware} (default: @var{'()}) (type: list-of-file-like)
> +List of file-like objects denoting udev hardware description files
> under
> +a sub-directory.
>  
>  @end table
>  @end deftp
> @@ -19358,6 +19379,11 @@ Base Services
>  @end lisp
>  @end deffn
>  
> +@deffn {Procedure} udev-hardware @var{file-name} @var{contents}
> +Return a udev hardware description file named @var{file-name}
> containing
> +the hardware information @var{contents}.
> +@end deffn
> +
>  @deffn {Procedure} udev-rules-service @var{name} @var{rules}
> [#:groups '()]
>  Return a service that extends @code{udev-service-type} with
> @var{rules}
>  and @code{account-service-type} with @var{groups} as system groups.
> @@ -19377,6 +19403,11 @@ Base Services
>  @end lisp
>  @end deffn
>  
> +@deffn {Procedure} udev-hardware-service @var{name} @var{hardware}
> +Return a service that extends @code{udev-service-type} with
> +@var{hardware}.  The service name is @code{@var{name}-udev-
> hardware}.
> +@end deffn
> +
>  @deffn {Procedure} file->udev-rule @var{file-name} @var{file}
>  Return a udev-rule file named @var{file-name} containing the rules
>  defined within @var{file}, a file-like object.
> @@ -19401,12 +19432,16 @@ Base Services
>  @end lisp
>  @end deffn
>  
> -Additionally, Guix package definitions can be included in
> @var{rules} in
> -order to extend the udev rules with the definitions found under
> their
> -@file{lib/udev/rules.d} sub-directory.  In lieu of the previous
> -@var{file->udev-rule} example, we could have used the
> -@var{android-udev-rules} package which exists in Guix in the
> @code{(gnu
> -packages android)} module.
> +Since guix package definitions can be included in @var{rules} in
> order
> +to use all their rules under the @file{lib/udev/rules.d} sub-
> directory,
> +then in lieu of the previous @var{file->udev-rule} example, we could
> +have used the @var{android-udev-rules} package which exists in Guix
> in
> +the @code{(gnu packages android)} module.
> +
> +@deffn {Procedure} file->udev-hardware @var{file-name} @var{file}
> +Return a udev hardware description file named @var{file-name}
> containing
> +the rules defined within @var{file}, a file-like object.
> +@end deffn
>  
>  The following example shows how to use the @var{android-udev-rules}
>  package so that the Android tool @command{adb} can detect devices
> diff --git a/gnu/services/base.scm b/gnu/services/base.scm
> index 0bf0568a4e..0ca7f2af4a 100644
> --- a/gnu/services/base.scm
> +++ b/gnu/services/base.scm
> @@ -81,6 +81,7 @@ (define-module (gnu services base)
>                  #:select (mount-flags->bit-mask
>                            swap-space->flags-bit-mask))
>    #:use-module (guix gexp)
> +  #:use-module ((guix packages) #:select (package-version))
>    #:use-module (guix records)
>    #:use-module (guix modules)
>    #:use-module (guix pki)
> @@ -150,11 +151,15 @@ (define-module (gnu services base)
>              udev-configuration
>              udev-configuration?
>              udev-configuration-rules
> +            udev-configuration-hardware
>              udev-service-type
>              udev-service  ; deprecated
>              udev-rule
> +            udev-hardware
>              file->udev-rule
> +            file->udev-hardware
>              udev-rules-service
> +            udev-hardware-service
>  
>              login-configuration
>              login-configuration?
> @@ -2181,8 +2186,10 @@ (define-record-type* <udev-configuration>
>    udev-configuration?
>    (udev   udev-configuration-udev                 ;file-like
>            (default eudev))
> -  (rules  udev-configuration-rules                ;list of file-like
> -          (default '())))
> +  (rules  udev-configuration-rules                ;package-like
> file-like
> +          (default '()))
> +  (hardware  udev-configuration-hardware          ;package-like
> file-like
> +             (default '())))
list of file-like for both

>  
>  (define (udev-configurations-union subdirectory packages)
>    "Return the union of the lib/udev/SUBDIRECTORY.d directories found
> in each
> @@ -2224,6 +2231,10 @@ (define (udev-rule file-name contents)
>    "Return a directory with a udev rule file FILE-NAME containing
> CONTENTS."
>    (udev-configuration-file "rules" file-name contents))
>  
> +(define (udev-hardware file-name contents)
> +  "Return a directory with a udev hardware file FILE-NAME containing
> CONTENTS."
> +  (udev-configuration-file "hwdb" file-name contents))
> +
>  (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."
> @@ -2248,6 +2259,10 @@ (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 (file->udev-hardware file-name file)
> +  "Return a directory with a udev hardware file FILE-NAME which is a
> copy of FILE."
> +  (file->udev-configuration-file "hwdb" 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,
> @@ -2355,13 +2370,30 @@ (define udev.conf
>  
>  (define (udev-etc config)
>    (match-record config <udev-configuration>
> -    (udev rules)
> +    (udev rules hardware)
> +    (let* ((hwdb.d
> +            (udev-configurations-union "hwdb" (cons* udev
> hardware)))
> +           (hwdb.bin
> +            (computed-file
> +             "hwdb.bin"
> +             (with-imported-modules '((guix build utils))
> +               #~(begin
> +                   (use-modules (guix build utils))
> +                   (setenv "UDEV_HWDB_PATH" #$hwdb.d)
> +                   (invoke #+(file-append udev "/bin/udevadm")
> +                           "hwdb"
> +                           "--update"
> +                           "-o" #$output))))))
>      `(("udev"
>         ,(file-union "udev"
>                      `(("udev.conf" ,udev.conf)
>                        ("rules.d"
>                         ,(udev-rules-union (cons* udev kvm-udev-rule
> -                                                 rules)))))))))
> +                                                 rules)))
> +                      ("hwdb.d" ,hwdb.d)
> +                      ,@(if hwdb.bin
> +                            `(("hwdb.bin" ,hwdb.bin))
> +                            '()))))))))
Do we need to keep hwdb.d with hwdb.bin or is that duplicated info?
>  
>  (define udev-service-type
>    (service-type (name 'udev)
> @@ -2370,12 +2402,15 @@ (define udev-service-type
>                                            udev-shepherd-service)
>                         (service-extension etc-service-type udev-
> etc)))
>                  (compose concatenate)           ;concatenate the
> list of rules
> -                (extend (lambda (config rules)
> +                (extend (lambda (config extensions)
>                            (let ((initial-rules
> -                                 (udev-configuration-rules config)))
> +                                 (udev-configuration-rules config))
> +                                (initial-hardware
> +                                 (udev-configuration-hardware
> config)))
>                              (udev-configuration
>                               (inherit config)
> -                             (rules (append initial-rules
> rules))))))
> +                             (rules (append initial-rules
> extensions))
> +                             (hardware (append initial-hardware
> extensions))))))
>                  (default-value (udev-configuration))
>                  (description
>                   "Run @command{udev}, which populates the
> @file{/dev}
> @@ -2410,6 +2445,19 @@ (define* (udev-rules-service name rules #:key
> (groups '()))
>                  (description "This service adds udev rules."))))
>      (service type #f)))
>  
> +(define (udev-hardware-service name hardware-files)
> +  "Return a service that extends udev-service-type with HARDWARE-
> FILES, named
> +NAME-udev-hardware."
> +  (let* ((name (symbol-append name '-udev-hardware))
> +         (udev-extension (const (list hardware-files)))
> +         (type (service-type
> +                (name name)
> +                (extensions (list
> +                             (service-extension
> +                              udev-service-type udev-extension)))
> +                (description "This service adds udev hardware
> files."))))
> +    (service type #f)))
> +
>  (define (swap-space->shepherd-service-name space)
>    (let ((target (swap-space-target space)))
>      (symbol-append 'swap-


^ permalink raw reply	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v8 6/6] gnu: upower: Update to 1.90.2.
  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
  0 siblings, 0 replies; 91+ messages in thread
From: Liliana Marie Prikler @ 2023-10-06 18:48 UTC (permalink / raw)
  To: Vivien Kraus, Maxim Cournoyer, 66099; +Cc: rg

Am Dienstag, dem 19.09.2023 um 13:32 +0200 schrieb Vivien Kraus:
> The new eudev now can install hwdb files. Upower has some, but they
> should get installed in upower’s output, not eudev’s.
Gratuitous information.
> The phases needed a rework. Now the 32-bit-specific test fix is
> always there, except it may be empty.
Also gratuitous info, but only because it doesn't explain why.  
だからどうして?

> test_bluetooth_hidpp_mouse fails, after calling into a bluez dbus
> method.
> 
> * gnu/packages/gnome.scm (upower): Update to 1.90.2.
> [#:configure-flags]: Set udevhwdbdir.
> [#:phases] <adjust-test-for-excess-precision>: Add this phase
> unconditionnally
> <disable-failing-test>: Disable test_bluetooth_hidpp_mouse.
> [inputs]: Remove dbus-glib.
> [native-inputs]: Add dbus.
> ---
Otherwise LGTM.




^ permalink raw reply	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v8 3/6] services: udev: Make udev-rule helper functions generic.
  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
  0 siblings, 1 reply; 91+ messages in thread
From: Maxim Cournoyer @ 2023-10-07 14:45 UTC (permalink / raw)
  To: Vivien Kraus; +Cc: 66099, Liliana Marie Prikler, rg

Hi,

Vivien Kraus <vivien@planete-kraus.eu> writes:

[...]

> -                       (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)

Since conf.d doesn't map to a directory of the same name, I'd use
something more abstract like config-directory or similar.

-- 
Thanks,
Maxim




^ permalink raw reply	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v9 7/7] services: udev: Install hardware files in /lib/udev/hardware.
  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
                                                   ` (5 preceding siblings ...)
  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                                 ` Vivien Kraus via Guix-patches via
  2023-10-08 12:28                                   ` Maxim Cournoyer
  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
  7 siblings, 1 reply; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-10-08 10:00 UTC (permalink / raw)
  To: Liliana Marie Prikler, Maxim Cournoyer, 66099; +Cc: rg

* gnu/packages/libusb.scm (libmtp) [#:phases] <move-hardware-files>: New phase.
* gnu/packages/xdisorg.scm (libwacom) [#:phases]
<set-hardware-installation-directory>: New phase.
* gnu/packages/freedesktop.scm (libfprint) [#:configure-flags]: Change the
hardware directory.
* gnu/packages/linux.scm (eudev): [#:phases] <install-in-lib>: Change the
installation directory.
[native-search-paths]: change the search directory.
* gnu/services/base.scm (file->udev-hardware): Change the directory name.
(file->udev-hardware): Same.
(udev-etc): Same.
---
 gnu/packages/freedesktop.scm |  2 +-
 gnu/packages/gnome.scm       |  2 +-
 gnu/packages/libusb.scm      |  8 +++++++-
 gnu/packages/linux.scm       | 16 ++++++++--------
 gnu/packages/xdisorg.scm     |  9 ++++++++-
 gnu/services/base.scm        |  6 +++---
 6 files changed, 28 insertions(+), 15 deletions(-)

diff --git a/gnu/packages/freedesktop.scm b/gnu/packages/freedesktop.scm
index 85ba5ba147..cae9fadae8 100644
--- a/gnu/packages/freedesktop.scm
+++ b/gnu/packages/freedesktop.scm
@@ -2209,7 +2209,7 @@ (define-public libfprint
     (arguments
      (list #:configure-flags
            #~(list (string-append "-Dudev_hwdb_dir=" #$output
-                                  "/lib/udev/hwdb.d")
+                                  "/lib/udev/hardware")
                    (string-append "-Dc_link_args=-Wl,-rpath="
                                   (search-input-directory %build-inputs
                                                           "lib/nss"))
diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index 3f773aae8a..164e822f6c 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -5760,7 +5760,7 @@ (define-public upower
               ;; in /gnu/store.
               "-Dhistorydir=/var/lib/upower"
               (string-append "-Dudevrulesdir=" #$output "/bin/udev/rules.d")
-              (string-append "-Dudevhwdbdir=" #$output "/lib/udev/hwdb.d"))
+              (string-append "-Dudevhwdbdir=" #$output "/lib/udev/hardware"))
       #:phases
       #~(modify-phases %standard-phases
           (add-after 'unpack 'adjust-test-suite
diff --git a/gnu/packages/libusb.scm b/gnu/packages/libusb.scm
index e615b81ea3..23342dedcb 100644
--- a/gnu/packages/libusb.scm
+++ b/gnu/packages/libusb.scm
@@ -584,7 +584,13 @@ (define-public libmtp
     (arguments
      (list #:configure-flags
            #~(list "--disable-static"
-                   (string-append "--with-udev=" #$output "/lib/udev"))))
+                   (string-append "--with-udev=" #$output "/lib/udev"))
+           #:phases
+           #~(modify-phases %standard-phases
+               (add-after 'install 'move-hardware-files
+                 (lambda _
+                   (rename-file (string-append #$output "/lib/udev/hwdb.d")
+                                (string-append #$output "/lib/udev/hardware")))))))
     (home-page "https://libmtp.sourceforge.net/")
     (synopsis "Library implementing the Media Transfer Protocol")
     (description "Libmtp implements an MTP (Media Transfer Protocol)
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index f552ccccae..be6500539c 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -4288,16 +4288,16 @@ (define-public eudev
           (add-before 'bootstrap 'install-in-lib
             (lambda _
               ;; When the udev-service-type instantiates /etc, it collects
-              ;; hardware files from the <package>/lib/udev/hwdb.d directories
-              ;; of different packages.  Since we set sysconfdir to /etc, the
-              ;; only package-dependent location we can install hwdb files is
-              ;; in <package>/lib/udev/hwdb.d.  Eudev is configured to install
-              ;; these files in sysconfdir, but they should be placed into
-              ;; udevlibexecdir.
+              ;; hardware files from the <package>/lib/udev/hardware
+              ;; directories of different packages.  Since we set sysconfdir
+              ;; to /etc, the only package-dependent location we can install
+              ;; hwdb files is in <package>/lib/udev/hardware.  Eudev is
+              ;; configured to install these files in sysconfdir, but they
+              ;; should be placed into udevlibexecdir.
               (copy-file "hwdb/Makefile.am" "hwdb/files.am")
               (call-with-output-file "hwdb/Makefile.am"
                 (lambda (port)
-                  (format port "hardwarelibdir = $(udevlibexecdir)/hwdb.d\n")
+                  (format port "hardwarelibdir = $(udevlibexecdir)/hardware\n")
                   (format port "include ./files.am")))
               (substitute* "hwdb/files.am"
                 (("dist_udevhwdb_DATA =")
@@ -4331,7 +4331,7 @@ (define-public eudev
     (native-search-paths
       (list (search-path-specification
               (variable "UDEV_HWDB_PATH")
-              (files '("lib/udev/hwdb.d")))))
+              (files '("lib/udev/hardware")))))
     (native-inputs
      (list autoconf
            automake
diff --git a/gnu/packages/xdisorg.scm b/gnu/packages/xdisorg.scm
index f86608497d..573342e23b 100644
--- a/gnu/packages/xdisorg.scm
+++ b/gnu/packages/xdisorg.scm
@@ -1432,7 +1432,14 @@ (define-public libwacom
     (build-system meson-build-system)
     (arguments
      (list
-      #:configure-flags #~(list "--default-library=shared")))
+      #:configure-flags #~(list "--default-library=shared")
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'set-hardware-installation-directory
+            (lambda _
+              (substitute* "meson.build"
+                (("dir_udev / 'hwdb.d'")
+                 "dir_udev / 'hardware'")))))))
     (native-inputs
      (list pkg-config
            ;; For tests.
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 32a89fb190..07b8b3b1a0 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -2233,7 +2233,7 @@ (define (udev-rule file-name contents)
 
 (define (udev-hardware file-name contents)
   "Return a directory with a udev hardware file FILE-NAME containing CONTENTS."
-  (udev-configuration-file "hwdb.d" file-name contents))
+  (udev-configuration-file "hardware" file-name contents))
 
 (define (file->udev-configuration-file subdirectory file-name file)
   "Return a directory with a udev configuration file FILE-NAME which is a copy
@@ -2260,7 +2260,7 @@ (define (file->udev-rule file-name file)
 
 (define (file->udev-hardware file-name file)
   "Return a directory with a udev hardware file FILE-NAME which is a copy of FILE."
-  (file->udev-configuration-file "hwdb.d" file-name file))
+  (file->udev-configuration-file "hardware" file-name file))
 
 (define kvm-udev-rule
   ;; Return a directory with a udev rule that changes the group of /dev/kvm to
@@ -2371,7 +2371,7 @@ (define (udev-etc config)
   (match-record config <udev-configuration>
     (udev rules hardware)
     (let* ((hardware
-            (udev-configurations-union "hwdb.d" (cons* udev hardware)))
+            (udev-configurations-union "hardware" (cons* udev hardware)))
            (hwdb.bin
             (computed-file
              "hwdb.bin"
-- 
2.41.0




^ permalink raw reply related	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v9 0/7] Update eudev, upower, udev-service-type, with /lib/udev/hardware
  2023-10-07 14:45                             ` Maxim Cournoyer
@ 2023-10-08 10:49                               ` 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
                                                   ` (7 more replies)
  0 siblings, 8 replies; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-10-08 10:49 UTC (permalink / raw)
  To: Liliana Marie Prikler, Maxim Cournoyer, 66099; +Cc: rg

Dear guix,

I find it surprising that we should rename /lib/udev/hwdb.d to
/lib/udev/hardware, but the impact is minimal (udevadm on Guix for the
udev-service-type relies only on UDEV_HWDB_PATH, which can accept /hardware
easily), and you insist, so, let’s do that.

I changed the installation directories for the packages I found with a grep
'hwdb.d', but I may have let some slip through.

I removed the publication of /etc/udev/hwdb.d in the udev service, because
these files would have the highest priority, so a user could not override
them.  Since eudev is in the system profile, UDEV_HWDB_PATH is set with the
system profile hardware files anyway (not exactly all that compose
/etc/udev/hwdb.bin).

The VM works.

> > The hwdb.bin file used to be generated in <prefix>/etc/udev/hwdb.bin,
> > but since the sysconf dir is now directly /etc, the hwdb.bin index
> > will not be found under <prefix>/etc/udev/hwdb.bin.
> While we choose to do this via sysconfdir, the proper fix would be to read
> the path to the hwdb file from /etc/udev/udev.conf and fall back to
> $prefix/etc/udev/hwdb.bin if it's undefined.  That saves us some hacks.

Unfortunately, eudev does not support this I think.



Vivien Kraus (7):
  gnu: eudev: Update to 3.2.14.
  services: udev: Rewrite udev-rule to use file->udev-rule.
  services: udev: Make udev-rule helper functions generic.
  gnu: udev-service-type: accept hardware description file extensions.
  gnu: libgudev: Update to 238.
  gnu: upower: Update to 1.90.2.
  services: udev: Install hardware files in /lib/udev/hardware.

 doc/guix.texi                                 |  57 +++++++--
 gnu/packages/freedesktop.scm                  |   2 +-
 gnu/packages/gnome.scm                        |  43 ++++---
 gnu/packages/libusb.scm                       |   8 +-
 gnu/packages/linux.scm                        |  57 ++++++---
 .../patches/eudev-rules-directory.patch       |   9 +-
 gnu/packages/xdisorg.scm                      |   9 +-
 gnu/services/base.scm                         | 116 +++++++++++++-----
 8 files changed, 215 insertions(+), 86 deletions(-)


base-commit: b18b2d13488f2a92331ccad2dc8cbb54ee15582f
-- 
2.41.0




^ permalink raw reply	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v9 0/7] Update eudev, upower, udev-service-type, with /lib/udev/hardware
  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
                                                   ` (6 preceding siblings ...)
  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:27                                 ` Maxim Cournoyer
  2023-10-08 12:33                                   ` Vivien Kraus via Guix-patches via
  7 siblings, 1 reply; 91+ messages in thread
From: Maxim Cournoyer @ 2023-10-08 12:27 UTC (permalink / raw)
  To: Vivien Kraus; +Cc: 66099, Liliana Marie Prikler, rg

Hi Vivien,

Vivien Kraus <vivien@planete-kraus.eu> writes:

> Dear guix,
>
> I find it surprising that we should rename /lib/udev/hwdb.d to
> /lib/udev/hardware, but the impact is minimal (udevadm on Guix for the
> udev-service-type relies only on UDEV_HWDB_PATH, which can accept /hardware
> easily), and you insist, so, let’s do that.

I thought I mentioned it earlier (can't find it in my replies now) but
I'd prefer sticking to eudev's naming of choice (hwdb.d); going against
this will necessarily cause some friction and maintenance in the future,
for no gain (also, it may be more readable but unexpected by eudev's
users).  I'd say it's an extraneous change.

Sorry for the back and forth.

-- 
Thanks,
Maxim




^ permalink raw reply	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v9 7/7] services: udev: Install hardware files in /lib/udev/hardware.
  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
  0 siblings, 1 reply; 91+ messages in thread
From: Maxim Cournoyer @ 2023-10-08 12:28 UTC (permalink / raw)
  To: Vivien Kraus; +Cc: 66099, Liliana Marie Prikler, rg

Hi,

Apart from the hwdb.d -> hardware renaming, this series rest LGTM!

-- 
Thanks,
Maxim




^ permalink raw reply	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v9 0/7] Update eudev, upower, udev-service-type, with /lib/udev/hardware
  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
  0 siblings, 0 replies; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-10-08 12:33 UTC (permalink / raw)
  To: Maxim Cournoyer; +Cc: 66099, Liliana Marie Prikler, rg

Le dimanche 08 octobre 2023 à 08:27 -0400, Maxim Cournoyer a écrit :
> > I find it surprising that we should rename /lib/udev/hwdb.d to
> > /lib/udev/hardware, but the impact is minimal (udevadm on Guix for
> > the
> > udev-service-type relies only on UDEV_HWDB_PATH, which can accept
> > /hardware
> > easily), and you insist, so, let’s do that.
> 
> I thought I mentioned it earlier (can't find it in my replies now)
> but
> I'd prefer sticking to eudev's naming of choice (hwdb.d); going
> against
> this will necessarily cause some friction and maintenance in the
> future,
> for no gain (also, it may be more readable but unexpected by eudev's
> users).  I'd say it's an extraneous change.
> 
> Sorry for the back and forth.

No problem, I’ll remove it in the next iteration, and if this is the
last, then the commiter can just ignore the last patch.

Best regards,

Vivien




^ permalink raw reply	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v10 0/6] Exact same, without the last patch
  2023-10-08 12:28                                   ` Maxim Cournoyer
@ 2023-10-10 19:28                                     ` 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-10 23:44                                       ` [bug#66099] [PATCH gnome-team v10 0/6] Exact same, without the last patch Maxim Cournoyer
  0 siblings, 2 replies; 91+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-10-10 19:28 UTC (permalink / raw)
  To: Maxim Cournoyer, Liliana Marie Prikler, 66099; +Cc: rg

Dear guix,

Here is the exact same series, rebased on top of gnome-team, without the last
patch: the hwdb.d directory is kept as-is.

(the base-commit tag below has been updated too)

Best regards,

Vivien

Vivien Kraus (6):
  gnu: eudev: Update to 3.2.14.
  services: udev: Rewrite udev-rule to use file->udev-rule.
  services: udev: Make udev-rule helper functions generic.
  gnu: udev-service-type: accept hardware description file extensions.
  gnu: libgudev: Update to 238.
  gnu: upower: Update to 1.90.2.

 doc/guix.texi                                 |  57 +++++++--
 gnu/packages/gnome.scm                        |  43 ++++---
 gnu/packages/linux.scm                        |  57 ++++++---
 .../patches/eudev-rules-directory.patch       |   9 +-
 gnu/services/base.scm                         | 116 +++++++++++++-----
 5 files changed, 199 insertions(+), 83 deletions(-)


base-commit: d6462be6a83bf33b569980734fb7ee23836c91a0
-- 
2.41.0




^ permalink raw reply	[flat|nested] 91+ messages in thread

* [bug#66099] [PATCH gnome-team v10 0/6] Exact same, without the last patch
  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-10 23:44                                       ` Maxim Cournoyer
  2023-10-11  4:18                                         ` bug#66099: " Liliana Marie Prikler
  1 sibling, 1 reply; 91+ messages in thread
From: Maxim Cournoyer @ 2023-10-10 23:44 UTC (permalink / raw)
  To: Vivien Kraus; +Cc: 66099, Liliana Marie Prikler, rg

Hi,

Vivien Kraus <vivien@planete-kraus.eu> writes:

> Dear guix,
>
> Here is the exact same series, rebased on top of gnome-team, without the last
> patch: the hwdb.d directory is kept as-is.
>
> (the base-commit tag below has been updated too)
>
> Best regards,
>
> Vivien
>
> Vivien Kraus (6):
>   gnu: eudev: Update to 3.2.14.
>   services: udev: Rewrite udev-rule to use file->udev-rule.
>   services: udev: Make udev-rule helper functions generic.
>   gnu: udev-service-type: accept hardware description file extensions.
>   gnu: libgudev: Update to 238.
>   gnu: upower: Update to 1.90.2.

This series LGTM!

-- 
Thanks,
Maxim




^ permalink raw reply	[flat|nested] 91+ messages in thread

* bug#66099: [PATCH gnome-team v10 0/6] Exact same, without the last patch
  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                                         ` Liliana Marie Prikler
  0 siblings, 0 replies; 91+ messages in thread
From: Liliana Marie Prikler @ 2023-10-11  4:18 UTC (permalink / raw)
  To: Maxim Cournoyer, Vivien Kraus; +Cc: rg, 66099-done

Am Dienstag, dem 10.10.2023 um 19:44 -0400 schrieb Maxim Cournoyer:
> Hi,
> 
> Vivien Kraus <vivien@planete-kraus.eu> writes:
> 
> > Dear guix,
> > 
> > Here is the exact same series, rebased on top of gnome-team,
> > without the last patch: the hwdb.d directory is kept as-is.
> > 
> > (the base-commit tag below has been updated too)
> > 
> > Best regards,
> > 
> > Vivien
> > 
> > Vivien Kraus (6):
> >   gnu: eudev: Update to 3.2.14.
> >   services: udev: Rewrite udev-rule to use file->udev-rule.
> >   services: udev: Make udev-rule helper functions generic.
> >   gnu: udev-service-type: accept hardware description file
> > extensions.
> >   gnu: libgudev: Update to 238.
> >   gnu: upower: Update to 1.90.2.
> 
> This series LGTM!
Pushed to gnome-teams now.

Thanks





^ permalink raw reply	[flat|nested] 91+ messages in thread

end of thread, other threads:[~2023-10-11  4:20 UTC | newest]

Thread overview: 91+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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                                           ` [bug#66099] [PATCH gnome-team v10 3/6] services: udev: Make udev-rule helper functions generic Vivien Kraus via Guix-patches via
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

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).