Gentoo Archives: gentoo-dev

From: Alexis Ballier <aballier@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Pre-GLEP RFC: Automated enforcing of REQUIRED_USE constraints
Date: Sat, 08 Jul 2017 14:12:44
Message-Id: 20170708161229.6e1f66dc@gentoo.org
In Reply to: [gentoo-dev] Pre-GLEP RFC: Automated enforcing of REQUIRED_USE constraints by "Michał Górny"
1 On Sat, 08 Jul 2017 11:43:39 +0200
2 Michał Górny <mgorny@g.o> wrote:
3
4 > Hi, everyone.
5 >
6 > I think the affairs have settled enough and I've finished filling
7 > in the pre-GLEP for REQUIRED_USE auto-enforcing. It's got all
8 > the algorithms, rationale and separated reference implementation.
9 >
10 > If there are no major concerns raised, I will soon start working
11 > on writing an optimized implementation for pkgcore/pkgcheck
12 > and integrating the verification algos with the CI.
13 >
14 > The pre-GLEP for review is here:
15 >
16 > https://wiki.gentoo.org/wiki/User:MGorny/GLEP:ReqUse
17
18
19 Constraint group reordering algorithm
20
21 I really think we should only consider REQUIRED_USE with forced/masked
22 useflags instantiated there. And ban (in repoman) REQUIRED_USE that
23 contain some "False": "a? ( b )" with 'a' free and 'b' masked is
24 perfectly ok now but it hides a serious problem in the package/profile.
25 Instantiating this would give: "a? ( False )" and be an error
26 just like we have depend.bad & co. This is independent of auto
27 solving or not, it's already wrong.
28
29 Reordering is a dangerous path as we've already seen since it can
30 create unexpected loops for the solver.
31
32 Working on instantiated REQUIRED_USE constraints would probably
33 simplify quite a bit your GLEP too: you already have the "Verifying
34 that the constraints do not alter immutable flags" part that roughly
35 does the same thing as instantiating, except if you assume it's already
36 true you can skip the reordering.
37
38
39 --------
40
41
42 Concept for transforming REQUIRED_USE into implications
43
44 Ok, now I probably understand better the concept of common prefix. I'm
45 definitely biased here, but I would feel better with a more recursive
46 presentation of it. Assume we have 'validate(list of clauses)';
47 basically, the common prefix idea is that for an implication 'foo?
48 ( consequences = list of clauses )' you first validate the consequences
49 as if it were a REQUIRED_USE (so that the subtree rooted at foo is
50 not self-conflicting) and then consider the whole thing as a clause.
51 The idea would then be to have similar checks as to what you've written
52 but working on trees (ASTs) instead of flattened clauses. This would
53 avoid having to deal with unique identities (these would come for free)
54 and IMHO would be easier to understand.
55 I'm not sure how to do this though, I'll ping you when I have some idea.
56
57 One big advantage of working on ASTs is that it becomes trivial to
58 suggest a proper reordering.
59
60 -------
61
62 Restrictions on REQUIRED_USE format
63
64 I still fail to see the point here. One can simply apply the rewriting
65 you suggest below and be done with it. Rationale is not very convincing
66 to me:
67
68 - avoiding unpredictable results of automatic flag adjustments:
69 A deterministic algorithm is, by definition, predictable.
70 - improving readability of REQUIRED_USE constraints:
71 No need for a restriction for that. If people want to shoot
72 themselves in the foot, it is not a PMS problem. I see that
73 like proposing death penalty for those who commit suicide :)
74 - keeping the specification and implementation relatively simple:
75 You already define everything for working without restriction.
76 Plus, unlimited implication nesting has the same complexity.
77
78 -------
79
80
81 Do you have numbers on the checker run on all inputs from gentoo-x86 ?
82 Since we're dealing with heuristics those are particularly important to
83 validate we're not rejecting too many constructs.
84
85
86 Alexis.

Replies