Gentoo Archives: gentoo-dev

From: Brian Harring <ferringb@×××××.com>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [RFC] Dynamic SLOTs
Date: Tue, 19 Jun 2012 02:44:20
Message-Id: 20120619024255.GA4424@localhost
In Reply to: Re: [gentoo-dev] [RFC] Dynamic SLOTs by "Michał Górny"
1 On Mon, Jun 18, 2012 at 10:34:44AM +0200, Micha?? G??rny wrote:
2 > On Sun, 17 Jun 2012 09:26:55 +0200
3 > Micha?? G??rny <mgorny@g.o> wrote:
4 >
5 > > I'm attaching a reStructuredText version of the spec. You can view it
6 > > rendered as a gist[1]. But please keep the replies on the list, rather
7 > > than forking the gist.
8 > >
9 > > [1]:https://gist.github.com/2943774
10 >
11 > Updated version. I've introduced dynamic SLOT groups and updated all
12 > relevant information.
13 >
14 > I didn't break DYNAMIC_SLOTS in ebuild to multiple variables yet but it
15 > will be easy to change that if necessary.
16 >
17 > This fixes problem previously described as 9a (dependencies). However,
18 > I've added a new issue, 10c which marienz pointed out.
19
20 Bleh; wish your attachment had been text/plain for inline
21 commenting; pardon any mangling...
22
23
24 > 3. Defining dynamic SLOT groups
25 > -------------------------------
26 >
27 > The list of supported dynamic SLOT groups should be declared
28 > in profile `make.defaults` as ``DYNAMIC_SLOT_GROUPS`` variable. That
29 > variable should contain whitespace-separated list of group names.
30 >
31 > For each group, the same file should have a variable named
32 > ``DYNAMIC_SLOTS_`` followed by the group name. That variable should list
33 > all possible dynamic SLOTs belonging to that group.
34
35 This is USE_EXPAND machinery; you should clarify why it's not being
36 reused here, nor treat explicitly as such.
37
38 Also, this gets fugly when one starts talking about individual pkgs
39 that have their own slotting, rather than global patterns like
40 python/multilib.
41
42 Should consider that and address it...
43
44
45
46 > 4. Defining supported SLOTs in an ebuild
47 > ----------------------------------------
48 >
49 > An ebuild supporting building for multiple dynamic SLOTs has to declare
50 > the supported slots using ``DYNAMIC_SLOTS`` variable. The variable can
51 > be inherited from eclasses.
52 >
53 > For example, an ebuild supporting building for multiple Python ABIs
54 > would declare (either explicitly or implicitly through an eclass)::
55 >
56 > DYNAMIC_SLOTS='py2.6 py2.7 py3.1 py3.2'
57 >
58 > which would mean that when the package is built, one of the ``pyX.Y``
59 > SLOTs must be used. As all of the listed SLOTs belong to the same group,
60 > only of them may be used at a time.
61 >
62 > An ebuild may also declare dynamic SLOTs from multiple groups::
63 >
64 > DYNAMIC_SLOTS='py2.6 py2.7 lib32 lib64'
65 >
66 > In this case, both one of ``pyX.Y`` and ``libX`` SLOTs need to be
67 > declared.
68
69 The words "I'll implement that when hell freezes over" come to
70 mind. That's a mess requiring the PM to know all potential values
71 and do interpolation on the fly; you're expecting the PM to be far,
72 far more intelligent then it can be, and the results won't be
73 pleasant (not counting the joys of writing such a resolver mind you).
74
75 Additionally, your notion breaks down if py3.3 supports lib64, but not
76 lib32.
77
78 If the groupings are treated as USE_EXPAND (even if a segregated group
79 of it), you can abuse the same REQUIRED_USE machinery to specify the
80 allowed pigeon holes/slots, including arbitrary group combinations.
81
82 Still will be a bit harsh for the resolver I expect, but that's at
83 least descriptive enough to handle the py3.3/lib64 scenario I
84 mentioned, while being explicit data the PM can operate on (local to
85 that ebuild) without having to do nastyness.
86
87 Note also that if one just dropped your notion of reinventing the
88 wheel, and reused REQUIRED_USE logic for slots... well, strikes me
89 that gives the flexibility you desire while folding it into existing
90 slot machinery. Haven't prototyped it, so may be cracktastic, but
91 seems a bit more integrated than what you're proposing.
92
93
94 > 5. Building the ebuild against chosen SLOTs
95 > -------------------------------------------
96 >
97 > In ``pkg_*`` and ``src_*`` phases, the build environment is provided
98 > with currently enabled dynamic SLOTs via variables named
99 > ``DYNAMIC_SLOT_`` followed by dynamic SLOT group name. The ebuild must
100 > use this variable to adjust the build process accordingly which can be
101 > done either directly or via an eclass.
102 >
103 > For example, in an ebuild using dynamic SLOTs for Python ABIs, the check
104 > may look like::
105 >
106 > case ${DYNAMIC_SLOT_PYTHON} in
107 > py2.6)
108 > # ...
109 > ;;
110 > py2.7)
111 > # ...
112 > ;;
113 > # ...
114 > esac
115
116 For ebuilds where one can't reuse the same source (moreso, can't do
117 the build of two different targets w/in that source, meaning you need
118 two work trees), this breaks down- which I expect is common. That
119 workflow needs to be non sucky for ebuild devs- so... sort that angle
120 please.
121
122
123 >
124 > 6. Relevance to binary and installed packages
125 > ---------------------------------------------
126 >
127 > It is necessary to store the dynamic SLOTs for which a package was built
128 > in the binary package and installed package metadata. The exact
129 > semantics are left to be implementation-specific. The implementation
130 > must ensure, however, that a multiple dynamic SLOT variants of the same
131 > package can be installed at the same time.
132 >
133 > For example, dynamic SLOT could be appended after package version::
134 >
135 > dev-python/foo-1.2.3+py2.6
136 > dev-libs/bar-1.0+lib32
137
138 As ciaran stated, this is predicated upon the vdb being opaque to
139 ebuilds from this point forward. That's a large assumption you need
140 to validate before pushing this forward.
141
142 Once you have ensured that ebuilds treat the VDB as opaque... this
143 section should be gutted. Ebuild format shouldn't be dictating the
144 VDB implementation (especially since the moment we *can*, I gurantee
145 the PM authors will be redesigning the VDB to be non shitty, and the
146 decision of how to handle the above is implementation specific).
147
148
149 > 7. Installed file collisions
150 > ----------------------------
151 >
152 > Due to the specifics of dynamic SLOT implementation, it is possible that
153 > files installed by various dynamic SLOT package variants collide.
154 > For example, each dynamic SLOT variant of a Python module may install
155 > a README file in the same docdir.
156 >
157 > The ebuilds must ensure that the colliding files are equivalent between
158 > various dynamic SLOT variants of the package. The package manager should
159 > overwrite those files whenever a new dynamic SLOT variant is installed,
160 > and must ensure that they will be removed when last dynamic SLOT variant
161 > of the package is uninstalled.
162 >
163 > The installed package metadata must ensure that the colliding files
164 > belong to all dynamic SLOT variants of the package, and their metadata
165 > is kept up-to-date.
166
167 Collisions should be whitelisted imo via a specific var; via that, it
168 can be handled/tracked (easier on the PM, and easier on the ebuild dev
169 since they have an explicit QA control to utilize).
170
171
172 > 8. Inter-package dependencies
173 > -----------------------------
174 >
175 > If an ebuild supports at least one dynamic SLOT from a particular
176 > dynamic SLOT group and its dependency does so, the package manager must
177 > implicitly depend on matching dynamic SLOT variant of the dependant
178 > package.
179 >
180 > If the dependant ebuild does not support a matching dynamic SLOT,
181 > the dependency must not be satisfied by that package.
182 >
183 > In other words, if ``dev-python/foo`` depends on ``dev-python/bar``
184 > and both of those ebuilds support dynamic SLOTs for Python ABIs, then
185 > the package manager must ensure that building ``dev-python/foo`` with
186 > ``py2.7`` dynamic SLOT will pull in ``dev-python/bar`` with ``py2.7``
187 > SLOT.
188
189 You're not giving any justification as to why this must be explicit,
190 versus builtin via a new slot dep operator...
191
192 Just saying. :)
193
194
195 > 9. User interface
196 > -----------------
197 >
198 > The choice of dynamic SLOTs for ebuilds whenever not directly caused
199 > by implicit dependencies is to be implementation-defined.
200 >
201 > The package manager should provide an ability to control the default
202 > dynamic SLOT choice to external tools like eselect. For example,
203 > the default Python SLOT would be controlled by eselect-python.
204 >
205 > The package manager must provide user with an ability to explicitly
206 > choose dynamic SLOT when merging a package and to store such a SLOT
207 > specification in the world file.
208
209 This sounds strongly like you're requiring the manager to go
210 interactive. Note that the "store such a slot specification" bit is
211 inaccurate also- you've thus far basically treated slotting as a
212 separate beast from dynamic slotting.
213
214 On that subject, what *occurs* when an ebuild is already slotted, and
215 has dynamic_slot crap in place? Gcc for example, is slotted, and
216 dynamic slotting is abusable for generating cross compilation
217 toolchains- you skipped that entire interaction (a very, very non
218 simple interaction I suspect).
219
220
221 > The package manager may support specifying more than a single exclusive
222 > dynamic SLOT variants. In this case, the package manager should split
223 > the request into merging multiple dynamic SLOT variants of the package.
224 >
225 > For example, the following call::
226 >
227 > emerge dev-python/foo+py2.6+py2.7
228 >
229 > may cause the package manager to either reject the request (because of
230 > colliding dynamic SLOTs) or build two dynamic SLOT variants
231 > of the package.
232
233 Re: "colliding dynamic slots", your proposals text, in current form,
234 doesn't allow for any collisions. To actually do what you describe,
235 you'd need ^^ ( py2.6 py2.7 )
236
237
238 > 10. Unsolved problems
239 > ---------------------
240 >
241 > a) Large common parts of packages supporting dyn. SLOTs
242 > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
243 >
244 > Often packages supporting dynamic SLOTs have large, common parts.
245 > In most common case, it is API documentation which gets generated
246 > at build time. Supporting multiple dynamic SLOTs would mean that
247 > documentation is going to be regenerated for every SLOT (or at least
248 > SLOTs supporting documentation generation).
249 >
250 > This get worse when various versions of the SLOT introduce tiny,
251 > irrelevant differences in the generated files. As the spec does disallow
252 > installing colliding files with different contents, this has to be
253 > handled some other way.
254 >
255 > Possible solutions:
256 >
257 > 1. Let each dynamic SLOT install own copy of files (i.e. separate docs
258 > for each version),
259 > 2. Move the common files into separate ebuild,
260 > 3. Introduce a special dynamic SLOT which would install just the common
261 > files, and depend on it (requires adding support for explicit dynamic
262 > SLOT dependencies).
263
264 3 is sounding painful.
265
266 > b) Packages installing multiple kinds of dynamic SLOTs
267 > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
268 >
269 > Example: packages installing bindings for multiple languages. The usual
270 > way of defining dynamic SLOTs, i.e.::
271 >
272 > DYNAMIC_SLOTS='py2.6 py2.7 ruby1.8 ruby1.9'
273 >
274 > would mean that each time both a Python version, and a Ruby version has
275 > to be chosen. This would have to be backed up at least with USE flags
276 > and it gets more ugly...
277 >
278 > An interesting solution would be to assume that only one of the listed
279 > SLOTs is to be used at a time. This would mean that each build involves
280 > building just one of the bindings for a particular language of interest.
281 > Sadly, this would require making the spec more complex.
282 >
283 > A straightforward solution is to simply split the package.
284
285 /me thinks you need to take a hard look at subversion bindings; that's
286 not "go compile the lib and install it", that's generally "compile the
287 lib once with variants in the binding" which won't match into your
288 scheem all that well best I can tell.
289
290
291 > c) Packages depending on utilities which don't need matching SLOTs
292 > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
293 >
294 > The implicit dependency part assumes that all dependencies expect
295 > matching SLOTs. However, this is not always true.
296 >
297 > For example, a package building Python module may depend on another
298 > Python package yet call only a utility provided in that package.
299 > In that case, it is more likely that the utility would actually need
300 > to be pulled in with the currently selected system Python ABI rather
301 > than one used for the requested package.
302 >
303 > This issue could be probably solved through introducing explicit dynamic
304 > SLOT dependency atoms.
305
306 If you want to do implicit... frankly, you need to create a working
307 prototype demonstrating it. That's a high bar requirement I realize,
308 but I'm stating it since this is the sort of nasty resolution problem
309 where actually *doing* it and seeing how it flies, flexes, etc, is
310 critical for proving it's a viable solution for people to rely upon.
311
312 Most likely in creating such a beast, you'll wind up simplifying the
313 proposal due to sharp edges encountered; that simplification should
314 occur w/in the proposal itself rather than having it get passed, then
315 people start going "well fuck me sideways, this isn't actually sane
316 nor particularly implementable".
317
318 Just saying; prototype is required there, frankly for most of this
319 proposal in general.
320
321 ~harring

Replies

Subject Author
Re: [gentoo-dev] [RFC] Dynamic SLOTs "Michał Górny" <mgorny@g.o>