Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Pre-GLEP RFC: Automated enforcing of REQUIRED_USE constraints
Date: Sun, 09 Jul 2017 11:36:35
Message-Id: 1499600176.17500.4.camel@gentoo.org
In Reply to: Re: [gentoo-dev] Pre-GLEP RFC: Automated enforcing of REQUIRED_USE constraints by Alexis Ballier
1 On nie, 2017-07-09 at 11:29 +0200, Alexis Ballier wrote:
2 > You don't seem to get how normalizing and constant
3 > propagation/elimination works.
4 >
5 > Basically, reordering would be:
6 > And(list) -> And( forced(list) + free(list) + masked(list) )
7 > Or(list) -> Or( ... . )
8 > etc.
9 >
10 > While normalizing is:
11 > And(list) -> False if False appears in a normalize(x) for x in list,
12 > True if normalize(x) for x in list is empty or all True,
13 > And(normalize(x) for x in list if != True and != False)
14 > etc.
15 >
16 > That's described in one point: Apply boolean algebra rules.
17
18 Last I checked, implementing a full-fledged boolean algebra processor
19 with reductions and other magic is a non-goal here.
20
21 > What I don't like about reordering is that it is too tightly coupled to
22 > the following solving algorithm and the restricted syntax, while really,
23 > having REQUIRED_USE constraints asking you to enable a masked flag is
24 > something we ought to kill even without solving as they hide broken
25 > deps and make all our QA checks less useful.
26
27 It's irrelevant since we kill the unsupported syntax anyway.
28
29 > Finally, reordering, being essentially a local thing, does not have the
30 > proper behavior in a general AST:
31 > '|| ( ( a b ) c )' with 'a' and 'b' masked will be left invariant by
32 > reordering and the resulting expanded form will be rejected while
33 > constant propagation/elimination will reduce that to 'c' and be good.
34
35 Handling a rejected syntax is irrelevant.
36
37 > Hence, the reordering check cannot be used as a good input for checking
38 > for broken REQUIRED_USE: I really think things like 'vulkan? ( ||
39 > ( video_cards_i965 video_cards_radeonsi ) )' should be a repoman error
40 > on stable profiles where both those video cards are masked and vulkan is
41 > not. For that, we need to support the whole PMS-defined syntax, not a
42 > reduced one.
43
44 No, we don't. It works just fine. The only difference is that it stops
45 on the first erroneous constraint.
46
47 > > No, it is not. You do not have the values of all the items inside
48 > > the group, just some of them. Depending on how many of them do you
49 > > have and what are them, you need to transform the group
50 > > appropriately, e.g. by removing items, replacing the group or failing
51 > > entirely.
52 >
53 > Yes, that's boolean algebra rules. You propagate constants from leaves
54 > to root in the AST and if some 'False' appears in your AST when you've
55 > reached the root you fail. I agree one needs some practice on recursive
56 > structures to understand that quickly and easily though.
57
58 Except that we're dealing with structures which don't strictly follow
59 boolean algebra rules, as you've already noticed.
60
61 > > > > > One big advantage of working on ASTs is that it becomes trivial
62 > > > > > to suggest a proper reordering.
63 > > > >
64 > > > > Reordering is never a trivial problem. Unless I'm missing
65 > > > > something, it is technically possible that a 'reordering' will
66 > > > > actually require a sub- item being moved out of the containing
67 > > > > group.
68 > > >
69 > > > Not if done at the AST level.
70 > > >
71 > > > > And to be honest, I find the output of the verification script in
72 > > > > this regard quite useful. That is, it saying 'X affects Y, so it
73 > > > > needs to go before it' is quite clear to me. I don't think most
74 > > > > developers would actually need to script to pinpoint a specific
75 > > > > location for every single constraint.
76 > > >
77 > > > In most cases this is sufficient.
78 > > > Think of a more complex case:
79 > > > A -> B
80 > > > B -> C
81 > > > A -> D
82 > > > D -> C
83 > > >
84 > > > |-> B -|
85 > > > A -| |->C
86 > > > |-> D -|
87 > > >
88 > > > It's starting to be a more complex mental exercise to get the proper
89 > > > ordering when given the 1st form only.
90 > > >
91 > > >
92 > > > Actually, considering people rant against git merges because they
93 > > > want linear history in the graph log but fail to understand 'git
94 > > > log' is precisely about displaying such a linear ordering, I'm
95 > > > ready to bet someone will rant :)
96 > >
97 > > We can discuss this when you have a working algorithm. Right now, it's
98 > > a purely theoretical exercise unless someone can come up with
99 > > a reasonable way of implementing it.
100 >
101 > Hmmm. lol ?
102 > May I suggest you spend 30 minutes on wikipedia about what topological
103 > sorting is, what it does and what purpose it serves?
104
105 I was referring to doing all the work on AST level, especially detecting
106 problems.
107
108 > It's a bit annoying to see you completely lost every time it comes up.
109
110 I find almost every your mail annoying because of your inability to
111 focus outside one thing you've convinced yourself is the only solution
112 to every problem that ever comes, and to accept that there could be
113 alternative solutions that would work as well.
114
115 But that's completely irrelevant to the topic at hand and I don't see
116 how pointing out how every one of us is irritating is going to help
117 solve anything.
118
119 > > Except it doesn't because it's extremely uncommon (and even unlikely)
120 > > and I am successfully exterminating the last occurrences. Implementing
121 > > support for something that will be never used is a waste of time.
122 >
123 > Except you're already wasting your time exterminating some cases for
124 > which support is already written. You still don't know whether your
125 > restricted syntax will be accepted in PMS (which mostly depends if
126 > people feel comfortable with its expressivity), so you don't know if
127 > you won't have to plug support for it later. May I remind you the
128 > numbers I ran? Among all the rejected "too complex" usages of requse,
129 > only *1* could have led to an invalid solution by the solver.
130
131 May I remind you the numbers that are in the GLEP? Every single case
132 could have been expressed in a more readable way using a much simpler
133 syntax. The developers approached about that agreed with it.
134
135 I really don't like the idea of arguing on the basis of 'someone may
136 figure out some really complex case to prove you wrong one day'. People
137 weren't able to come up with a good use case for 6.5yr. What makes you
138 believe they will suddenly need it now?
139
140 > > > > > - keeping the specification and implementation relatively
141 > > > > > simple: You already define everything for working without
142 > > > > > restriction. Plus, unlimited implication nesting has the same
143 > > > > > complexity.
144 > > > >
145 > > > > No, I don't. I don't cover the meaning of nested groups and things
146 > > > > just explode when they come into game.
147 > > >
148 > > >
149 > > > You mostly do with the rewriting part, you're only refusing to admit
150 > > > it :)
151 > >
152 > > You mean the transform? It doesn't cover the possibility of those
153 > > groups containing anything but plain flags. As we've already
154 > > established, the results become non-trivial when they do and those
155 > > cases are certainly not covered here.
156 >
157 > That's why I said mostly. The missing parts are really small, trust me.
158 >
159
160 It's funny how you insist on claiming your ideas to be 'small'. Yet my
161 implementation takes a single 23-line function and yours takes around 10
162 times that much, not counting all the out-of-place alterations you have
163 done which I don't really consider even worth counting.
164
165 Oh, and my code is more readable and easier to comprehend.
166
167 If you really want to true, then please argue with real arguments
168 and not run-around theory.
169
170 --
171 Best regards,
172 Michał Górny

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies