Gentoo Archives: gentoo-dev

From: Samuli Suominen <ssuominen@g.o>
To:
Cc: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Re: [gentoo-commits] gentoo-x86 commit in eclass: udev.eclass
Date: Tue, 30 Oct 2012 20:25:05
Message-Id: 5090363C.1090209@gentoo.org
In Reply to: Re: [gentoo-dev] Re: [gentoo-commits] gentoo-x86 commit in eclass: udev.eclass by "Michał Górny"
1 On 30/10/12 22:18, Michał Górny wrote:
2 > On Tue, 30 Oct 2012 17:08:07 -0300
3 > Alexis Ballier <aballier@g.o> wrote:
4 >
5 >> On Tue, 30 Oct 2012 21:57:11 +0200
6 >> Samuli Suominen <ssuominen@g.o> wrote:
7 >>
8 >>> On 30/10/12 21:56, Alexis Ballier wrote:
9 >>>> On Tue, 30 Oct 2012 19:08:39 +0000 (UTC)
10 >>>> "Samuli Suominen (ssuominen)" <ssuominen@g.o> wrote:
11 >>>>
12 >>>> [...]
13 >>>>>
14 >>>>> case ${EAPI:-0} in
15 >>>>> 0|1|2|3|4) ;;
16 >>>>> *) die "${ECLASS}.eclass API in EAPI ${EAPI} not yet
17 >>>>> established." esac
18 >>>>
19 >>>> sounds like a useless and annoying check for just exporting one
20 >>>> function
21 >>>>
22 >>>>>
23 >>>>> RDEPEND=""
24 >>>>
25 >>>> useless?
26 >>>
27 >>> if the ebuild is EAPI=0 or EAPI=1 then DEPEND expands to RDEPEND, so
28 >>> setting empty RDEPEND prevents that, or am I missing something?
29 >>
30 >> even with eclasses and inheritence ? maybe you're right but i wouldnt
31 >> bet anything
32 >>
33 >>>
34 >>>>
35 >>>>> DEPEND="virtual/pkgconfig"
36 >>>>>
37 >>>>> # @FUNCTION: _udev_get_udevdir
38 >>>>> # @INTERNAL
39 >>>>> # @DESCRIPTION:
40 >>>>> # Get unprefixed udevdir.
41 >>>>> _udev_get_udevdir() {
42 >>>>> if $($(tc-getPKG_CONFIG) --exists udev); then
43 >>>>> echo -n "$($(tc-getPKG_CONFIG) --variable=udevdir
44 >>>>> udev)" else
45 >>>>> echo -n /lib/udev
46 >>>>> fi
47 >>>>> }
48 >>>>>
49 >>>>> # @FUNCTION: udev_get_udevdir
50 >>>>> # @DESCRIPTION:
51 >>>>> # Output the path for the udev directory (not including ${D}).
52 >>>>> # This function always succeeds, even if udev is not installed.
53 >>>>> # The fallback value is set to /lib/udev
54 >>>>> udev_get_udevdir() {
55 >>>>> has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
56 >>>>> debug-print-function ${FUNCNAME} "${@}"
57 >>>>>
58 >>>>> echo -n "${EPREFIX}$(_udev_get_udevdir)"
59 >>>>> }
60 >>>>
61 >>>> local foo=""
62 >>>> unfold _udev_get_udevdir there, replacing 'echo -n' by foo=
63 >>>> printf ...$foo
64 >>>>
65 >>>> kill the extra internal fucntion that seems useless.
66 >>>> echo isn't really reliable for precise formatting, prefer printf
67 >>>> when it matters. (in this case it doesn't matter but seems good
68 >>>> practices)
69 >>>>
70 >>>> have you checked what is the udevdir value on prefix, if at all
71 >>>> relevant ? I fear a double prefix issue.
72 >>>>
73 >>>
74 >>> the code is more or less same as systemd.eclass has, I don't want to
75 >>> diverge too much from that since we are essentially dealing with the
76 >>> same package (tarball)
77 >>
78 >> well, two bad do not make a good
79 >> consider the above remarks to apply to systemd.eclass too then, and
80 >> either explain why they're not relevant or apply them to both eclasses
81 >> if you want to avoid divergence.
82 >
83 > Don't even try to touch any of my eclasses without prior asking.
84 >
85 > And the additional internal function there was used in order to get
86 > unprefixed path for do*() and new*() functions.
87 >
88
89 same as i'll propably reuse the function for something like
90 $(do_udev_rules) later on
91
92 the udev.eclass might have one function now, but that's just a
93 rudementary start to drop most of the duplication from ebuilds