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: Fri, 02 Jun 2017 11:18:24
Message-Id: 20170602131806.6efc7b0e@gentoo.org
In Reply to: Re: [gentoo-dev] [RFC] Forced/automatic USE flag constraints (codename: ENFORCED_USE) by "Michał Górny"
1 On Fri, 02 Jun 2017 08:37:30 +0200
2 Michał Górny <mgorny@g.o> wrote:
3
4 > On czw, 2017-06-01 at 23:31 +0200, Michał Górny wrote:
5 > > On czw, 2017-06-01 at 10:55 +0200, Alexis Ballier wrote:
6 > > > On Wed, 31 May 2017 21:02:24 +0200
7 > > > Michał Górny <mgorny@g.o> wrote:
8 > > >
9 > > > > On śro, 2017-05-31 at 19:39 +0200, Alexis Ballier wrote:
10 > > > > > > > Again, you *need* to process the constraints in order.
11 > > > > > > > '!a? ( b ) !b? ( a )' is not deterministic when none of a
12 > > > > > > > and b are enabled otherwise.
13 > > > > > >
14 > > > > > > You can't rely on any particular order of constraints,
15 > > > > > > especially when eclass stacking comes into play. You could
16 > > > > > > try defining some constraint- sorting algorithm but it's
17 > > > > > > going to be complex and it's usefulness will be limited
18 > > > > > > anyway due to various kinds of grouping.
19 > > > > >
20 > > > > >
21 > > > > > Better have some order: If half of the above constraint comes
22 > > > > > from ebuild and the other half comes from eclass, then PM
23 > > > > > might toggle 'a' or 'b' depending on the phase of the moon
24 > > > > > which is specifically what we're trying to avoid.
25 > > > >
26 > > > > No, it can't. That's the whole point. The algorithm must be
27 > > > > defined so that it is always predictable independently of order
28 > > > > (maybe except the ordering inside ^^, ||, ??) and independently
29 > > > > of how it's nested (i.e. 'a? ( b? ( c ) )' must give the same
30 > > > > result as 'b? ( a? ( c ) )').
31 > > >
32 > > > This is a lot of handwaving without real description of how it
33 > > > would work. This starts to look a lot like confluence in
34 > > > rewriting systems and you want developers to write only confluent
35 > > > rules and repoman to decide that. Good luck with that.
36 > >
37 > > I'm sorry, what I said was quite stupid. I did some thinking and
38 > > testing today, and the algorithm can be actually quite trivial. The
39 > > real issue is getting a correct input, that is REQUIRED_USE
40 > > constraints that have only one solution.
41
42 Don't be sorry, it's not stupid actually. There are various ways to
43 determinize how the constraints should be solved. Once that is defined,
44 one just needs to apply the rules to the constraints to get a
45 temptative solution, making the algorithm trivial, indeed. Depending on
46 how you do actually determinize the whole thing can make ensuring
47 uniqueness (or even the existence) of a solution quite a pain. That's
48 where the trade-offs between ebuild writers wishes and solving the issue
49 come into play. I see this long thread as a quite interesting
50 discussion where we're trying to converge towards something that leaves
51 the problem easily solvable without asking too much to ebuild writers.
52
53 [...]
54 > > The biggest issue for me right now is to find a way to determine
55 > > whether a particular REQUIRED_USE constraint can have only one
56 > > solution, independently of the order of non-n-ary constraints.
57 > > However, some of it can be easily eyeball-checked using a graph.
58 > >
59 >
60 > Well, I've looked at it more and you were right. While keeping them
61 > order-independent is a noble goal, it's not really feasible,
62 > especially if we assume that n-ary constraints can be reordered. So I
63 > think we can assume left-to-right ordering now (with multiple passes,
64 > if necessary).
65
66
67 There are ways to guarantee order-independence, your gtk+ answer in the
68 previous email suggests one: At most one constraint solving rule can be
69 applied in any situation; that's what you did by putting the ||
70 under !xinerama. This is a quite extreme way to ensure confluence but
71 that works. I've not thought too much about it but I think we'd lose
72 too much in expressivity though.

Replies