Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] The inherit-EXPORT_FUNCTIONS ordering problem
Date: Sun, 29 Aug 2021 18:44:58
Message-Id: 0993c999ca128c34a3d13803ca097d043085262a.camel@gentoo.org
In Reply to: Re: [gentoo-dev] The inherit-EXPORT_FUNCTIONS ordering problem by Ionen Wolkens
1 On Sun, 2021-08-29 at 14:41 -0400, Ionen Wolkens wrote:
2 > On Sun, Aug 29, 2021 at 12:23:22PM -0500, William Hubbs wrote:
3 > > On Sat, Aug 28, 2021 at 06:35:06PM +0200, Michał Górny wrote:
4 > > > Hi,
5 > > >
6 > > > I've been informed of a slight inconsistency in package manager behavior
7 > > > that affects combining EXPORT_FUNCTIONS with inherit (by ionic, thanks
8 > > > for the report!). Please consider the three following snippets:
9 > >
10 > > ...
11 > >
12 > > > 1. I'd like to propose that we explicitly require all inherits to happen
13 > > > before EXPORT_FUNCTIONS. This will ensure consistent behavior across
14 > > > all package managers.
15 > > >
16 > > > 2. I'd like to ask your opinion whether we should:
17 > > >
18 > > > a. revert the Portage behavior to be consistent with PkgCore/Paludis
19 > > >
20 > > > b. update PMS to identify the behavior as 'undefined', i.e. either
21 > > > solution is correct.
22 > >
23 > > I would go with 1 and 2 b, but I also propose another option for the
24 > > next eapi which may be a bit controversial.
25 > >
26 > > Starting with eapi 9, make export_functions a noop (you can't remove it
27 > > until all eclasses/ebuilds only support eapis that don't require it).
28 > >
29 > > I understand that this is controversial, because it would require a lot
30 > > of work to convert ebuilds to eapi 9, but it would eliminate this
31 > > ambiguity/inconsistency in the future because it would require all
32 > > ebuilds to have phase functions unless they can use the default phases
33 > > the eapis provide.
34 > >
35 > > Thoughts?
36 >
37 > If anything I'd personally prefer the rough opposite of this, in the
38 > event multiple eclass export the same, have the package manager merge
39 > them.
40 >
41 > e.g. rather than have `inherit cmake xdg` run xdg_src_prepare over
42 > cmake's, would export:
43 >
44 > src_prepare() {
45 > cmake_src_prepare
46 > xdg_src_prepare
47 > }
48 >
49 > unless the ebuild redefines it (which I imagine would often be because
50 > of optional support, e.g. use lua &&, or occasional incompatibilities)
51 >
52 > Some ebuilds have special needs, but then there's all those generic
53 > ebuilds that should stay nearly empty.
54
55 What about transitive inherits? Say, foo.eclass inherits bar.eclass.
56 Does that imply that the ebuild calls foo_src_prepare
57 and bar_src_prepare, and the eclass has no way of overriding this? What
58 if the eclass needs bar_src_prepare called explicitly before or after
59 its own src_prepare?
60
61 --
62 Best regards,
63 Michał Górny

Replies