1 |
Hi Dan.... |
2 |
|
3 |
A couple thoughts.... |
4 |
|
5 |
It seems to me that this system is too centralised. Someone is going to have |
6 |
to maintain all the WITH variables in CVS and this also creates a |
7 |
possibility of changes to that file impacting many ebuilds. Also, there is a |
8 |
certain amount of duplication in intent between WITH variables and USE |
9 |
variables, as shown in your example with QT. QT seems to be both a USE |
10 |
variable and a WITH variable defined in two separate files. |
11 |
|
12 |
Why not keep WITH variables local to the ebuild file itself? I think this |
13 |
would have several advantages despite putting a certain amount of work back |
14 |
onto the ebuilder. I think it would be easier to implement and manage. |
15 |
Ebuild wouldn't need to be changed as much; it would only involve adding an |
16 |
interact() function that asked the questions and then set the variables to |
17 |
be used downstream. This would even reduce the work in upgrading existing |
18 |
ebuilds if WITH variables can just update (locally) the value of a USE |
19 |
variable. There doesn't seem to be much benefit to having a central list of |
20 |
these WITH variables and in somes ways they seem to overlap the purpose of |
21 |
USE variables. |
22 |
|
23 |
I think the biggest use of these would be to (a) override a USE variable (b) |
24 |
specify which of several conflicting USE variables to use, and (c) to |
25 |
provide one-off configuration options. |
26 |
|
27 |
I do like the idea of presenting a list of mutually exclusive options along |
28 |
with a blurb about how to use them. There are lots of cases where you need |
29 |
to choose which library or option you want and your choices may not be |
30 |
consistent across packages. The idea of defining such a list as a group and |
31 |
then specifying that group as the USE works well too. |
32 |
|
33 |
Basically I think that WITH variables should be locally defined or |
34 |
overridden USE variables, and treated just like USE variables once inside |
35 |
the current standard ebuild functions. All we would need is another function |
36 |
that can be triggered (interactive()?) to go through the list of WITH |
37 |
variables, define them according to the user's preferences, and set them as |
38 |
USE variables. The definition system you propose is fine and those |
39 |
definitions would just be stored in a section of the ebuild. |
40 |
|
41 |
Cheers, |
42 |
|
43 |
Sean |
44 |
|
45 |
------------------------------------------------------------------------ |
46 |
Sean Mitchell Software Engineer |
47 |
smitchell@×××××××××××××××××××.com Phoenix Interactive Design Inc |
48 |
tel. 519-679-2913 x237 4th Floor, 137 Dundas St |
49 |
fax. 519 679 6773 London, ON, Canada N6A 1E9 |
50 |
ICQ# 104246806 |
51 |
------------------------------------------------------------------------ |
52 |
|
53 |
|
54 |
|
55 |
|
56 |
> -----Original Message----- |
57 |
> From: Dan Armak [mailto:danarmak@g.o] |
58 |
> Sent: Wednesday, July 18, 2001 4:13 PM |
59 |
> To: gentoo-dev@××××××××××.org |
60 |
> Subject: [gentoo-dev] New system to replace USE flags |
61 |
> |
62 |
> |
63 |
> Hi all, |
64 |
> |
65 |
> This is a followup to the discussion on the thread |
66 |
> "Suggestion: DONT_USE |
67 |
> flags". It describes a new (suggested) system to replace USE |
68 |
> flags. I don't |
69 |
> include the reasons for switching, they should be obvious. |
70 |
> |
71 |
> This is a very long post. It includes not just ideas but |
72 |
> syntax examples etc. |
73 |
> This are just examples, sometimes not even suggestions. If |
74 |
> even half of what |
75 |
> I've written here is implemented, it will be complete success |
76 |
> for this memo. |
77 |
> |
78 |
> Comments are gladly accepted, only please try to read |
79 |
> everything first. |
80 |
> |
81 |
> ------- |
82 |
> |
83 |
> For clarity, let's call the new system With flags. |
84 |
> |
85 |
> With flags can serve different purposes: |
86 |
> 1. They can set usage of shared libraries e.g. qt, sdl. |
87 |
> 2. They can set ebuild-specific options and program-specific |
88 |
> configuration |
89 |
> details. This doesn't mean duplicating the program's |
90 |
> configuration files, but |
91 |
> rather more global things. |
92 |
> 3. They can address h/w availability & utils (e.g. mmx, |
93 |
> 3dnow, pcmcia) and |
94 |
> other misc. things. |
95 |
> This isn't an important distinction, the above 3 things are |
96 |
> just examples. |
97 |
> |
98 |
> In make.globals (or somewhere else), a large number of With |
99 |
> flags will be |
100 |
> defined. They will all have default values (yes/no), either static or |
101 |
> dynamically determined based on the values of other With flags. |
102 |
> |
103 |
> Note: I may be misunderstaing the use of make.globals. What I |
104 |
> need is a file |
105 |
> with unchanging factory settings, which can be customized in |
106 |
> make.conf. |
107 |
> |
108 |
> An entry will look like this (2 lines): |
109 |
> |
110 |
> qt=yes |
111 |
> an X interface library, used e.g. by KDE. |
112 |
> |
113 |
> Every With flag can have 2 parts of increasing verbosity: |
114 |
> 1. Name. ex: qt. Default value appended. |
115 |
> 2. Description. ex: an X interface library, used e.g. by KDE. |
116 |
> |
117 |
> The above gives an example of a static definition of a flag's |
118 |
> default value. |
119 |
> A dynamic definition would look like this: |
120 |
> |
121 |
> flagA=yes |
122 |
> flagB=no |
123 |
> flagC=flagA # gives yes |
124 |
> flagD=!flagA # ! is not, gives no |
125 |
> flagE=flagA|flagB # | is inclusive or, gives yes |
126 |
> |
127 |
> and so on. |
128 |
> |
129 |
> In make.conf there will be a partial list of flags, |
130 |
> preferrably with short |
131 |
> comments, for user setting. A user can thus override any |
132 |
> default setting. He |
133 |
> can also add to make.conf any flag from make.globals and set |
134 |
> it, even if it |
135 |
> isn't in make.conf's default list. |
136 |
> |
137 |
> An example entry in make.conf: |
138 |
> |
139 |
> qt=yes # override here |
140 |
> an X interface library, used e.g. by KDE. # This is a description |
141 |
> |
142 |
> The make.conf entry's description might be longer than the |
143 |
> make.globals one. |
144 |
> |
145 |
> The default list should only include things which apply to |
146 |
> more than just one |
147 |
> or two packages, and which can be understood by the average end |
148 |
> user/developer who isn't particularly familiar with the |
149 |
> library/package |
150 |
> discussed. No ebuild-specific (e.g. configuration) settings |
151 |
> should go here. |
152 |
> |
153 |
> The default way of will be non-interactive, essentially the |
154 |
> same as it is |
155 |
> now. However, emerge (and ebuild) will accept a --interactive |
156 |
> parameter. |
157 |
> |
158 |
> Whenever an ebuild needs to make any decision, it will call a |
159 |
> function |
160 |
> provided by emerge (or ebuild). So (I know this isn't a shell |
161 |
> script, but I |
162 |
> hate shell scripts!): |
163 |
> |
164 |
> # need to know whether to build qt interface |
165 |
> result = with(qt, "foo uses qt to such and such an effect.") |
166 |
> |
167 |
> The second parameter to the with function is the description of the |
168 |
> applicability of the With flag to this specific ebuild, and |
169 |
> what the ebuild |
170 |
> will do without it. |
171 |
> The ebuild will get a response, it doesn't need to know how |
172 |
> the decision was |
173 |
> made. |
174 |
> |
175 |
> The function will have two modes: interactive and noninteractive. |
176 |
> |
177 |
> In noninteractive mode (the default), the With answer will be |
178 |
> decided based |
179 |
> on the default value (from make.globals) and the user-defined |
180 |
> value if |
181 |
> present (make.conf). |
182 |
> |
183 |
> In interactive mode, activated by the --interactive command |
184 |
> line parameter, |
185 |
> the user will be asked to decide. This is where the |
186 |
> description of the flag |
187 |
> is used. |
188 |
> The user will see: |
189 |
> |
190 |
> # emerge --interactive foo.ebuild |
191 |
> Calculating dependencies.. done! |
192 |
> >>> emerge foo to / |
193 |
> Decide: qt (default yes, override No): |
194 |
> Description: an X interface library, used e.g. by KDE |
195 |
> Specifics: foo uses qt to such and such an effect. |
196 |
> [y/N] |
197 |
> |
198 |
> Note: not all flags need to be defined somewhere! If an |
199 |
> ebuild calls with on |
200 |
> an undefined flag, it needs to supply a default value. This |
201 |
> is the value |
202 |
> returned to it in noninteractive mode. The call would become: |
203 |
> |
204 |
> result = with(qt=yes, "foo uses qt to such and such an effect.") |
205 |
> |
206 |
> Dynamic definitions can be used as well as static, as defined earlier. |
207 |
> |
208 |
> The next thing to have is choice betwen mutually exclusive |
209 |
> With flags (this |
210 |
> is sorely lacking in the USE system). |
211 |
> |
212 |
> An ebuild might look so: |
213 |
> # Choose between mutually exclusive sound output interfaces |
214 |
> result=which(sdl_mixer, libmikmod, "Any one of these will do |
215 |
> for sound.") |
216 |
> |
217 |
> In interactive mode, the user will see: |
218 |
> |
219 |
> # emerge --interactive foo.ebuild |
220 |
> Calculating dependencies.. done! |
221 |
> >>> emerge foo to / |
222 |
> Choose: sdl_mixer, libmikmod (default sdl_mixer): |
223 |
> Specifics: Any one of these will do for sound. |
224 |
> [sdl_mixer/libmikmod] |
225 |
> |
226 |
> sdl_mixer is default, simply because it is named first. That |
227 |
> is, the ebuild |
228 |
> should pass the name of what it wants as default first. |
229 |
> Of course this will accept more than two flags at a time. |
230 |
> There is no Description (only Specifics) because this is not |
231 |
> a 'generic' |
232 |
> situation. An ebuild can request choice between any |
233 |
> combination of flags in |
234 |
> any order. |
235 |
> The last parameter passed to Which is thus the Specifics |
236 |
> string, all the |
237 |
> others are taken to be names of With flags. |
238 |
> |
239 |
> In non-interactive mode, the which function will simply |
240 |
> return the first flag |
241 |
> named, sdl_mixer in this example. |
242 |
> |
243 |
> As above, a flag undefined in make.globals and make.conf can |
244 |
> be used. No |
245 |
> default value for it is needed. You can just pass a list of flags. |
246 |
> |
247 |
> ------- |
248 |
> |
249 |
> Subsystem: default values of mutually exclusive choices - groups: |
250 |
> |
251 |
> It is true that an ebuild can pass any list of flags and get |
252 |
> a result. |
253 |
> However, for noninteractive operation, it would be very |
254 |
> useful to assign |
255 |
> default results outside the ebuild (i.e. not by selecting the |
256 |
> order of flags |
257 |
> passed to which). |
258 |
> For this purpose, flags can be 'registered' in make.globals |
259 |
> (or make.conf) as |
260 |
> belonging to a group (or several groups). An example make.* entry: |
261 |
> |
262 |
> sdl_mixer=yes (audio-out) |
263 |
> Description of sdl_mixer. |
264 |
> |
265 |
> libmikmod=yes (audio-out) |
266 |
> Description of libmikmod. |
267 |
> |
268 |
> The entries thus classified will be arranged by group. The |
269 |
> first flag in a |
270 |
> group to be listed becomes the default choice for that group. |
271 |
> |
272 |
> A flag can be part of any number of groups, or none. Example: |
273 |
> libggi=!libsdl (audio-out,video-out) |
274 |
> |
275 |
> Whenever an ebuild calls which on flags that are all part of |
276 |
> one group (e.g. |
277 |
> audio-out), this becomes the default for an interactive |
278 |
> choice, and the |
279 |
> result returned from a noninteractive one. |
280 |
> |
281 |
> The ebuild doesn't need to know the name of the group, or |
282 |
> even that there is |
283 |
> one. |
284 |
> |
285 |
> And, if even this isn't enough, we could add a Groups section |
286 |
> in make.* which |
287 |
> would: |
288 |
> 1. Optionally define a group as a list of flags, even if |
289 |
> those flags don't |
290 |
> specify themselves as part of the group. |
291 |
> 2. Define the group's order. |
292 |
> 3. Provide an extra description of the group. |
293 |
> For example: |
294 |
> |
295 |
> <groups> |
296 |
> audio-out=libmikmod,sdl_mixer,libggi |
297 |
> The audio-out group is foobar foobar foo. |
298 |
> |
299 |
> In this example, the order in whch the flags are defined is |
300 |
> overriden, and |
301 |
> libmikmod is set to be the new default choice. |
302 |
> |
303 |
> The reason we have an entire list and not just a default |
304 |
> value is subgroups. |
305 |
> If an ebuild asks |
306 |
> result=which(sdl_mixer,mikmod,libggi,"select audio lib") |
307 |
> then it will get libmikmod (from noninteractive mode) since |
308 |
> it's first in the |
309 |
> list defined in make.*'s <groups>. |
310 |
> If however it says result=which(libggi,libmikmod,"subgroup |
311 |
> choice") then it |
312 |
> will get sdl_mixer because that's the best ('foremost') |
313 |
> choice left without |
314 |
> sdl_mixer. |
315 |
> |
316 |
> ------- |
317 |
> |
318 |
> Comments welcome! |
319 |
> |
320 |
> -- |
321 |
> |
322 |
> Dan Armak |
323 |
> Gentoo Linux Developer |
324 |
> Matan, Israel |
325 |
> |
326 |
> _______________________________________________ |
327 |
> gentoo-dev mailing list |
328 |
> gentoo-dev@××××××××××.org |
329 |
> http://cvs.gentoo.org/mailman/listinfo/gentoo-dev |
330 |
> |