Gentoo Archives: gentoo-dev

From: konsolebox <konsolebox@×××××.com>
To: "Michał Górny" <mgorny@g.o>
Cc: gentoo-dev@l.g.o, pms-bugs@g.o
Subject: Re: [gentoo-dev] RFC: Future EAPI version operator changes
Date: Wed, 09 Nov 2016 06:33:23
Message-Id: CAJnmqwYr-B-8fEiUehZbFN+eYybBj_h-naVKETKXssOoHACgdA@mail.gmail.com
In Reply to: Re: [gentoo-dev] RFC: Future EAPI version operator changes by "Michał Górny"
1 On Tue, Nov 8, 2016 at 6:39 PM, Michał Górny <mgorny@g.o> wrote:
2 > Dnia 8 listopada 2016 09:17:11 CET, konsolebox <konsolebox@×××××.com> napisał(a):
3 >>On Tue, Nov 8, 2016 at 3:09 PM, konsolebox <konsolebox@×××××.com>
4 >>wrote:
5 >>> On Sun, Nov 6, 2016 at 6:52 PM, Michał Górny <mgorny@g.o>
6 >>wrote:
7 >>>> Hi, everyone.
8 >>>>
9 >>>> Following my previous RFC wrt version operator problems, I'd like to
10 >>>> start the second part of the discussion: how to improve version
11 >>>> operators in a Future EAPI?
12 >>>>
13 >>>> I've collected various ideas on operator changes on a wiki page [1].
14 >>>> I've tried to stay open-minded and cover every possibility, even
15 >>though
16 >>>> I doubt some of them would be even considered.
17 >>>>
18 >>>> I should warn you that some of the solutions are interlinked to each
19 >>>> other, and you probably need to look through the whole page first
20 >>>> before starting to construct an opinion. For example, specific
21 >>>> solutions to most of the problems depend on whether we enable
22 >>version
23 >>>> ranges and in which form.
24 >>>>
25 >>>> I think we should start by loosely discussing the various ideas
26 >>>> on the wiki page. Feel free to also point out any missing ideas
27 >>>> or remarks that would be useful there.
28 >>>>
29 >>>> So, what are your comments?
30 >>>>
31 >>>> [1]:https://wiki.gentoo.org/wiki/Future_EAPI/Version_syntax_changes
32 >>>>
33 >>>> --
34 >>>> Best regards,
35 >>>> Michał Górny
36 >>>> <http://dev.gentoo.org/~mgorny/>
37 >>>
38 >>> I also like the idea of moving the operator as it's more consistent
39 >>> and opens new doors to other solutions.
40 >>>
41 >>> As for the use of operator & and |, they're quite good, but I'd
42 >>prefer
43 >>> the use of Gmail's style where expressions placed in () are processed
44 >>> with AND, and expressions placed inside {} are processed with OR:
45 >>>
46 >>> dev-foo/bar[>=1.3&<1.5] dev-foo/bar(>=1.3 <1.5)
47 >>> dev-foo/bar[>=1.3&<1.5&!=1.4.1] dev-foo/bar(>=1.3 <1.5
48 >>!=1.4.1)
49 >>> dev-foo/bar[<1.1|>=1.5] dev-foo/bar{<1.1 >=1.5}
50 >>> dev-foo/bar[=1.1*|=1.3*|>=1.5] dev-foo/bar{=1.1* =1.3* >=1.5}
51 >>>
52 >>> I find it more readable. The former looks too compressed.
53 >>
54 >>I should also add that we can allow slots and repositories in the
55 >>expressions:
56 >>
57 >>dev-foo/bar{:1.3 :1.4 :1.5} ## Solves "A. Range dependencies vs
58 >>slotting"
59 >
60 > I'm not sure about this. Slots are kinda special, especially with regard to slot operators. Problems I see:
61 >
62 > 1. := binds to slot of newest version matching the spec. How does this work with your spec?
63 >
64 > 2. Should we allow using := on some of the listed slots? What would happen?
65 >
66 > 3. It's asymmetric since we can't use an AND variant.
67
68 I had to ask help from #gentoo-dev-help in order to properly
69 understand slot operators since I haven't become too familiar with
70 them so sorry for the late reply. (Thanks to desultory and _AxS_).
71
72 Here I find it that we could just follow the simple AND/OR rule
73 against every condition from left to right, and the interpreter would
74 just do fine. A user may create insensible rules just like how one
75 could create meaningless codes in C, but that won't stop the compiler
76 from compiling the code, just like how this would not prevent the
77 package manager from interpreting it. We're also free to detect
78 ambiguous rules if we want to, and warn the user, or just disallow it
79 completely. But it's still optional and wouldn't yield a difference
80 to a stable operation.
81
82 Examples:
83
84 dev-foo/bar:={:1.3= :1.4= :1.5=} OR dev-foo/bar(:= {:1.3= :1.4=
85 :1.5=}) renders := being an "any" operator meaningless since the
86 condition requires {:1.3= :1.4= :1.5=} to also be true. It looks
87 insensible, but it's still algorithmically correct, and can be
88 interpreted by the package manager.
89
90 dev-foo/bar(:* :=) renders :* meaningless since := restricts any
91 installed runtime dependency's slot and subslot to be currently
92 available. It's still algorithmically correct.
93
94 dev-foo/bar{:* :=} renders := meaningless since :* would already be
95 true, if it becomes false, := would still be false anyway. But it's
96 still algorithmically correct. In many ways, the rule doesn't make
97 sense at all since virtually is just boils down to be just about
98 dev-foo/bar, but it's not an issue that would stop the implementation
99 of the interpreter. And, it's also not something that would
100 jeopardize how the package manager operates.
101
102 dev-foo/bar:={:1.3 :1.4 :1.5} OR dev-foo/bar(:= {:1.3 :1.4 :1.5})
103 implies that the currently installed package's slot and subslot should
104 be available and that the version of the slot should be 1.3, 1.4, or
105 1.5. The interpreter could read that condition checking from left to
106 right easily. Is the currently installed package's slot and subslot
107 currently available? If no, this condition renders false and the
108 currently installed package is invalid. If yes, we follow the next
109 condition. Is the slot version any of 1.3, 1.4, or 1.5? If yes, then
110 that condition yields true.
111
112 If this condition fails with the currently installed package, we then
113 check it against the available packages where the meaning of the =
114 operator is ignored to see if we can do a rebuild.
115
116 > 4. Do we allow different ranges per slots?
117
118 Seems possible like {:>=1.3 :<=1.5}. Comparing subslots is also just
119 about grouping where in x/y, x is the major and y is the minor. Major
120 versions are compared first, and minor versions are only compared if
121 major versions are equal.
122
123 I hope I understand you correctly.
124
125 If you're talking about combining ranges of versions with slots, then
126 yes it's possible. You just check every condition independently.
127 It's pretty simple.
128
129 > How do we combine various order of data?
130
131 I need specific example/detail on that, or perhaps I already have that
132 answered above.
133
134 >>dev-foo/bar(:1.6 {::local ::devel}) ## Especially useful in
135 >>/etc/portage/package.{keywords,mask}
136 >
137 > Repository deps are not covered by PMS, so that's out of scope. Though if the other lands,I see no problem with Portage implementing this one as well.
138
139 And if we allow every type of condition to be independent, it would
140 make things easier for everybody.
141
142 >
143 >>
144 >>Along with it, we should also drop the strict order of the slot,
145 >>version, and repo expressions (just change it to "recommended"). It
146 >>makes things more flexible and makes it easier for the parser to be
147 >>implemented.
148 >
149 > Problems:
150 >
151 > 1. This could result in fairly ambiguous variants with some syntaxes purposes.
152
153 I think that would only apply to older versions of Portage that would
154 not recognize loose arrangement of conditions. Can you give a
155 specific variant where would this become an issue?
156
157 > 2. This makes 'simple validation' harder. Strict order makes it possible to write a simple regular expression that validates that are elements are in place and correct, and are not repeated.
158
159 It's quite the opposite.
160
161 Before that 'simple validation', parsing would come first (unless
162 parsing comes along with (the only) validation itself), and parsing
163 itself [with/without the validation] has already become difficult due
164 to many conditions that one should come or could come before/after
165 another. If every condition would just be elements with different
166 classes, it would be easier to do a validation. You'll just need a
167 single loop with case statements for that, rather than have a tree of
168 if conditions.
169
170 If there's another validation stage that's necessary to do after
171 parsing, the same holds true for it: just one single loop, and no
172 check if an element follows one after another. Checking whether stuff
173 are repeated is still doable (if it still becomes necessary).
174
175 I also hope you're not after grep-ability. If not, just ignore this.
176 Grep/regex scanning itself is slow, and is a bit of a hack to me,
177 especially if it's used in parsing. Not that I'm saying it's a bad
178 solution for doing validations, but it shouldn't be something to rely
179 upon when judging this.
180
181 > 3. Do we allow multiple occurrences of the same type of element? I'm specifically thinking of multiple disjoint USE dependency blocks.
182
183 I'm sorry but I'm not sure what you mean there. I hope you can give an example.
184
185 >>Arithmetic ranges on the other hand should only be in the form of
186 >>being "inclusive" in both ends, and not exclusive in any. Not only is
187 >>it simpler; it is also easier to parse. There's also no need to use
188 >>special grouping operators like {}. E.g. 1.3..1.5. Grouping is only
189 >>necessary if the form would cause other possible conflicts, where in
190 >>that case (1.3..1.5) and {1.3..1.5} should just be the same, unless
191 >>there would be more added expressions in the group.
192 >
193 > I'd say that arithmetic ranges are redundant if we do version ranges.
194
195 I actually don't like adding them myself. It complicates the interpreter.
196
197 --
198 konsolebox

Replies

Subject Author
Re: [gentoo-dev] RFC: Future EAPI version operator changes "Michał Górny" <mgorny@g.o>