Gentoo Archives: gentoo-dev

From: James Le Cuirot <chewi@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [PATCH 1/4] xdg-utils.eclass: make EAPI 7 ready
Date: Thu, 21 Jun 2018 09:00:52
Message-Id: 20180621100034.4a45edf3@red.yakaraplc.local
In Reply to: Re: [gentoo-dev] [PATCH 1/4] xdg-utils.eclass: make EAPI 7 ready by "Marty E. Plummer"
1 On Wed, 20 Jun 2018 22:09:21 -0500
2 "Marty E. Plummer" <hanetzer@×××××××××.com> wrote:
3
4 > On Thu, Jun 21, 2018 at 03:41:02AM +0100, M. J. Everitt wrote:
5 > > On 21/06/18 03:38, Jason Zaman wrote:
6 > > > On Wed, Jun 20, 2018 at 06:01:10PM -0500, Marty E. Plummer
7 > > > wrote:
8 > > >> On Wed, Jun 20, 2018 at 11:33:53PM +0100, James Le Cuirot
9 > > >> wrote:
10 > > >>> On Wed, 20 Jun 2018 17:21:09 -0500
11 > > >>> "Marty E. Plummer" <hanetzer@×××××××××.com> wrote:
12 > > >>>
13 > > >>>> On Wed, Jun 20, 2018 at 09:03:44PM +0800, Jason Zaman wrote:
14 > > >>>>> On Wed, Jun 20, 2018 at 02:10:50AM -0500, Marty E. Plummer
15 > > >>>>> wrote:
16 > > >>>>>> Use ${EROOT%/} whereever possible, as the tools and
17 > > >>>>>> directories which are used with it are already prefixed with
18 > > >>>>>> a /
19 > > >>>>>>
20 > > >>>>>> Package-Manager: Portage-2.3.40, Repoman-2.3.9
21 > > >>>>>> ---
22 > > >>>>>> eclass/xdg-utils.eclass | 10 +++++-----
23 > > >>>>>> 1 file changed, 5 insertions(+), 5 deletions(-)
24 > > >>>>>>
25 > > >>>>>> diff --git a/eclass/xdg-utils.eclass
26 > > >>>>>> b/eclass/xdg-utils.eclass index ac075185d8e..8dba5ed6861
27 > > >>>>>> 100644 --- a/eclass/xdg-utils.eclass
28 > > >>>>>> +++ b/eclass/xdg-utils.eclass
29 > > >>>>>> @@ -66,7 +66,7 @@ xdg_environment_reset() {
30 > > >>>>>> # Updates the .desktop files database.
31 > > >>>>>> # Generates a list of mimetypes linked to applications that
32 > > >>>>>> can handle them xdg_desktop_database_update() {
33 > > >>>>>> - local
34 > > >>>>>> updater="${EROOT}${DESKTOP_DATABASE_UPDATE_BIN}"
35 > > >>>>>> + local
36 > > >>>>>> updater="${EROOT%/}${DESKTOP_DATABASE_UPDATE_BIN}"
37 > > >>>>> Shouldn't things like this be $BROOT since they're being run?
38 > > >>>>> $EROOT might be a different architecture that may or may not
39 > > >>>>> run at all on the build machine.
40 > > >>>>>
41 > > >>>> Good point, but here's a question; if
42 > > >>>> EROOT=${ROOT%/}${EPREFIX}, how do we use BROOT here? EBROOT?
43 > > >>>> Or longhand ${BROOT%/}${EPREFIX} ? I think that may be a use
44 > > >>>> case that got missed in the EAPI 7 discussions.
45 > > >>> BROOT is already prefixed as BROOT without a prefix would just
46 > > >>> be /.
47 > > >> I don't follow. Its my understanding that BROOT ~= ROOT for most
48 > > >> situations. But consider this setup:
49 > > >> Ubuntu amd64 with Gentoo Prefix, emerging a native arm @system to
50 > > >> /mnt/arm EPREFIX = /home/user/gentoo.
51 > > >>
52 > > >> In this situation, ROOT=/mnt/arm, EROOT=/mnt/arm, but what is
53 > > >> BROOT? /, or /home/usr/gentoo?
54 > > > https://dev.gentoo.org/~mgorny/articles/the-ultimate-guide-to-eapi-7.html#broot-variable-for-bdepend
55 > > >
56 > > > Basically BROOT already contains EPREFIX or BPREFIX or whatever
57 > > > it would be called. There is like no need for an un-prefixed
58 > > > BROOT so its just merged in. so you should just need
59 > > > "${BROOT}/usr/bin/update-mime-database"
60 > > >
61 > > Obligatory n00b question .. how does this work in EAPI <= 6 ?! :D
62 > >
63 > I would guess something like has eapi 7 || ROOT = BROOT or whatever.
64 > Use BROOT by default and if the EAPI doesn't support it set ROOT to
65 > BROOT or somat.
66
67 There was no variable for BROOT before EAPI 7, that's why we created
68 one! There was an internal Portage variable called
69 PORTAGE_OVERRIDE_EPREFIX, which is basically what BROOT gets set to now
70 but you should not use this in an eclass. I guess the safest fallback
71 would be EPREFIX. This would be technically wrong for cross-prefix
72 builds but unlikely to cause a problem in practise. Don't do
73 ${BROOT-${EPREFIX}} though because BROOT is usually empty anyway.
74
75 --
76 James Le Cuirot (chewi)
77 Gentoo Linux Developer