[PATCH gnome-team 0/3] Update upower

  • Done
  • quality assurance status badge
Details
3 participants
  • Liliana Marie Prikler
  • Maxim Cournoyer
  • Vivien Kraus
Owner
unassigned
Submitted by
Vivien Kraus
Severity
normal
V
V
Vivien Kraus wrote on 19 Sep 2023 13:35
(address . guix-patches@gnu.org)
cover.1695123329.git.vivien@planete-kraus.eu
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
V
V
Vivien Kraus wrote on 19 Sep 2023 13:23
[PATCH gnome-team 1/3] gnu: eudev: Update libudev version to 251.
(address . 66099@debbugs.gnu.org)
f72904db9f40668adc2dcfaead688331de0d10ba.1695123329.git.vivien@planete-kraus.eu
Support for version 251 is only provided as a merge request for now:


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

Toggle diff (207 lines)
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
V
V
Vivien Kraus wrote on 19 Sep 2023 13:32
[PATCH gnome-team 2/3] gnu: libgudev: Update to 238.
(address . 66099@debbugs.gnu.org)
aa548b7986cf99970e73524d815ac1521445accc.1695123329.git.vivien@planete-kraus.eu
* gnu/packages/gnome.scm (libgudev): Update to 238.
---
gnu/packages/gnome.scm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Toggle diff (23 lines)
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
V
V
Vivien Kraus wrote on 19 Sep 2023 13:32
[PATCH gnome-team 3/3] gnu: upower: Update to 1.90.2.
(address . 66099@debbugs.gnu.org)
1d492eda5693dd0f56f4cec53b2115d1c598139c.1695123329.git.vivien@planete-kraus.eu
* gnu/packages/gnome.scm (upower): Update to 1.90.2.
---
gnu/packages/gnome.scm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Toggle diff (24 lines)
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
V
V
Vivien Kraus wrote on 19 Sep 2023 17:51
(address . 66099@debbugs.gnu.org)
644845c4f2a32a8a6583f19309be2be336629bb4.camel@planete-kraus.eu
Le mardi 19 septembre 2023 à 13:32 +0200, Vivien Kraus a écrit :
Toggle quote (2 lines)
> * 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
L
L
Liliana Marie Prikler wrote on 21 Sep 2023 19:06
Re: [bug#66099] [PATCH gnome-team 0/3] Update upower
4c52ffd0442ea8f35ff6f18cef7a21be4092bf27.camel@gmail.com
Am Dienstag, dem 19.09.2023 um 13:35 +0200 schrieb Vivien Kraus:
Toggle quote (15 lines)
> 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
V
V
Vivien Kraus wrote on 21 Sep 2023 23:05
ff76eae3f34767898c396b4c23b31e9cd774e76b.camel@planete-kraus.eu
Le jeudi 21 septembre 2023 à 19:06 +0200, Liliana Marie Prikler a
écrit :
Toggle quote (3 lines)
> 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
V
V
Vivien Kraus wrote on 22 Sep 2023 00:03
4c33ab1d7c349f4215c5fdd7a1d42389d0e34bd3.camel@planete-kraus.eu
Le jeudi 21 septembre 2023 à 23:05 +0200, Vivien Kraus a écrit :
Toggle quote (6 lines)
> 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
L
L
Liliana Marie Prikler wrote on 22 Sep 2023 06:22
a5af1398e78a52f4d8c98926cf38ef57d41751b4.camel@gmail.com
Am Freitag, dem 22.09.2023 um 00:03 +0200 schrieb Vivien Kraus:
Toggle quote (5 lines)
> 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
V
V
Vivien Kraus wrote on 19 Sep 2023 13:32
[WIP PATCH gnome-team v2 2/3] gnu: libgudev: Update to 238.
74d52597372713113a36207dc9542abda7c02a98.1696070591.git.vivien@planete-kraus.eu
* gnu/packages/gnome.scm (libgudev): Update to 238.
---
gnu/packages/gnome.scm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Toggle diff (23 lines)
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
V
V
Vivien Kraus wrote on 19 Sep 2023 13:32
[WIP PATCH gnome-team v2 3/3] gnu: upower: Update to 1.90.2.
4b7bd62cdef6986e0d659816ada6cb0bf3d60cdc.1696070591.git.vivien@planete-kraus.eu
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(-)

Toggle diff (79 lines)
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
V
V
Vivien Kraus wrote on 30 Sep 2023 12:43
[WIP PATCH gnome-team v2 0/3] Nicer eudev, upower still fails
cover.1696070591.git.vivien@planete-kraus.eu
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
V
V
Vivien Kraus wrote on 19 Sep 2023 13:23
[WIP PATCH gnome-team v2 1/3] gnu: eudev: Update libudev version to 251.
18ff7cf952823194b52adcd0e6a13171d701ab94.1696070591.git.vivien@planete-kraus.eu
Support for version 251 is only provided as a merge request for now:


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

Toggle diff (425 lines)
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_a
This message was truncated. Download the full message here.
V
V
Vivien Kraus wrote on 30 Sep 2023 16:20
[PATCH gnome-team v3 0/3] Update eudev and upower
cover.1696083614.git.vivien@planete-kraus.eu
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
V
V
Vivien Kraus wrote on 19 Sep 2023 13:32
[PATCH gnome-team v3 2/3] gnu: libgudev: Update to 238.
2bfee11ea66c2005e76523654dc5c92b2974cfd1.1696083614.git.vivien@planete-kraus.eu
* gnu/packages/gnome.scm (libgudev): Update to 238.
---
gnu/packages/gnome.scm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Toggle diff (23 lines)
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
V
V
Vivien Kraus wrote on 19 Sep 2023 13:23
[PATCH gnome-team v3 1/3] gnu: eudev: Update libudev version to 251.
ab54b51365fb18c06f235fedf451e64bad0c88bb.1696083614.git.vivien@planete-kraus.eu
Support for version 251 is only provided as a merge request for now:


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

Toggle diff (418 lines)
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"

This message was truncated. Download the full message here.
V
V
Vivien Kraus wrote on 19 Sep 2023 13:32
[PATCH gnome-team v3 3/3] gnu: upower: Update to 1.90.2.
30b94b124745c3bbb33fc042e766ce57f1ac8005.1696083614.git.vivien@planete-kraus.eu
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(-)

Toggle diff (65 lines)
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
L
L
Liliana Marie Prikler wrote on 30 Sep 2023 19:59
Re: [PATCH gnome-team v3 1/3] gnu: eudev: Update libudev version to 251.
cfafe026079196dda7b127dbacc30712c67b655a.camel@gmail.com
Am Dienstag, dem 19.09.2023 um 13:23 +0200 schrieb Vivien Kraus:
Toggle quote (29 lines)
> 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.

Toggle quote (2 lines)
> * 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.
Toggle quote (6 lines)
> [#: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".
Toggle quote (5 lines)
> * 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
V
V
Vivien Kraus wrote on 1 Oct 2023 22:20
[PATCH gnome-team v4 0/4] Update eudev and upower
cover.1696191643.git.vivien@planete-kraus.eu
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
V
V
Vivien Kraus wrote on 19 Sep 2023 13:23
[PATCH gnome-team v4 1/4] gnu: eudev: Update libudev version to 251.
b30bb395d6765a800b1377ac04443aba75260167.1696191643.git.vivien@planete-kraus.eu
Support for version 251 is only provided as a pull request for now:


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

Toggle diff (228 lines)
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
V
V
Vivien Kraus wrote on 30 Sep 2023 21:32
[PATCH gnome-team v4 2/4] guix: Add udev-hwdb-bin profile hook.
d05230bf70c7c9ed94547a4d18d5b64d7288f2e7.1696191643.git.vivien@planete-kraus.eu
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(+)

Toggle diff (49 lines)
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
V
V
Vivien Kraus wrote on 19 Sep 2023 13:32
[PATCH gnome-team v4 3/4] gnu: libgudev: Update to 238.
976afb59b36ddc714ff1232d1257b3e025f82b11.1696191643.git.vivien@planete-kraus.eu
* gnu/packages/gnome.scm (libgudev): Update to 238.
---
gnu/packages/gnome.scm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Toggle diff (23 lines)
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
V
V
Vivien Kraus wrote on 19 Sep 2023 13:32
[PATCH gnome-team v4 4/4] gnu: upower: Update to 1.90.2.
e6367c4a3cbc8fe7b05c111dd5911728a79ce4eb.1696191643.git.vivien@planete-kraus.eu
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(-)

Toggle diff (80 lines)
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
M
M
Maxim Cournoyer wrote on 1 Oct 2023 22:32
Re: [PATCH gnome-team v3 2/3] gnu: libgudev: Update to 238.
(name . Vivien Kraus)(address . vivien@planete-kraus.eu)
87sf6u5bjy.fsf@gmail.com
Hi,

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

Toggle quote (27 lines)
> * 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
M
M
Maxim Cournoyer wrote on 2 Oct 2023 00:02
Re: [PATCH gnome-team v3 1/3] gnu: eudev: Update libudev version to 251.
(name . Vivien Kraus)(address . vivien@planete-kraus.eu)
87o7hi57ck.fsf@gmail.com
Hi,

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

Toggle quote (40 lines)
> 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.

[...]

Toggle quote (37 lines)
> (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).)

[...]

Toggle quote (10 lines)
> 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}

