Gentoo Archives: gentoo-dev

From: William Hubbs <williamh@g.o>
To: gentoo-dev@l.g.o
Cc: mgorny@g.o
Subject: Re: [gentoo-dev] rfc: calling all eclass phase functions by default
Date: Sat, 16 Aug 2014 23:30:46
Message-Id: 20140816233030.GB11181@linux1
In Reply to: Re: [gentoo-dev] rfc: calling all eclass phase functions by default by "Michał Górny"
1 On Sun, Aug 17, 2014 at 12:54:17AM +0200, Michał Górny wrote:
2 > Dnia 2014-08-16, o godz. 16:54:28
3 > William Hubbs <williamh@g.o> napisał(a):
4 >
5 > > The initial proposal is to change this behaviour so that the PMS default
6 > > phase functions call all matching phase functions from inherited
7 > > eclasses in sequence.
8 > >
9 > > For example:
10 > >
11 > > - your ebuild inherits foo and bar and each of them have src_unpack
12 > > functions. With this new behaviour, the default src_unpack would run
13 > > foo_src_unpack, bar_src_unpack, then perform its own actions.
14 >
15 > Why doesn't it call default_src_unpack too?
16
17 In the original proposal, the loop that ran foo_src_unpack,
18 bar_src_unpack, etc would be part of default_src_unpack.
19
20 > > I strongly oppose this change, because I feel it will make our
21 > > entire tree very unpredictable at best. I realize this might eliminate
22 > > boilerplating from our tree. Weighing that against the possible
23 > > ramifications in this big of a change in automagic behaviour, I think
24 > > the cost is much higher than the gain.
25 >
26 > 'Unpredictable' is very lightly said. 'Complete mayhem' seems much more
27 > appropriate.
28 >
29 > Right now, finding proper phase functions may be a bit hard due to
30 > indirect inherits. Imagine all the fun of debugging phase functions
31 > when every single indirect inherits adds to the stack. I don't want
32 > even to discuss the issue of ordering them all.
33
34 Agreed. It definitely would be a mess.
35
36 > > I am also not very comfortable with our current state, because it has
37 > > a lot of uncertainty in terms of how the eclass phase functions are
38 > > called.
39 >
40 > That is not really a problem of PMS behavior but a problem with
41 > the eclasses. If eclasses were done at least semi-reasonably, you
42 > would be able to easily guess which phase functions are exported by
43 > which eclass.
44
45 I'm all ears as they say; feel free to start a new thread on redesigning
46 our eclasses. I have no idea how they could be done differently
47 to make this easier.
48
49 >
50 > > My counter proposal to this is that we stop calling eclass phase
51 > > functions automatically, and to minimize the amount of boilerplating
52 > > we would have to do, we use a variable, such as ECLASS_PHASES which
53 > > would be defined at the ebuild level and contain a list of the eclass
54 > > phase functions we want to run automatically.
55 > >
56 > > Going back to my previous example, say your ebuild does the following:
57 > >
58 > > -- code begins here --
59 > >
60 > > inherit foo bar
61 > >
62 > > # Foo and bar both have src_unpack and src_install functions.
63 > > # we want foo's src_unpack and bar's src_install:
64 > >
65 > > ECLASS_PHASES="foo_src_unpack
66 > > bar_src_install"
67 > >
68 > > -- code ends here ---
69 >
70 > And how is this exactly different than:
71 >
72 > src_unpack() { foo_src_unpack; }
73 > src_install() { bar_src_install; }
74 >
75 > forced by your previous idea? As I see it, it's just a redundant way of
76 > doing the same thing. A few bytes shorter maybe, at the cost of having
77 > to control and consider another variable.
78
79 I'm not arguing that either.
80
81 > What happens if ebuild specifies both ECLASS_PHASES="foo_src_unpack"
82 > and explicit src_unpack()?
83
84 The src_unpack() in the ebuild wins.
85
86 > That said, I suggest you focus your efforts on solving the real issue
87 > -- that is, fixing the eclasses -- rather than trying to shoehorn
88 > an ugly workaround into PMS.
89
90 Like I said above, I'm all ears; start a new thread about how the eclasses
91 can be fixed.
92
93 William

Attachments

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