1 |
Hola. |
2 |
|
3 |
CC'ing pms since obviously they should comment, although the |
4 |
discussion should be on -dev (aka, public, not an alias). |
5 |
|
6 |
Sorry, this is a long email; condensing it down into a glep is viable, |
7 |
just my time is limited (it's telling I started the gentoo stuff at |
8 |
2am, wrapping up likely at 4am). |
9 |
|
10 |
The length of this email basically relates to the subtlety of this |
11 |
proposal; at first glance it may appear as if I'm proposing a syntax |
12 |
shuffle just for aesthetic reasons, but as elaborated in the tail end, |
13 |
that subtle syntax change opens up a lot of possibilities. |
14 |
|
15 |
|
16 |
Either way, what I propose, is pretty simple. Currently USE_EXPAND'd |
17 |
groups are pushed into USE in the form ${use_group}_${setting}. |
18 |
|
19 |
Thus VIDEO_CARDS="intel nvidia" becomes video_cards_intel |
20 |
video_cards_nvidia. This should be reasonably well known and |
21 |
understood from the dev standpoint; from the PM side of things, this |
22 |
actually seriously sucks ass; if we see video_cards_intel in an IUSE |
23 |
somewhere, we don't know if it's a USE flag, or a use_expanded group; |
24 |
to figure that out, we basically have to do a longest prefix matching |
25 |
(or suffix tree). |
26 |
|
27 |
There in is one of the subtle design flaws of it; two USE_EXPAND'd |
28 |
targets, VIDEO_CARDS and VIDEO, can intersect in their namespace. |
29 |
While we (devs) intentionally avoid this potential via careful name |
30 |
choice, the fact the possibility exists is a bit of a sign that |
31 |
USE_EXPAND was a bit of a hack. |
32 |
|
33 |
What I propose is simple enough, and is for >=EAPI5: |
34 |
|
35 |
1) We disallow '@' in USE flags (yes, a use flag can actually have |
36 |
'@' in it's name according to PMS; someone was hitting the crack |
37 |
pipe pretty damn hard when they allowed that one). This doesn't |
38 |
impact anything in gentoo-x86, nor any tree I've ever seen. |
39 |
|
40 |
2) If <EAPI5, we continue exporting video_cards_nvidia |
41 |
(${use_group}_${setting}). |
42 |
|
43 |
3) If >=EAPI5, we export ${use_group}_${setting}, *and* |
44 |
${use_group}@${setting}. While there may be complaints about having |
45 |
it exported in two fashions, the reason for this is simple- it makaes |
46 |
transition way the fuck easier, meaning we don't make devs wrie pain |
47 |
in the ass "if eapi x, else blah" code. Basically, for eclass code, |
48 |
the dev would do thus: |
49 |
3.a) If the eclass supports <EAPI5, they check for the old form; |
50 |
${use_group}_${setting}. |
51 |
3.b) If however that eclass is >=EAPI5, they should check for the new |
52 |
form; ${use_group}@{setting}. |
53 |
|
54 |
4) At some point in the future, when either code involved has migrated |
55 |
all to EAPI5, or we do something in a later EAPI that renders |
56 |
supporting ${use_group}_${setting} untenuable, we stop exporting |
57 |
${use_group}_${setting} for those EAPIs. Preferably with one EAPI |
58 |
cycle w/ deprecation warnings. |
59 |
|
60 |
Basically, this approach is zero impact for devs for the most part; |
61 |
you don't have to do multiple paths for checking use wise if |
62 |
supporting EAPI5 in parallel to others. Once your code is EAPI5 (and |
63 |
above), you use the new syntax- or worst case, someone interested goes |
64 |
and converts your >=EAPI5 ebuild/eclass to use the new syntax on your |
65 |
behalf. |
66 |
|
67 |
Thus far, I've not particularly sold this notion in this email- I |
68 |
focused on making damn clear this cleanup is basically no cost for |
69 |
everyone but PM authors (and it's easy enough for us to handle). |
70 |
|
71 |
Aside from the cleanup/sanity improvements to our algos for |
72 |
backmatching USE_EXPAND groups, this syntax gets us actually some |
73 |
rathre nifty shit; it basically allows us to introduce a generation |
74 |
configuration space. |
75 |
|
76 |
So... onto examples of why we should do this beyond the basic "it's a |
77 |
cleaner syntax/design" argument: |
78 |
|
79 |
--Per phase RESTRICT usage-- |
80 |
Exactly as it sounds. Consider userpriv- most of the time that's |
81 |
turned off, that's purely because one phase- literally just one |
82 |
phase- needs to do something via root. Thus we weaken the entirety |
83 |
of the protection. Now, we could do some bastardly shit w/ existing |
84 |
use_expand for this (which has some conflict potentials for the PM), |
85 |
or via this syntax, we could do: |
86 |
|
87 |
RESTRICT="phase@src_install? ( userpriv )" |
88 |
|
89 |
Now, not all restricts are phase level- fetch, strip, installsources, |
90 |
etc, operate on a global level. userpriv, usersandbox, sandbox |
91 |
(latter two aren't used in gentoo-x86, although PM's support it still) |
92 |
are phase specific. That may seem like a small list, but consider |
93 |
that |
94 |
|
95 |
1) pkgcore has fakeroot code; it's had it for a while, I'm intending |
96 |
on resurrecting that; this requires a RESTRICT='fakeroot' however. |
97 |
2) I intend to start abusing the 'unshare' utility (man 1 unshare) to |
98 |
contain ebuilds build process; basically gives us a way to level some |
99 |
protections for the build host. I'd be very surprised if other PM's |
100 |
don't follow suit (or do it before I do even); it's a simple |
101 |
protection that's worth doing. |
102 |
3) There's been repeated talk of using containers/overlays to |
103 |
constrain the build process; sooner or later someones going to do it, |
104 |
and you can be damn sure a restrict will be necessary. |
105 |
|
106 |
Etc, you get the idea; the point of the new syntax is general |
107 |
flexibility and allowing us to be finegrained in RESTRICT where |
108 |
useful. |
109 |
|
110 |
|
111 |
--A form of unified DEPENDENCIES that fits into our existing style-- |
112 |
|
113 |
First, I'd appreciate it if the frothing over DEPENDENCIES wasn't |
114 |
involved here; this syntax lends itself to DEPENDENCIES, the debate |
115 |
about whether or not to do DEPENDENCIES is orthogonal. |
116 |
|
117 |
Either way, we could do thus: |
118 |
|
119 |
DEPENDENCIES=" |
120 |
dep@build,run? ( common deps/rdeps ) |
121 |
dep@run? ( rdep specific )" |
122 |
|
123 |
Etc. There's a subtly there; specifically that it's a |
124 |
conditional w/ multiple settings being checked. Now, we could either |
125 |
do that as per USE_GROUP (moreso, per conditional namespace- dep being |
126 |
a namespace, just like 'phase' was one from earlier) rules, which I |
127 |
think sucks, or we could come up with common syntax there, which leads |
128 |
into the next potential feature we can build via this: |
129 |
|
130 |
-- Reducing duplication, and avoiding multi-slot issues -- |
131 |
|
132 |
Picking on mesa, the following deps: |
133 |
|
134 |
>=x11-libs/libdrm-2.4.24[video_cards_nouveau?,video_cards_vmware?] |
135 |
video_cards_nouveau? ( <x11-libs/libdrm-2.4.34 ) |
136 |
video_cards_intel? ( >=x11-libs/libdrm-2.4.24[video_cards_intel] ) |
137 |
video_cards_radeon? ( >=x11-libs/libdrm-2.4.24[video_cards_radeon] ) |
138 |
|
139 |
Could instead be written as: |
140 |
|
141 |
>=x11-libs/libdrm-2.4.24[video_cards@nouveau,vmware?] |
142 |
video_cards@nouveau,intel,radeon? ( |
143 |
<x11-libs/libdrm-2.4.34[video_cards@intel,radeon?] ) |
144 |
|
145 |
Another example, just from randomly poking through the tree: |
146 |
app-admin/chef-server-api; I get the feeling this likely applies to |
147 |
most ruby pkgs. Abbreviated rdeps are thus: |
148 |
|
149 |
ruby_targets_ruby18? ( |
150 |
~app-admin/chef-10.12.0[ruby_targets_ruby18] |
151 |
>=dev-ruby/dep_selector-0.0.3[ruby_targets_ruby18] |
152 |
.. 12 more pkgs w/ similar use enforcement .. |
153 |
) |
154 |
|
155 |
ruby_targets_ruby19? ( |
156 |
~app-admin/chef-10.12.0[ruby_targets_ruby19] |
157 |
>=dev-ruby/dep_selector-0.0.3[ruby_targets_ruby19] |
158 |
.. 12 more pkgs w/ similar use enforcement .. |
159 |
) |
160 |
|
161 |
Instead, it could be written as thus: |
162 |
|
163 |
ruby_targets@ruby18,ruby19? ( |
164 |
~app-admin/chef-10.12.0[ruby_targets@ruby18,ruby19?]] |
165 |
>=dev-ruby/dep_selector-0.0.3[ruby_targets@ruby18,ruby19?] |
166 |
.. 12 more pkgs w/ similar use enforcement .. |
167 |
) |
168 |
|
169 |
Upshot of that approach, it's effectively a single atom- meaning we |
170 |
don't have to worry about the scenario where (just hypothetically |
171 |
speaking) app-admin/chef was a slotted pkg; the current form they |
172 |
have in the tree, were it slotted, the resolver could pull in two |
173 |
there even if the pkg didn't want it to. |
174 |
|
175 |
I'd be curious exactly what people think of that extension; |
176 |
technically, there is no reason it couldn't be used outside of just |
177 |
use_deps also. |
178 |
|
179 |
Finally, keep in mind that the syntax for multiple flags there is |
180 |
intentionally a bit loose; that can be debated/bikeshedded to hell; |
181 |
the point however is that while we could try doing similar w/ old |
182 |
USE_EXPAND syntax, that's fairly ugly; the new '@' syntax makes this |
183 |
easier and opens up potentials. |
184 |
|
185 |
|
186 |
-- ability to do testing of use groups (multiple flags) as a whole -- |
187 |
|
188 |
Continuing from the ruby example, we have a ruby use flag, then |
189 |
use_expanded ruby_targets_ruby${version}. There's no reason the ruby |
190 |
use flag couldn't be killed off, and instead, allow 'ruby@? ( |
191 |
ruby-deps )' syntax- or something possibly more syntactically |
192 |
tasteful, 'ruby@*? ( ruby-deps )'. |
193 |
|
194 |
|
195 |
-- Sub use groups -- |
196 |
|
197 |
There's no reason we couldn't do nesting of namespaces here; |
198 |
apache2_modules for example has the following optionals: |
199 |
|
200 |
proxy - HTTP/1.1 proxy/gateway server |
201 |
proxy_ajp - AJP support module for mod_proxy |
202 |
proxy_balancer - mod_proxy extension for load balancing |
203 |
proxy_connect - mod_proxy extension for CONNECT request handling |
204 |
proxy_ftp - FTP support module for mod_proxy |
205 |
proxy_http - HTTP support module for mod_proxy |
206 |
proxy_scgi - SCGI gateway module for mod_proxy |
207 |
|
208 |
If we wanted to, w/ the new syntax we could fairly easily nest that, |
209 |
such that it's apache2_modules@proxy@ajp, |
210 |
apache2_modules@proxy@balancer... you get the idea. Note this isn't |
211 |
required- it just becomes sanely possible w/ the syntax. |
212 |
|
213 |
-- REQUIRED_USE enhancement -- |
214 |
|
215 |
It's late, so I'm going light on the details for this; essentially, |
216 |
the ability to address a bunch of flags at once I'm strongly wager |
217 |
devs will find a use for. My brains a bit fried, but if folks have an |
218 |
example in this case, please chime in. |
219 |
|
220 |
|
221 |
Again, sorry for the length, but hopefully having read this far, |
222 |
it wasn't a waste of your time. ;) |
223 |
|
224 |
If folks want to pick at specific sub-uses of the syntax, please feel |
225 |
free to change the subject for that feature and derive a thread from |
226 |
it (think git patchset uploads, and you'll grok the notion). |
227 |
|
228 |
~harring |