Gentoo Archives: gentoo-dev

From: Mike Gilbert <floppym@g.o>
To: Gentoo Dev <gentoo-dev@l.g.o>
Subject: Re: [gentoo-dev] [PATCH] ebuild-writing/variables: better describe ROOT
Date: Wed, 11 May 2016 01:42:52
Message-Id: CAJ0EP402GCmsgtKz31vYrcW09W-2Z=5B2eYPp_MYX1dwUupEpA@mail.gmail.com
In Reply to: Re: [gentoo-dev] [PATCH] ebuild-writing/variables: better describe ROOT by Michael Orlitzky
1 On Tue, May 10, 2016 at 5:25 PM, Michael Orlitzky <mjo@g.o> wrote:
2 > On 05/10/2016 02:28 PM, Mike Gilbert wrote:
3 >> On Tue, May 10, 2016 at 11:08 AM, Michael Orlitzky <mjo@g.o> wrote:
4 >>> We have maybe 150 ebuilds in the tree using $ROOT in src_* functions.
5 >>> Some are bugs, but many look OK to me. Do we really want to say "never"
6 >>> do that?
7 >>
8 >> According to PMS, it is only legal in pkg functions.
9 >>
10 >> Can you point to an example where using ROOT in a src function is appropriate?
11 >>
12 >
13 > Modulo the question "when should you use $ROOT over $EPREFIX"...
14 >
15 > * the chrome-binary-plugins ebuilds use it in src_install.
16
17 This is quite obviously wrong. I happen to maintain that ebuild, so I
18 just fixed.
19
20 > * dmraid does
21 >
22 > einfo "Appending pkg.m4 from system to aclocal.m4"
23 > cat "${ROOT}"/usr/share/aclocal/pkg.m4 >>"${S}"/aclocal.m4 || \
24 > die "Could not append pkg.m4
25
26 This should be one of two things:
27
28 cat /usr/share/aclocal/pkg.m4
29
30 Or, if prefix support is desired:
31
32 cat "${EPREFIX}"/usr/share/aclocal/pkg.m4
33
34 > Both of those look like EPREFIX candidates to me, but they're not
35 > obviously wrong, either. Maybe it made sense in EAPI <= 3.
36 >
37 > Anywhere that you need addpredict() it also seems reasonable. The
38 > v4l-dvb-saa716x ebuilds use "${ROOT}/usr/src/linux/" where EPREFIX would
39 > not be a good replacement.
40
41 Nah, usually addpredict is dealing with stuff in the system that is
42 performing the build. Sandboxed phases should never be looking at
43 ROOT.
44
45 Those ebuilds should probably do addpredict /usr/src/linux instead.
46
47 >
48 > Something needs to be fixed, though: you're right that the PMS limits
49 > ROOT to pkg_*. Who knew? If we want to be serious about banning ROOT in
50 > src_*, we should add a repoman error.
51
52 Based on my own understanding of the ROOT variable, its use in src
53 functions is always nonsensical, especially when you consider binpkgs.
54 A binpkg can be installed with a ROOT value that is completely
55 different from its value when the package is being compiled.
56
57 To put it another way, in src functions, ROOT could/should always be
58 "/". The real value of ROOT isn't determined until merge time.
59
60 I agree, repoman should be catching this stuff.

Replies