diff mbox series

[bug#63508,v4,2/2] gnu: eudev: Have udevadm look in /etc/udev/rules.d. (Closes: #63508)

Message ID 2d51ddd4e6865a40a15b8f7948d2479952571a4e.1685379443.git.felix.lechner@lease-up.com
State New
Headers show
Series [bug#63508,v4,1/2] gnu: eudev: Use new project URL for Git repo and home page. | expand

Commit Message

Felix Lechner May 29, 2023, 4:57 p.m. UTC
This substitution ensures that udevadm sees the rules that are actually in
effect for the declared operating system. It allows administrators to use the
udev-rules-service for network interfaces.

Some of Guix's customizations for udev rules appear to work as it is [1] but
that is not true for network interfaces (which invoke udevadm for naming
purposes). [2]

Without this commit, udevadm will consult the rules that were present at build
time and were installed in the store).

[1] https://lists.gnu.org/archive/html/guix-devel/2023-05/msg00195.html
[2] https://lists.gnu.org/archive/html/guix-devel/2023-05/msg00192.html

* gnu/packages/linux.scm (eudev): Have udevadm look in
/etc/udev/rules.d. (Closes: #63508)
---
 gnu/packages/linux.scm | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Bruno Victal May 29, 2023, 8:28 p.m. UTC | #1
Hi Lechner,

On 2023-05-29 17:57, Felix Lechner via Guix-patches via wrote:
>        #:phases
>        #~(modify-phases %standard-phases
> +          (add-before 'bootstrap 'hardcode-runtime-rules-dir
> +            (lambda _
> +              (use-modules (ice-9 regex))
> +              (substitute* "src/udev/Makefile.am"
> +                (((regexp-quote "$(udevrulesdir)")) "/etc/udev/rules.d"))))

Perhaps instead of substituting, can you check if
#:configure-flags or #:make-flags could be used instead?
Felix Lechner May 29, 2023, 9:06 p.m. UTC | #2
Hi Bruno,

On Mon, May 29, 2023 at 1:28 PM Bruno Victal <mirai@makinata.eu> wrote:
>
> Perhaps instead of substituting, can you check if
> #:configure-flags or #:make-flags could be used instead?

Thank you for that suggestion! I did, and I do not believe it is
possible to specify a separate runtime path for udevadm via
./configure at this time.

It would be possible to add a second variable in configure.ac [1] and
use that in the relevant Makefile.am. [2] The change would get picked
up for the runtime search path throughout [3] and for the inotify
watch in udevd. [4]

In that scenario, it would be crucial not to modify the installation
directory that was specified via the variable prefix "udevrules_" in
several Makefiles.am, [5][6][7] which use Automake's "uniform" naming
scheme that leaves off 'dir'. [8]

Unfortunately, for most distros the distinctions are meaningless, and
perhaps even incomprehensible. I estimated the chance of upstream
acceptance as low. After some reflection, it was easier to patch the
runtime path directly in the lone place that matters to Guix. [2,
again]

I also do not see how the second variable needed can be introduced by
invoking 'make' in a different way. Please let me know if you find a
way. Thanks!

Kind regards
Felix

[1] https://github.com/eudev-project/eudev/blob/0a4dae19c1a191c8054fc2b9c2d592e797715a69/configure.ac#L180
[2] https://github.com/eudev-project/eudev/blob/0a4dae19c1a191c8054fc2b9c2d592e797715a69/src/udev/Makefile.am#L10
[3] https://github.com/eudev-project/eudev/blob/2703baf55615b7554fb67c4f1c241f057f8c0a79/src/udev/udev-rules.c#L53
[4] https://github.com/eudev-project/eudev/blob/2703baf55615b7554fb67c4f1c241f057f8c0a79/src/udev/udevd.c#L1306
[5] https://github.com/eudev-project/eudev/blob/2703baf55615b7554fb67c4f1c241f057f8c0a79/rules/Makefile.am#L9
[6] https://github.com/eudev-project/eudev/blob/2703baf55615b7554fb67c4f1c241f057f8c0a79/rules/Makefile.am#L35
[7] https://github.com/eudev-project/eudev/blob/2703baf55615b7554fb67c4f1c241f057f8c0a79/rule_generator/Makefile.am#L12
[8] https://www.gnu.org/software/automake/manual/html_node/Uniform.html
diff mbox series

Patch

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 7a365e2e22..55255e576e 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -4192,6 +4192,11 @@  (define-public eudev
      (list
       #:phases
       #~(modify-phases %standard-phases
+          (add-before 'bootstrap 'hardcode-runtime-rules-dir
+            (lambda _
+              (use-modules (ice-9 regex))
+              (substitute* "src/udev/Makefile.am"
+                (((regexp-quote "$(udevrulesdir)")) "/etc/udev/rules.d"))))
           (add-before 'bootstrap 'patch-file-names
             (lambda* (#:key inputs native-inputs #:allow-other-keys)
               (substitute* "man/make.sh"