Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: ssuominen@g.o
Subject: Re: [gentoo-dev] [RFC] systemd.eclass: Patch for new function systemd_get_udevdir()
Date: Mon, 06 Aug 2012 10:20:49
Message-Id: 20120806122025.27faf285@pomiocik.lan
In Reply to: [gentoo-dev] [RFC] systemd.eclass: Patch for new function systemd_get_udevdir() by Samuli Suominen
1 Ok, a few comments from me.
2
3 On Mon, 06 Aug 2012 13:00:08 +0300
4 Samuli Suominen <ssuominen@g.o> wrote:
5
6 > --- systemd.eclass 2012-08-06 12:49:20.532528219 +0300
7 > +++ /tmp/systemd.eclass 2012-08-06 12:57:28.333542735 +0300
8
9 First of all, I'm not really convinced systemd.eclass is a good place
10 for this.
11
12 The main reason for introducing a separate systemd.eclass was to have
13 a single place to control installing systemd unit files. The rule is
14 quite simple here: you install systemd unit files, you inherit
15 the eclass.
16
17 Most importantly, this allows us to easily find out which packages
18 install such files and perform global operations on them. For example,
19 if a particular user had systemd locations in INSTALL_MASK and changed
20 his mind, he can easily update his system by rebuilding all packages
21 inheriting systemd.eclass.
22
23 If all packages installing udev rules start inheriting it, the above
24 will no longer be correct. Also, the opposite way -- rebuilding
25 packages installing udev rules -- won't be that easy.
26
27 That's not my call but I believe that putting those functions in
28 separate udev.eclass could be the best course of action, for the reason
29 stated above -- we can easily find out what installs them, and rebuild
30 it all at once.
31
32 > @@ -25,6 +25,8 @@
33 > # }
34 > # @CODE
35 >
36 > +inherit toolchain-funcs
37 > +
38 > case ${EAPI:-0} in
39 > 0|1|2|3|4) ;;
40 > *) die "${ECLASS}.eclass API in EAPI ${EAPI} not yet
41 > established." @@ -34,6 +36,31 @@
42 > DEPEND="!<sys-apps/systemd-29-r4
43 > !=sys-apps/systemd-37-r1"
44 >
45 > +# @FUNCTION: _systemd_get_udevdir
46 > +# @INTERNAL
47 > +# @DESCRIPTION:
48 > +# Get unprefixed udevdir.
49 > +_systemd_get_udevdir() {
50 > + if $($(tc-getPKG_CONFIG) --exists udev); then
51 > + echo -n "$($(tc-getPKG_CONFIG) --variable=udevdir
52 > udev)"
53
54 Secondly, I believe you shouldn't do such a thing *without* depending
55 on udev. Even though there is fallback here, there is another problem:
56 you are introducing a *potential inconsistency* between built packages,
57 depending on contents of udev.pc. Thus, I believe the package should
58 depend on the package providing it so that the dependency tree is
59 complete.
60
61 Also, I'm not so sure if this will work correctly for Prefix.
62
63 > + else
64 > + echo -n /lib/udev
65 > + fi
66 > +}
67
68 And finally, I believe we shouldn't even be making the install location
69 variable. Right now, the Gentoo location for udev rules is /lib/udev,
70 and I believe William will agree with me on this. We hadn't decided on
71 moving them, and thus all udev and systemd versions in the tree *will*
72 support /lib/udev (I still need to commit patched systemd).
73
74 If we decide to move rules to /usr/lib/udev, I believe we will move
75 them all at once. And then all users will have to use a newer
76 (or patched) udev supporting the new location (or both). In order to
77 enforce that, the eclass would have to block old udev versions (like
78 the systemd.eclass blocks old systemd versions).
79
80 Making the install location dynamic is just asking for trouble.
81 Consider the following: user installs new udev, rebuilds package, then
82 downgrades udev. Package rules no longer work. That's what we would
83 like to avoid.
84
85 > +
86 > +# @FUNCTION: systemd_get_udevdir
87 > +# @DESCRIPTION:
88 > +# Output the path for the udev directory (not including ${D}).
89 > +# This function always succeeds, even if udev is not installed.
90 > +# Dependencies need to include sys-fs/udev or otherwise
91 > +# the fallback return value is /lib/udev.
92 > +systemd_get_udevdir() {
93 > + has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
94 > + debug-print-function ${FUNCNAME} "${@}"
95 > +
96 > + echo -n "${EPREFIX}$(_systemd_get_udevdir)"
97 > +}
98 > +
99 > # @FUNCTION: _systemd_get_unitdir
100 > # @INTERNAL
101 > # @DESCRIPTION:
102
103 As a final note, please note that this is mostly my opinion as systemd
104 maintainer. I believe William has a final word on udev itself.
105
106 --
107 Best regards,
108 Michał Górny

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies