1 |
Since DEPENDENCIES hasn't been written up in a Gentoo-friendly manner, |
2 |
and since the Exherbo documentation doesn't seem to suffice to explain |
3 |
the idea here, here's some more details on the DEPENDENCIES proposal. |
4 |
|
5 |
We observe that a typical package will have something like this: |
6 |
|
7 |
DEPEND=" |
8 |
cat/first |
9 |
cat/second |
10 |
cat/third |
11 |
cat/fourth |
12 |
foo? ( |
13 |
foo/one |
14 |
>=foo/two-2.34[monkeys] |
15 |
) |
16 |
bar? ( |
17 |
bar/one |
18 |
) |
19 |
baz? ( |
20 |
baz/one |
21 |
baz/two |
22 |
) |
23 |
fnord? ( |
24 |
fnord/one |
25 |
)" |
26 |
|
27 |
RDEPEND=" |
28 |
cat/second |
29 |
cat/third |
30 |
cat/fourth |
31 |
cat/fifth |
32 |
foo? ( |
33 |
>=foo/two-2.34[monkeys] |
34 |
foo/three |
35 |
) |
36 |
bar? ( |
37 |
bar/one |
38 |
bar/two |
39 |
bar/three |
40 |
bar/four |
41 |
)" |
42 |
|
43 |
Note how many dependencies that we think of as being "the same" are |
44 |
listed in two places, and are not in any way "the same". |
45 |
|
46 |
Note also how the foo-related things, the bar-related things etc cannot |
47 |
be grouped together by their fooness or barness, but are rather grouped |
48 |
by their DEPENDness and RDEPENDness. |
49 |
|
50 |
Right now we've just got three variables. In a not too distant EAPI, it |
51 |
will be considerably more than three. We also have duplication; with |
52 |
HDEPEND, this will sometimes become triplication. |
53 |
|
54 |
Here's the important bit, which I shall prefix with some stars: |
55 |
|
56 |
*** The point of DEPENDENCIES is not to replace n variables with one |
57 |
*** variable. |
58 |
|
59 |
*** The point of DEPENDENCIES is not to provide syntactic sugar over a |
60 |
*** group of n variables. |
61 |
|
62 |
*** The point of DEPENDENCIES is to allow a package's dependencies, |
63 |
*** which can be very complicated, to be expressed accurately and |
64 |
*** simply, in a way friendly to how developers deal with dependencies |
65 |
*** in practice. |
66 |
|
67 |
So here's what DEPENDENCIES solves: |
68 |
|
69 |
Firstly, it allows developers to group together foo-related dependencies |
70 |
and bar-related dependencies by their fooness and barness, not by their |
71 |
role. |
72 |
|
73 |
Secondly, it reduces error-prone duplication. |
74 |
|
75 |
Thirdly, it avoids some fairly obtuse names (BADEPEND? LDEPEND?) in |
76 |
favour of something a tad more readable. |
77 |
|
78 |
Here's the other important bit, with more stars: |
79 |
|
80 |
*** It does it by replacing the concept of "a package has build |
81 |
*** dependencies, run dependencies, etc" with "a package has |
82 |
*** dependencies, and each dependency is applicable at one or more of |
83 |
*** build time, run tme, etc". |
84 |
|
85 |
We could just mark each dependency individually by when it's |
86 |
applicable. But that turns out to be quite verbose, since packages have |
87 |
fairly long lists of dependencies of the same kind. So here's a much |
88 |
more concise syntax: |
89 |
|
90 |
DEPENDENCIES=" |
91 |
build: |
92 |
cat/first |
93 |
build+run: |
94 |
cat/second |
95 |
cat/third |
96 |
cat/fourth |
97 |
run: |
98 |
cat/fifth |
99 |
|
100 |
foo? ( |
101 |
build: |
102 |
foo/one |
103 |
build+run: |
104 |
>=foo/two-2.34[monkeys] |
105 |
run: |
106 |
foo/three |
107 |
) |
108 |
|
109 |
bar? ( |
110 |
build+run: |
111 |
bar/one |
112 |
run: |
113 |
bar/two |
114 |
bar/three |
115 |
bar/four |
116 |
) |
117 |
|
118 |
build: |
119 |
baz? ( |
120 |
baz/one |
121 |
baz/two |
122 |
) |
123 |
|
124 |
fnord? ( |
125 |
fnord/one |
126 |
)" |
127 |
|
128 |
Here are the rules for working out which labels apply to a given spec: |
129 |
|
130 |
We have a "labels stack" when parsing. Initially, the value "build+run" |
131 |
is on the top. Whenever we encounter a block ("( )", "use? ( )" etc), |
132 |
we duplicate the top value of the stack, and when we leave the block we |
133 |
pop the value off. Whenever we encounter labels, we replace the top |
134 |
value on the stack with those labels. Whenever we encounter a spec, its |
135 |
associated labels are those on the top of the stack. |
136 |
|
137 |
To avoid weirdness, so long as we're inside a || block, use of labels |
138 |
is forbidden. Note that this is a reflection of the current ambiguity |
139 |
as to what DEPEND="|| ( a b )" RDEPEND="|| ( a b )" means (can you |
140 |
build against a, and run against b?), and if we're wanting to tidy that |
141 |
up, that should be an independent proposal. |
142 |
|
143 |
These rules are mostly for flexibility: if developers sometimes prefer |
144 |
to group things by role rather than by fooness, then that's possible |
145 |
too. |
146 |
|
147 |
The rules for eclass merging need changing too, to add a ( ) around |
148 |
values rather than merely appending. This is a technicality, and isn't |
149 |
developer visible. |
150 |
|
151 |
-- |
152 |
Ciaran McCreesh |