Gentoo Archives: gentoo-dev

From: Chris Reffett <creffett@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] rfc: calling all eclass phase functions by default
Date: Mon, 18 Aug 2014 19:37:36
Message-Id: d2221097-0cdf-42a3-a183-a7ef3e399c8c@email.android.com
In Reply to: Re: [gentoo-dev] rfc: calling all eclass phase functions by default by "Michał Górny"
1 On August 18, 2014 11:11:56 AM EDT, "Michał Górny" <mgorny@g.o> wrote:
2 >Dnia 2014-08-18, o godz. 09:22:46
3 >Chris Reffett <creffett@g.o> napisał(a):
4 >
5 >> On 8/18/2014 8:56 AM, hasufell wrote:
6 >> > Almost forgot, of course this does not work if you expect
7 >> > unpacker_src_unpacker() to run:
8 >> > inherit unpacker games base
9 >> >
10 >> > as well as
11 >> > inherit unpacker base games
12 >> >
13 >> > however
14 >> > inherit games unpacker base
15 >> >
16 >> > will work.
17 >> >
18 >> > And now... guess why the games herd made it a policy to always
19 >inherit
20 >> > games.eclass last. Because of the unpredictability of eclasses and
21 >that
22 >> > they may randomly add exported phase functions. It's a bit
23 >paranoid, but
24 >> > understandable, since we don't have any real rules here.
25 >> >
26 >> > So in the end 3 eclasses all tell you "inherit me last! really!".
27 >Good
28 >> > luck with figuring out how to make a gnome game with python and
29 >multilib
30 >> > support work together. I can predict the days such a review would
31 >take
32 >> > in #gentoo-sunrise. Not less than 3.
33 >> >
34 >> Would it be feasible to add a repoman check for situations like this,
35 >> where the behavior of a phase is dependent on inherit order? If so,
36 >it
37 >> seems reasonable to me to require explicit calls to eclass functions
38 >in
39 >> these cases to make it clear what's being called when.
40 >
41 >Right now, we have no kind of repoman for eclasses. If you have time to
42 >work on such a thing, please do. Otherwise, all we can do is put more
43 >checks in ebuilds but that triggers the warning for the wrong people...
44
45 I was thinking more ebuild-side. Example: my ebuild inherits both cmake-utils and games eclasses, and I don't explicitly define src_compile, repoman full could pop up a warning like "src_compile is ambiguous between cmake-utils_src_compile and games_src_compile, please explicitly define this phase and call the appropriate eclass function." I imagine that this would pop up a lot of warnings, but I feel like it would improve readability and make it explicit what should be going on where. I concede that it could make a lot more boilerplate code in ebuilds, so that's a potential issue, mostly just throwing out an idea here.
46
47 Chris Reffett

Replies