1 |
On Thu, 01 Jun 2017 23:31:25 +0200 |
2 |
Michał Górny <mgorny@g.o> wrote: |
3 |
[...] |
4 |
> > There are probably dozens of ways to make that non deterministic. |
5 |
> > Here's one: USE='-*'. Apply '|| ( cli cgi fpm apache2 embed phpdbg |
6 |
> > )' last; this enables 'cli'. Since it's the last one, REQUIRED_USE |
7 |
> > is not satisfied because of 'cli? ( ^^ ( readline libedit ) )'. |
8 |
> > If you process it first, then you enable cli and readline and are |
9 |
> > good. |
10 |
> |
11 |
> You just take a second iteration, and things fall into place. That's |
12 |
> not a problem. |
13 |
> |
14 |
> > > > Also, what happens if we applied all the constraints and |
15 |
> > > > obtained some useflags setting that still fails REQUIRED_USE |
16 |
> > > > check ? |
17 |
> > > |
18 |
> > > It can't happen. If you can apply all the constraints, then |
19 |
> > > implicitly REQUIRED_USE is satisfied. If you can't apply all the |
20 |
> > > constraints, then it just fails. Of course, we want to ultimately |
21 |
> > > avoid that case. |
22 |
> > |
23 |
> > See the php example above. How do you ensure this does not happen? |
24 |
> > |
25 |
> > Note that your assertion 'If you can apply all the constraints, then |
26 |
> > implicitly REQUIRED_USE is satisfied.' is false: You're changing the |
27 |
> > values of useflags, thus might violate some previously checked |
28 |
> > constraint. |
29 |
> |
30 |
> So you reiterate. Either you reach a solution (preferably there's only |
31 |
> a single valid solution you can reach) or you hit a previous state |
32 |
> which indicates a loop and you fail. |
33 |
|
34 |
|
35 |
So, PM, for every ebuild, will need to store the (at most) 2^n states it |
36 |
has already seen while trying to solve REQUIRED_USE and iterate until |
37 |
it cannot proceed anymore or falls into a previous state (so that's 2^n |
38 |
time too). That way we go from a linear time & linear space algorithm |
39 |
to one in exponential time & space. That's probably not a good idea. |
40 |
|
41 |
I think it's better to limit the number of iterations to some constant. |
42 |
I'd say 1, then fail if REQUIRED_USE is still not satisfied. Maybe 2 or |
43 |
3 can be useful but I think it'd be much harder to provide automated |
44 |
checks for that and much harder for ebuild writers to understand what |
45 |
will happen with the REQUIRED_USE they're about to write. |
46 |
|
47 |
[...] |
48 |
|
49 |
Alexis. |