Gentoo Archives: gentoo-dev

From: konsolebox <konsolebox@×××××.com>
To: gentoo-dev@l.g.o
Cc: pms-bugs@g.o
Subject: Re: [gentoo-dev] [RFC] New version constraints: variant one
Date: Fri, 11 Nov 2016 05:37:39
Message-Id: CAJnmqwYoVi7+di7aryvhPNjvBwBmMw1N7PiOiMw_E4rnhKKcow@mail.gmail.com
In Reply to: [gentoo-dev] [RFC] New version constraints: variant one by "Michał Górny"
1 On Fri, Nov 11, 2016 at 6:53 AM, Michał Górny <mgorny@g.o> wrote:
2 > Hello, everyone.
3 >
4 > Following my earlier threads, I'd like to propose a first complete
5 > solution for new version restrictions for package dependencies. I
6 > honestly doubt it's going to be approved since it's a major change.
7 > Nevertheless, I think it's an interesting topic for consideration.
8 >
9 > What is included:
10 >
11 > - conjunctive version ranges,
12 > - revision-free and revision-oriented comparisons,
13 > - full set of (blocker-free) logical operators.
14 >
15 > What isn't included:
16 >
17 > - disjunctive version ranges,
18 > - complete lower bound problem solution,
19 > - extensions for prefix matching,
20 > - some convenience shortcuts like Ruby's ~> op.
21 >
22 >
23 > Backwards compatibility [recommended]
24 > =====================================
25 >
26 > For backwards compatibility, package dependency specifications using
27 > old-style restrictions will still be accepted. Those specifications
28 > will retain the old behavior, and have no new features.
29 >
30 >
31 > New package dependency syntax
32 > =============================
33 >
34 > New-style package dependencies use the following syntax:
35 >
36 > <cat> "/" <pkg> [":" <slot>] ["[" <vers> "]"] ["[" <usedep> "]"]
37 >
38 > with <vers> now using the following sub-syntax:
39 >
40 > <op> <version> ["," <op> <version>...]
41 >
42 > The version restriction operator is removed from the front and all
43 > package dependency specifications start with the category and package
44 > name, followed by optional package slot. This can be followed by
45 > optional version restrictions and USE flag restrictions.
46 >
47 > The version constraints (if present) must *always* be placed inside
48 > square brackets, even for a single constraint. Each constraint starts
49 > with an operator followed by a version string. Multiple constraints are
50 > separated using "," character, and are conjunctive (AND-ed).
51 >
52 > The operators are not valid for beginning of a USE dependency string,
53 > therefore the version constraint can be clearly distinguished from USE
54 > contraints.
55 >
56 > The version and USE flag constraints are always disjoint. If both are
57 > present, they must be surrounded by separate pairs of brackets.
58 >
59 > Examples:
60 >
61 > dev-foo/bar:13[foo] # slot + USE
62 > dev-foo/bar[>=3] # single version constraint
63 > dev-foo/bar:4[>=4.11,<4.20] # slot + version range
64 > dev-foo/bar[>=3][foo] # version + USE
65
66 Looks like you excluded the independent rearrangeability of the
67 conditional elements, and the OR feature; and also, grouping being
68 optional where AND would be the default control operator.
69
70 Does that still allow multi-level grouping?
71
72 You can choose to have such restrictions now, but I still highly
73 suggest the use of () instead of [], so it would be clear that [] is
74 for use flags, and () is for versions. Not only would that lessen
75 confusion and remove the parser's necessity to look-ahead-and-verify,
76 it would also make the syntax open to future improvements.
77
78 The use of comma as a separator looks good, and minimizes the
79 characters that the parser would have to check when checking for a new
80 token.
81
82 > Version restrictions
83 > ====================
84 >
85 > Each version restriction consists of an operator followed by a version
86 > string.
87 >
88 > The following revision-free version comparison operators are provided:
89 >
90 > == exact version match, or prefix match (with *)
91 > != exact version non-match, or prefix non-match (with *)
92 > < version less than match
93 > <= version less or equal to match
94 > > version greater than match
95 > >= version greater or equal to match
96 >
97 > All those operators compare on versions ignoring the revision part.
98 > They must be followed by a valid version with no revision part.
99 > Additionally, the == and != operators can accept a version followed by
100 > * to indicate prefix match.
101 >
102 > The following revision-oriented version comparison operators are
103 > provided:
104 >
105 > === exact version+revision match
106 > !== exact version+revision non-match
107 > <== version+revision less or equal to match
108 > >== version+revision greater or equal to match
109
110 I doubted this at first but after further examination I found that
111 it's actually more consistent. It's more aggressive but it's a more
112 correct solution.
113
114 --
115 konsolebox