Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] The inherit-EXPORT_FUNCTIONS ordering problem
Date: Sat, 28 Aug 2021 16:35:17
Message-Id: a70bd96c15bb351784325e489437debce438224a.camel@gentoo.org
1 Hi,
2
3 I've been informed of a slight inconsistency in package manager behavior
4 that affects combining EXPORT_FUNCTIONS with inherit (by ionic, thanks
5 for the report!). Please consider the three following snippets:
6
7 xdg.eclass:
8
9 EXPORT_FUNCTIONS src_prepare
10
11 ecm-1.eclass:
12
13 inherit xdg
14 EXPORT_FUNCTIONS src_prepare
15
16 ecm-2.eclass:
17
18 EXPORT_FUNCTIONS src_prepare
19 inherit xdg
20
21
22 Now, ecm-1.eclass produces consistent behavior across all PMs --
23 ecm-1_src_prepare takes precedence. However, ecm-2.eclass is not
24 consistent:
25
26 - Portage will take ecm-2_src_prepare, i.e. applies precedence based
27 on inherit order and not actual call order
28
29 - PkgCore and Paludis will take xdg_src_prepare since its
30 EXPORT_FUNCTIONS are called later (since the inherit is done later).
31
32 Apparently, the Portage behavior was changed in 2009 [1]. PMS is not
33 very clear on what should happen.
34
35
36 Therefore:
37
38 1. I'd like to propose that we explicitly require all inherits to happen
39 before EXPORT_FUNCTIONS. This will ensure consistent behavior across
40 all package managers.
41
42 2. I'd like to ask your opinion whether we should:
43
44 a. revert the Portage behavior to be consistent with PkgCore/Paludis
45
46 b. update PMS to identify the behavior as 'undefined', i.e. either
47 solution is correct.
48
49
50 WDYT?
51
52
53 [1] https://github.com/gentoo/portage/commit/06d4433e8b8be60d606733b9e23f57f8a5869d8f
54
55 --
56 Best regards,
57 Michał Górny

Replies