Gentoo Archives: gentoo-dev

From: Alexis Ballier <aballier@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [RFC] Forced/automatic USE flag constraints (codename: ENFORCED_USE)
Date: Tue, 30 May 2017 15:34:04
Message-Id: 20170530173340.0b575526@gentoo.org
In Reply to: Re: [gentoo-dev] [RFC] Forced/automatic USE flag constraints (codename: ENFORCED_USE) by "Michał Górny"
1 On Tue, 30 May 2017 16:33:32 +0200
2 Michał Górny <mgorny@g.o> wrote:
3
4 [...]
5 > The problem is: how far is that going to work? That's what I would
6 > like to try determining in the first place.
7 >
8 > I'm most worried about complex constructs like:
9 >
10 > foo? ( bar ) ^^ ( baz bar )
11
12 The order in which it is written will matter:
13 Assuming user has enabled 'foo', first process 'foo? ( bar )', which
14 gives you "USE='foo bar'". Then process '^^ ( baz bar )'; all good,
15 we're done.
16
17 If user has enabled 'foo baz' then there is a problem and it is
18 normal to rant.
19
20 > But I do not have any obvious ideas how to express them safely while
21 > preserving readability and relative simplicity of the constructs, i.e.
22 > not having to write a big mapping table.
23 >
24 > Especially if we are to allow having a preference on baz, the mapping
25 > for ^^ alone would be:
26 >
27 > !bar !baz -> !bar baz
28 > bar !baz -> bar !baz [valid]
29 > !bar baz -> !bar baz [valid]
30 > bar baz -> !bar baz
31 >
32 > With the additional foo constraint, it becomes harder but not
33 > impossible. However, with more constraints we may reach a dead end.
34
35 You already made a convincing argument that || & co are good things to
36 have, that's not to write the combinatorics of the whole thing as
37 implications!
38
39 Moreover, you can use implications and the processing order as hints: If
40 you believe 'if foo and bar are enabled then baz should most likely be
41 enabled even if the latter '|| ( bay baz )' would select 'bay' and not
42 'baz'' you prepend required_use by 'foo? bar? baz' and are done with it.
43
44
45 > Of course, we could just validate all the possible cases via repoman,
46 > and reject the ebuild if there's at least one conflict between them.
47 > Not sure how to express that properly in the spec though. Not sure
48 > how it would work practically.
49
50 Adding a 2^n check to repoman isn't gonna work well.
51
52
53 [...]

Replies