Toggle quote (17 lines)
> + (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.

Toggle quote (21 lines)
> + (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
L
L
Liliana Marie Prikler wrote on 2 Oct 2023 19:02
15094b9735aedadd8e86b7c6c07ab53619b3e589.camel@gmail.com
Am Sonntag, dem 01.10.2023 um 18:02 -0400 schrieb Maxim Cournoyer:
Toggle quote (41 lines)
> > +            (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
L
L
Liliana Marie Prikler wrote on 2 Oct 2023 19:12
Re: [PATCH gnome-team v4 1/4] gnu: eudev: Update libudev version to 251.
cfc8ee1ab8627ac6c6723b9f7945098d356a25ec.camel@gmail.com
Am Dienstag, dem 19.09.2023 um 13:23 +0200 schrieb Vivien Kraus:
Toggle quote (4 lines)
> +    (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?

Toggle quote (8 lines)
> +            ;; 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
L
L
Liliana Marie Prikler wrote on 2 Oct 2023 19:17
Re: [PATCH gnome-team v4 4/4] gnu: upower: Update to 1.90.2.
0a7a4690a881ab96b46df519a2f7c32c227e2ed6.camel@gmail.com
Am Dienstag, dem 19.09.2023 um 13:32 +0200 schrieb Vivien Kraus:
Toggle quote (6 lines)
> 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.
Toggle quote (6 lines)
>
> * 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.
Toggle quote (1 lines)
> [inputs]: Remove dbus-glib.
Okay.
Toggle quote (2 lines)
> [native-inputs]: Add dbus for the tests.
> ---
"Add dbus." suffices.

Cheers
V
V
Vivien Kraus wrote on 2 Oct 2023 21:33
Re: [PATCH gnome-team v4 1/4] gnu: eudev: Update libudev version to 251.
525efd48e0848f0e6f11dc51c8fcd710d6f78f8f.camel@planete-kraus.eu
Hi!

Le lundi 02 octobre 2023 à 19:12 +0200, Liliana Marie Prikler a écrit :
Toggle quote (9 lines)
> 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
M
M
Maxim Cournoyer wrote on 4 Oct 2023 03:00
(name . Vivien Kraus)(address . vivien@planete-kraus.eu)
87cyxv6w2n.fsf@gmail.com
Hi,

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

Toggle quote (24 lines)
> 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
V
V
Vivien Kraus wrote on 4 Oct 2023 12:00
[PATCH gnome-team v5 0/4] Update eudev and udev-service-type
(address . rg@raghavgururajan.name)
cover.1696413551.git.vivien@planete-kraus.eu
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
V
V
Vivien Kraus wrote on 19 Sep 2023 13:23
[PATCH gnome-team v5 1/4] gnu: eudev: Update libudev version to 251.
(address . rg@raghavgururajan.name)
b87e10e34058f32dd00b7232ec3ad75dddcecf6c.1696413551.git.vivien@planete-kraus.eu
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

Toggle diff (164 lines)
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
V
V
Vivien Kraus wrote on 2 Oct 2023 21:08
[PATCH gnome-team v5 2/4] gnu: udev-service-type: accept hwdb file extensions.
(address . rg@raghavgururajan.name)
db41842e9c49ce0484e197340a65db41cbbe5e1b.1696413551.git.vivien@planete-kraus.eu
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(-)

Toggle diff (285 lines)
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
V
V
Vivien Kraus wrote on 19 Sep 2023 13:32
[PATCH gnome-team v5 3/4] gnu: libgudev: Update to 238.
(address . rg@raghavgururajan.name)
f4523ea3888a191efbf95398d0e4c06ccf3775cb.1696413551.git.vivien@planete-kraus.eu
* gnu/packages/gnome.scm (libgudev): Update to 238.
---
gnu/packages/gnome.scm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Toggle diff (23 lines)
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
V
V
Vivien Kraus wrote on 19 Sep 2023 13:32
[PATCH gnome-team v5 4/4] gnu: upower: Update to 1.90.2.
(address . rg@raghavgururajan.name)
faa7a403c7331df45911e03a79fff33325c426e9.1696413551.git.vivien@planete-kraus.eu
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(-)

Toggle diff (78 lines)
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
L
L
Liliana Marie Prikler wrote on 4 Oct 2023 18:52
Re: [PATCH gnome-team v5 2/4] gnu: udev-service-type: accept hwdb file extensions.
(address . rg@raghavgururajan.name)
42e4b490bce80a94f1afb7f5843d77823058150a.camel@gmail.com
Am Montag, dem 02.10.2023 um 21:08 +0200 schrieb Vivien Kraus:
Toggle quote (5 lines)
> 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)?

Toggle quote (8 lines)
> 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."

Toggle quote (358 lines)
> 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
V
V
Vivien Kraus wrote on 4 Oct 2023 23:37
[PATCH gnome-team v6 0/5] Update eudev, udev-service-type, upower
(address . rg@raghavgururajan.name)
cover.1696455422.git.vivien@planete-kraus.eu
Dear guix,

Le mercredi 04 octobre 2023 à 18:52 +0200, Liliana Marie Prikler a écrit :
Toggle quote (9 lines)
> 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.

Toggle quote (15 lines)
> > 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
V
V
Vivien Kraus wrote on 19 Sep 2023 13:23
[PATCH gnome-team v6 1/5] gnu: eudev: Update libudev version to 251.
(address . rg@raghavgururajan.name)
1ed2985a00d92f2c274fcd473fd99c6f6881f689.1696455422.git.vivien@planete-kraus.eu
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

Toggle diff (164 lines)
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
V
V
Vivien Kraus wrote on 4 Oct 2023 23:05
[PATCH gnome-team v6 2/5] services: udev: unify udev-rule and file->udev-rule.
(address . rg@raghavgururajan.name)
7f63dfc3b0cc8321212f024bddc1c4625fadfe45.1696455423.git.vivien@planete-kraus.eu
* 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(-)

Toggle diff (30 lines)
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
V
V
Vivien Kraus wrote on 2 Oct 2023 21:08
[PATCH gnome-team v6 3/5] gnu: udev-service-type: accept hwdb file extensions.
(address . rg@raghavgururajan.name)
c5b55ee09b6323ee9b1d4036e36008421eb03971.1696455423.git.vivien@planete-kraus.eu
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(-)

Toggle diff (270 lines)
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
V
V
Vivien Kraus wrote on 19 Sep 2023 13:32
[PATCH gnome-team v6 4/5] gnu: libgudev: Update to 238.
(address . rg@raghavgururajan.name)
3482b977166652b2c8bd04c6cb21b7c40190c0ed.1696455423.git.vivien@planete-kraus.eu
* gnu/packages/gnome.scm (libgudev): Update to 238.
---
gnu/packages/gnome.scm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Toggle diff (23 lines)
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
V
V
Vivien Kraus wrote on 19 Sep 2023 13:32
[PATCH gnome-team v6 5/5] gnu: upower: Update to 1.90.2.
(address . rg@raghavgururajan.name)
462502fb5334412e329a91c6e906bd09571b650f.1696455423.git.vivien@planete-kraus.eu
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(-)

Toggle diff (78 lines)
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
L
L
Liliana Marie Prikler wrote on 5 Oct 2023 06:50
Re: [PATCH gnome-team v6 1/5] gnu: eudev: Update libudev version to 251.
(address . rg@raghavgururajan.name)
69e084520f189ab5f8a80afc7011a9b1ae911d2a.camel@gmail.com
Am Dienstag, dem 19.09.2023 um 13:23 +0200 schrieb Vivien Kraus:
Toggle quote (4 lines)
> 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.

Toggle quote (8 lines)
> [...]
> * 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.
Toggle quote (5 lines)
> * 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
V
V
Vivien Kraus wrote on 5 Oct 2023 07:04
[PATCH gnome-team v7 0/5] Update eudev with a snippet, udev-service-type, upower
(address . rg@raghavgururajan.name)
cover.1696482243.git.vivien@planete-kraus.eu
Le jeudi 05 octobre 2023 à 06:50 +0200, Liliana Marie Prikler a écrit :
Toggle quote (9 lines)
> 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.

Toggle quote (10 lines)
> > * 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
V
V
Vivien Kraus wrote on 19 Sep 2023 13:23
[PATCH gnome-team v7 1/5] gnu: eudev: Update libudev version to 251.
(address . rg@raghavgururajan.name)
5336473ade7d12a8c96f7212dad22c9fb3d18524.1696482243.git.vivien@planete-kraus.eu
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(-)

Toggle diff (130 lines)
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
V
V
Vivien Kraus wrote on 4 Oct 2023 23:05
[PATCH gnome-team v7 2/5] services: udev: unify udev-rule and file->udev-rule.
(address . rg@raghavgururajan.name)
77c5be1f9c3b50fdd4f61cf2e4f80b6900b89a65.1696482243.git.vivien@planete-kraus.eu
* 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(-)

Toggle diff (30 lines)
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
V
V
Vivien Kraus wrote on 2 Oct 2023 21:08
[PATCH gnome-team v7 3/5] gnu: udev-service-type: accept hwdb file extensions.
(address . rg@raghavgururajan.name)
53b29725dbfa2210a4b29105828c611550a8eab7.1696482243.git.vivien@planete-kraus.eu
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(-)

Toggle diff (270 lines)
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
V
V
Vivien Kraus wrote on 19 Sep 2023 13:32
[PATCH gnome-team v7 4/5] gnu: libgudev: Update to 238.
(address . rg@raghavgururajan.name)
d23bdd9bcd8f10f76500f41c66c2040cf2e848c9.1696482243.git.vivien@planete-kraus.eu
* gnu/packages/gnome.scm (libgudev): Update to 238.
---
gnu/packages/gnome.scm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Toggle diff (23 lines)
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
V
V
Vivien Kraus wrote on 19 Sep 2023 13:32
[PATCH gnome-team v7 5/5] gnu: upower: Update to 1.90.2.
(address . rg@raghavgururajan.name)
1d1ca103f706928cdf7c9008fa00e67af66a6a91.1696482243.git.vivien@planete-kraus.eu
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(-)

Toggle diff (78 lines)
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
L
L
Liliana Marie Prikler wrote on 5 Oct 2023 07:42
Re: [PATCH gnome-team v6 3/5] gnu: udev-service-type: accept hwdb file extensions.
(address . rg@raghavgururajan.name)
0825bf42daa34ee464c5237b04ad6bf90942e489.camel@gmail.com
Am Montag, dem 02.10.2023 um 21:08 +0200 schrieb Vivien Kraus:
Toggle quote (2 lines)
> 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
L
L
Liliana Marie Prikler wrote on 5 Oct 2023 07:54
Re: [PATCH gnome-team v7 0/5] Update eudev with a snippet, udev-service-type, upower
(address . rg@raghavgururajan.name)
d90e8899bd751f64087c8332d0c6f0b73c83f381.camel@gmail.com
Am Donnerstag, dem 05.10.2023 um 07:04 +0200 schrieb Vivien Kraus:
Toggle quote (29 lines)
> 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 :(

Toggle quote (3 lines)
> 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
V
V
Vivien Kraus wrote on 5 Oct 2023 07:55
Re: [PATCH gnome-team v6 3/5] gnu: udev-service-type: accept hwdb file extensions.
(address . rg@raghavgururajan.name)
8d515c3de9de879e3dba0e1f5dec1e40983b8560.camel@planete-kraus.eu
Le jeudi 05 octobre 2023 à 07:42 +0200, Liliana Marie Prikler a écrit :
Toggle quote (8 lines)
> 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
L
L
Liliana Marie Prikler wrote on 5 Oct 2023 08:53
(address . rg@raghavgururajan.name)
1a1089275d13e02b4485c5de6e908ece88f5d2b6.camel@gmail.com
Am Donnerstag, dem 05.10.2023 um 07:55 +0200 schrieb Vivien Kraus:
Toggle quote (11 lines)
> 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
M
M
Maxim Cournoyer wrote on 5 Oct 2023 15:28
Re: [PATCH gnome-team v7 1/5] gnu: eudev: Update libudev version to 251.
(name . Vivien Kraus)(address . vivien@planete-kraus.eu)
87y1ghryel.fsf@gmail.com
Hello,

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

Toggle quote (14 lines)
> 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.

Toggle quote (12 lines)
> 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.

Toggle quote (74 lines)
> [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?

Toggle quote (25 lines)
> (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.

Toggle quote (38 lines)
> + (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
M
M
Maxim Cournoyer wrote on 5 Oct 2023 15:30
Re: [PATCH gnome-team v7 2/5] services: udev: unify udev-rule and file->udev-rule.
(name . Vivien Kraus)(address . vivien@planete-kraus.eu)
87ttr5rybo.fsf@gmail.com
Hi,

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

Toggle quote (32 lines)
> * 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
M
M
Maxim Cournoyer wrote on 5 Oct 2023 15:33
(name . Vivien Kraus)(address . vivien@planete-kraus.eu)
87pm1try6q.fsf@gmail.com
Oops, I just noted something:

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

Toggle quote (32 lines)
> * 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
M
M
Maxim Cournoyer wrote on 5 Oct 2023 16:31
Re: [PATCH gnome-team v7 3/5] gnu: udev-service-type: accept hwdb file extensions.
(name . Vivien Kraus)(address . vivien@planete-kraus.eu)
87lechrvhl.fsf@gmail.com
Hi Vivien,

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

Toggle quote (10 lines)
> 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.

Toggle quote (45 lines)
> 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/

Toggle quote (4 lines)
> +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).

Toggle quote (3 lines)
> +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/

Toggle quote (7 lines)
> +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."

Toggle quote (5 lines)
> +@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}

Toggle quote (18 lines)
> +@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?

Toggle quote (42 lines)
> @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.

Toggle quote (39 lines)
> +@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.

Toggle quote (46 lines)
> + (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.

Toggle quote (64 lines)
> (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.

Toggle quote (15 lines)
> (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
M
M
Maxim Cournoyer wrote on 5 Oct 2023 16:32
Re: [PATCH gnome-team v7 4/5] gnu: libgudev: Update to 238.
(name . Vivien Kraus)(address . vivien@planete-kraus.eu)
87h6n5rvh1.fsf@gmail.com
Hi,

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

Toggle quote (27 lines)
> * 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
M
M
Maxim Cournoyer wrote on 5 Oct 2023 16:35
Re: [PATCH gnome-team v7 5/5] gnu: upower: Update to 1.90.2.
(name . Vivien Kraus)(address . vivien@planete-kraus.eu)
87cyxtrvb2.fsf@gmail.com
Hi!

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

Toggle quote (16 lines)
> 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
V
V
Vivien Kraus wrote on 6 Oct 2023 18:45
[PATCH gnome-team v8 0/6] Update eudev, udev-service-type, upower
(address . rg@raghavgururajan.name)
cover.1696610746.git.vivien@planete-kraus.eu
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 :
Toggle quote (8 lines)
> 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.

Toggle quote (3 lines)
> 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 :
Toggle quote (17 lines)
> 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 :
Toggle quote (15 lines)
> > 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 :
Toggle quote (17 lines)
> > 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 :
Toggle quote (2 lines)
> > + (add-before 'bootstrap 'install-in-lib
> > + (lambda _
[...]
Toggle quote (5 lines)
>
> 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.

Toggle quote (4 lines)
> > + "--sysconfdir=/etc")))
>
> See comment above about justifying this flag.

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

Toggle quote (17 lines)
> > @@ -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 :
Toggle quote (4 lines)
> 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 :
Toggle quote (9 lines)
> > 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).

Toggle quote (3 lines)
> 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:
Toggle quote (2 lines)
> I'd drop this change.

Done.

Toggle quote (15 lines)
> > +@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:
Toggle quote (2 lines)
> As discussed earlier, I don't think that new field is needed.

And further down:
Toggle quote (7 lines)
> > + (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.

Toggle quote (1 lines)
> 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
V
V
Vivien Kraus wrote on 19 Sep 2023 13:23
[PATCH gnome-team v8 1/6] gnu: eudev: Update to 3.2.14.
(address . rg@raghavgururajan.name)
abfc98b789e09b5eca59caea068bb455d2186ac2.1696610746.git.vivien@planete-kraus.eu
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(-)

Toggle diff (124 lines)
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
V
V
Vivien Kraus wrote on 5 Oct 2023 19:33
[PATCH gnome-team v8 2/6] services: udev: Rewrite udev-rule to use file->udev-rule.
(address . rg@raghavgururajan.name)
745ab283537534e14ae37e1989ba7baa4178938b.1696610746.git.vivien@planete-kraus.eu
* gnu/services/base.scm (udev-rule): Use file->udev-rule.
---
gnu/services/base.scm | 14 +-------------
1 file changed, 1 insertion(+), 13 deletions(-)

Toggle diff (27 lines)
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
V
V
Vivien Kraus wrote on 5 Oct 2023 19:24
[PATCH gnome-team v8 3/6] services: udev: Make udev-rule helper functions generic.
(address . rg@raghavgururajan.name)
1e9635cac8aa08da17be6f1270552e3f4dfbdd40.1696610746.git.vivien@planete-kraus.eu
* gnu/services/base.scm (udev-configurations-union): New function.
(udev-configuration-file): New function, use file->udev-configuration-file.
(file->udev-configuration-file): New function.
(udev-rules-union): Use udev-configurations-union.
(udev-rule): Use udev-configuration-file.
(file->udev-rule): Use file->udev-configuration-file.
---
gnu/services/base.scm | 50 +++++++++++++++++++++++++++++--------------
1 file changed, 34 insertions(+), 16 deletions(-)

Toggle diff (90 lines)
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
V
V
Vivien Kraus wrote on 2 Oct 2023 21:08
[PATCH gnome-team v8 4/6] gnu: udev-service-type: accept hardware description file extensions.
(address . rg@raghavgururajan.name)
49d22daea7adba540d15321c247da1388010c76c.1696610746.git.vivien@planete-kraus.eu
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(-)

Toggle diff (235 lines)
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
V
V
Vivien Kraus wrote on 19 Sep 2023 13:32
[PATCH gnome-team v8 5/6] gnu: libgudev: Update to 238.
(address . rg@raghavgururajan.name)
0eed23771cad33bdc798d934374c783be7a4cbee.1696610746.git.vivien@planete-kraus.eu
* gnu/packages/gnome.scm (libgudev): Update to 238.
---
gnu/packages/gnome.scm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Toggle diff (23 lines)
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
V
V
Vivien Kraus wrote on 19 Sep 2023 13:32
[PATCH gnome-team v8 6/6] gnu: upower: Update to 1.90.2.
(address . rg@raghavgururajan.name)
d123bc3fd066741e0974fc06f44dcdd5a2630dae.1696610746.git.vivien@planete-kraus.eu
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(-)

Toggle diff (78 lines)
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
L
L
Liliana Marie Prikler wrote on 6 Oct 2023 20:23
Re: [PATCH gnome-team v8 0/6] Update eudev, udev-service-type, upower
(address . rg@raghavgururajan.name)
fb3fe41ea04d33e51ea6fa6745744b2c98e12d57.camel@gmail.com
Am Freitag, dem 06.10.2023 um 18:45 +0200 schrieb Vivien Kraus:
Toggle quote (10 lines)
> 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.

Toggle quote (13 lines)
> 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.

Toggle quote (16 lines)
> 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
L
L
Liliana Marie Prikler wrote on 6 Oct 2023 20:35
Re: [PATCH gnome-team v8 1/6] gnu: eudev: Update to 3.2.14.
(address . rg@raghavgururajan.name)
10e334a07e0d45ff7bce0a18b56fd68f13ad2ce8.camel@gmail.com
Am Dienstag, dem 19.09.2023 um 13:23 +0200 schrieb Vivien Kraus:
Toggle quote (5 lines)
> 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.

Toggle quote (5 lines)
> 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.

Toggle quote (4 lines)
> 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.

Toggle quote (3 lines)
> 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.

Toggle quote (9 lines)
> * 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
L
L
Liliana Marie Prikler wrote on 6 Oct 2023 20:42
Re: [PATCH gnome-team v8 4/6] gnu: udev-service-type: accept hardware description file extensions.
(address . rg@raghavgururajan.name)
9dcb22311514913d7b0fe41fd957e24423b8fa9b.camel@gmail.com
Am Montag, dem 02.10.2023 um 21:08 +0200 schrieb Vivien Kraus:
Toggle quote (4 lines)
> 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?

Toggle quote (6 lines)
> 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?
Toggle quote (3 lines)
> 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.

Toggle quote (180 lines)
> * 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

Toggle quote (64 lines)
>  
>  (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?
Toggle quote (52 lines)
>  
>  (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-
L
L
Liliana Marie Prikler wrote on 6 Oct 2023 20:48
Re: [PATCH gnome-team v8 6/6] gnu: upower: Update to 1.90.2.
(address . rg@raghavgururajan.name)
34cc0e2a780cca469d65222421e17f85414df8b2.camel@gmail.com
Am Dienstag, dem 19.09.2023 um 13:32 +0200 schrieb Vivien Kraus:
Toggle quote (2 lines)
> 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.
Toggle quote (2 lines)
> 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.  
????????

Toggle quote (11 lines)
> 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.
M
M
Maxim Cournoyer wrote on 7 Oct 2023 16:45
Re: [PATCH gnome-team v8 3/6] services: udev: Make udev-rule helper functions generic.
(name . Vivien Kraus)(address . vivien@planete-kraus.eu)
87ttr2ij9i.fsf@gmail.com
Hi,

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

[...]

Toggle quote (15 lines)
> - (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
V
V
Vivien Kraus wrote on 8 Oct 2023 12:49
[PATCH gnome-team v9 0/7] Update eudev, upower, udev-service-type, with /lib/udev/hardware
(address . rg@raghavgururajan.name)
cover.1696762169.git.vivien@planete-kraus.eu
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.

Toggle quote (7 lines)
> > 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
V
V
Vivien Kraus wrote on 19 Sep 2023 13:23
[PATCH gnome-team v9 1/7] gnu: eudev: Update to 3.2.14.
(address . rg@raghavgururajan.name)
92bf9bd6e7bb4ef8eb2564a1faca3d434abe0e76.1696762169.git.vivien@planete-kraus.eu
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(-)

Toggle diff (124 lines)
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
V
V
Vivien Kraus wrote on 5 Oct 2023 19:33
[PATCH gnome-team v9 2/7] services: udev: Rewrite udev-rule to use file->udev-rule.
(address . rg@raghavgururajan.name)
6a569fafbb3d54b2ca7bfa0e072e85728ac98120.1696762169.git.vivien@planete-kraus.eu
* gnu/services/base.scm (udev-rule): Use file->udev-rule.
---
gnu/services/base.scm | 14 +-------------
1 file changed, 1 insertion(+), 13 deletions(-)

Toggle diff (27 lines)
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
V
V
Vivien Kraus wrote on 5 Oct 2023 19:24
[PATCH gnome-team v9 3/7] services: udev: Make udev-rule helper functions generic.
(address . rg@raghavgururajan.name)
32db725fbb258635a0896b77a6daffca89ac7878.1696762169.git.vivien@planete-kraus.eu
* gnu/services/base.scm (udev-configurations-union): New function.
(udev-configuration-file): New function, use file->udev-configuration-file.
(file->udev-configuration-file): New function.
(udev-rules-union): Use udev-configurations-union.
(udev-rule): Use udev-configuration-file.
(file->udev-rule): Use file->udev-configuration-file.
---
gnu/services/base.scm | 50 +++++++++++++++++++++++++++++--------------
1 file changed, 34 insertions(+), 16 deletions(-)

Toggle diff (90 lines)
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
V
V
Vivien Kraus wrote on 2 Oct 2023 21:08
[PATCH gnome-team v9 4/7] gnu: udev-service-type: accept hardware description file extensions.
(address . rg@raghavgururajan.name)
129a803ebee4657c63a7f87d8a14f71f17bf9a19.1696762169.git.vivien@planete-kraus.eu
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(-)

Toggle diff (268 lines)
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
V
V
Vivien Kraus wrote on 19 Sep 2023 13:32
[PATCH gnome-team v9 5/7] gnu: libgudev: Update to 238.
(address . rg@raghavgururajan.name)
5fb6a280784285de08c22a6c87eab1256271d391.1696762169.git.vivien@planete-kraus.eu
* gnu/packages/gnome.scm (libgudev): Update to 238.
---
gnu/packages/gnome.scm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Toggle diff (23 lines)
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
V
V
Vivien Kraus wrote on 19 Sep 2023 13:32
[PATCH gnome-team v9 6/7] gnu: upower: Update to 1.90.2.
(address . rg@raghavgururajan.name)
2e8d1b767600ca21951d45db7ffb7e24cc20b912.1696762169.git.vivien@planete-kraus.eu
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(-)

Toggle diff (78 lines)
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
V
V
Vivien Kraus wrote on 8 Oct 2023 12:00
[PATCH gnome-team v9 7/7] services: udev: Install hardware files in /lib/udev/hardware.
(address . rg@raghavgururajan.name)
a752e535912270fb5cc650d7fa4a153432431043.1696762169.git.vivien@planete-kraus.eu
* 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(-)

Toggle diff (135 lines)
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
M
M
Maxim Cournoyer wrote on 8 Oct 2023 14:27
Re: [PATCH gnome-team v9 0/7] Update eudev, upower, udev-service-type, with /lib/udev/hardware
(name . Vivien Kraus)(address . vivien@planete-kraus.eu)
87r0m5e1u8.fsf@gmail.com
Hi Vivien,

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

Toggle quote (7 lines)
> 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
M
M
Maxim Cournoyer wrote on 8 Oct 2023 14:28
Re: [PATCH gnome-team v9 7/7] services: udev: Install hardware files in /lib/udev/hardware.
(name . Vivien Kraus)(address . vivien@planete-kraus.eu)
87mswte1rx.fsf@gmail.com
Hi,

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

--
Thanks,
Maxim
V
V
Vivien Kraus wrote on 8 Oct 2023 14:33
Re: [PATCH gnome-team v9 0/7] Update eudev, upower, udev-service-type, with /lib/udev/hardware
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)
d9ef458e2dbd96256d65f19f32af4cd186514b6e.camel@planete-kraus.eu
Le dimanche 08 octobre 2023 à 08:27 -0400, Maxim Cournoyer a écrit :
Toggle quote (18 lines)
> > 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
V
V
Vivien Kraus wrote on 2 Oct 2023 21:08
[PATCH gnome-team v10 4/6] gnu: udev-service-type: accept hardware description file extensions.
(address . rg@raghavgururajan.name)
f553e95282037dc0f7a77497d973e7c0621dc798.1696966139.git.vivien@planete-kraus.eu
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(-)

Toggle diff (268 lines)
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
V
V
Vivien Kraus wrote on 5 Oct 2023 19:33
[PATCH gnome-team v10 2/6] services: udev: Rewrite udev-rule to use file->udev-rule.
(address . rg@raghavgururajan.name)
70ae450282e2411c5506447c79adf6a62345344c.1696966139.git.vivien@planete-kraus.eu
* gnu/services/base.scm (udev-rule): Use file->udev-rule.
---
gnu/services/base.scm | 14 +-------------
1 file changed, 1 insertion(+), 13 deletions(-)

Toggle diff (27 lines)
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
V
V
Vivien Kraus wrote on 19 Sep 2023 13:23
[PATCH gnome-team v10 1/6] gnu: eudev: Update to 3.2.14.
(address . rg@raghavgururajan.name)
4744acd296e1c2f5d3f9f14c7cfba3e3696dcac7.1696966139.git.vivien@planete-kraus.eu
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(-)

Toggle diff (124 lines)
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
V
V
Vivien Kraus wrote on 10 Oct 2023 21:28
[PATCH gnome-team v10 0/6] Exact same, without the last patch
(address . rg@raghavgururajan.name)
cover.1696966138.git.vivien@planete-kraus.eu
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
V
V
Vivien Kraus wrote on 5 Oct 2023 19:24
[PATCH gnome-team v10 3/6] services: udev: Make udev-rule helper functions generic.
(address . rg@raghavgururajan.name)
cd08e1b6a17aba5bccf8d745f24d75026629d078.1696966139.git.vivien@planete-kraus.eu
* gnu/services/base.scm (udev-configurations-union): New function.
(udev-configuration-file): New function, use file->udev-configuration-file.
(file->udev-configuration-file): New function.
(udev-rules-union): Use udev-configurations-union.
(udev-rule): Use udev-configuration-file.
(file->udev-rule): Use file->udev-configuration-file.
---
gnu/services/base.scm | 50 +++++++++++++++++++++++++++++--------------
1 file changed, 34 insertions(+), 16 deletions(-)

Toggle diff (90 lines)
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,
--