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: Sun, 04 Jun 2017 08:59:53
Message-Id: 20170604105938.2b40157f@gentoo.org
In Reply to: Re: [gentoo-dev] [RFC] Forced/automatic USE flag constraints (codename: ENFORCED_USE) by Alexis Ballier
1 Here's a quick n dirty code to play with, based on yours:
2 https://github.com/aballier/required-use
3
4 On Sat, 3 Jun 2017 18:58:35 +0200
5 Alexis Ballier <aballier@g.o> wrote:
6
7 > > 1. ^^ ( pst1 pst2 pst3.. ) pst1? ( pt1 ) pst2? ( pt2 ) pst3? ( pt3
8 > > )..
9
10 $ python3 ./nsolve.py '^^ ( pst1 pst2 pst3 ) pst1? ( pt1 ) pst2? ( pt2
11 ) pst3? ( pt3 )'
12
13 [[!pst1, !pst2, !pst3]? => [pst1], [pst1]? => [!pst2],
14 [pst1]? => [!pst3], [!pst1, pst2]? => [!pst3], [pst1]? => [pt1],
15 [pst2]? => [pt2], [pst3]? => [pt3]]
16
17
18 > > 2. ^^ ( pst1 pst2.. ) pst1? ( pt1 ) pst2? ( pt2 ).. ^^ ( pt1 pt2 )
19
20
21
22 $ python3 ./nsolve.py '^^ ( pst1 pst2 ) pst1? ( pt1 ) pst2? ( pt2 ) ^^
23 ( pt1 pt2 )'
24
25 [[!pst1, !pst2]? => [pst1], [pst1]? => [!pst2], [pst1]? => [pt1],
26 [pst2]? => [pt2], [!pt1, !pt2]? => [pt1], [pt1]? => [!pt2]]
27
28 [[pt1]? => [!pt2]] can break [[pst2]? => [pt2]]
29
30
31 > ^^ ( pst1 pst2.. ) pst1? ( pt1 !pt2 ... ) pst2? ( !pt1 pt2 ... )..
32
33 $ python3 ./nsolve.py '^^ ( pst1 pst2 ) pst1? ( pt1 !pt2 ) pst2? ( !pt1
34 pt2 )'
35
36 [[!pst1, !pst2]? => [pst1], [pst1]? => [!pst2], [pst1]? => [pt1],
37 [pst1]? => [!pt2], [pst2]? => [!pt1], [pst2]? => [pt2]]
38
39 [[pst2]? => [!pt1]] can break [[pst1]? => [pt1]]
40 [[pst2]? => [pt2]] can break [[pst1]? => [!pt2]]
41
42 > pst1? ( pt1 !pt2 ... )
43 > pst2? ( !pt1? ( pt2 !pt3 ... ) )
44 > pst3? ( !pt1? ( !pt2? ( pt3 !pt4 ... ) ) )
45
46 $ python3 ./nsolve.py '^^ ( pst1 pst2 ) pst1? ( pt1 !pt2 ) pst2?
47 ( !pst1? ( !pt1 pt2 ) )'
48
49 [[!pst1, !pst2]? => [pst1], [pst1]? => [!pst2], [pst1]? => [pt1],
50 [pst1]? => [!pt2], [pst2, !pst1]? => [!pt1], [pst2, !pst1]? => [pt2]]
51
52
53 All good.
54
55
56 > > 3. doc? ( || ( pt3 pt4 ) ) || ( pt1 pt2 pt3 pt4 )
57
58 $ python3 ./nsolve.py 'doc? ( || ( pt3 pt4 ) ) || ( pt1 pt2 pt3 pt4 )'
59 [[doc, !pt3, !pt4]? => [pt3], [!pt1, !pt2, !pt3, !pt4]? => [pt1]]
60
61
62
63
64 Note: the code only reports errors if a clause can break another clause
65 left to it. It doesn't do topological sorting nor cycle reporting yet.
66
67 Alexis.

Replies