1 |
On Sun, Aug 27, 2006 at 10:26:28AM +0200, Simon Stelling wrote: |
2 |
> Brian Harring wrote: |
3 |
> >> diefunc() |
4 |
> >> dump_trace() |
5 |
> > |
6 |
> > these are general utility, not debugging. |
7 |
> |
8 |
> Where would you stick them? 'die' to 'ebuild helpers' and 'dump_trace' |
9 |
> to 'internals'? |
10 |
|
11 |
util, same for hasq. |
12 |
|
13 |
> > If you're going to try breaking the beast up, suggest you go the step |
14 |
> > further and break up what must be supplied from the ebuild.sh |
15 |
> > implementation, and what is bound to the ebuild's environment. |
16 |
> > |
17 |
> > |
18 |
> >> Internal eclass functions: |
19 |
> >> newdepend() |
20 |
> >> newrdepend() |
21 |
> >> newpdepend() |
22 |
> >> do_newdepend() |
23 |
> > |
24 |
> > These aren't eclass functions- usable without involving eclasses. |
25 |
> > inherit ought to be in internal eclass functions also (yes it's user |
26 |
> > visible, but it's also ebuild.sh implementation specific). |
27 |
> |
28 |
> Where to put them, then? |
29 |
|
30 |
...they're ebuild functions. stick them with the other ebuild |
31 |
functions (use_with fex). |
32 |
|
33 |
Personally, I think trying to seperate it up at this level is probably |
34 |
not a great idea; splitting the EAPI specific bits into seperate |
35 |
modules, yes, but when/if EAPI=1 arrives changing chunks, it's going |
36 |
to be a mess going through each module and ifdef'ing functions. |
37 |
|
38 |
|
39 |
> >> I moved them into own files within a subdir in bin/, called modules, and |
40 |
> >> source these files at the right time, so that nothing changes |
41 |
> >> functionality wise. The global scope code I left untouched, except for a |
42 |
> >> bunch of exports that set sane defaults for the do*/new* helpers. |
43 |
> >> |
44 |
> >> This cuts down ebuild.sh to 403 lines, which makes it far more readable, |
45 |
> >> IMO. |
46 |
> |
47 |
> > Except there are now magic vars hidden away in submodules. If trying |
48 |
> > to seperate it into seperate blocks, document 'em. |
49 |
> |
50 |
> Uhm, how would that documentation part work? What exactly do you want |
51 |
> documented? (What do "it" and "'em" refer to?) |
52 |
> |
53 |
> About the magic vars.. I wasn't sure either whether putting the defaults |
54 |
> into the modules was a good idea. I thought it would be good because |
55 |
> they are not used anywhere else (didn't check), but I can just as well |
56 |
> stick them back into ebuild.sh. |
57 |
|
58 |
Sticking magic vars (globals mostly, eclass_depth for example) in |
59 |
locations seperate from the functionality that uses it needs to be |
60 |
documented; moving all of the globals up to ebuild.sh means that for |
61 |
any code to reuse those modules without using ebuild.sh, it has to |
62 |
maintain it's own globals list. |
63 |
|
64 |
So... magic vars need to stay in the module that uses them, and need |
65 |
documentating if another module relies on it; with ebuild.sh, this |
66 |
isn't an issue, everything is guranteed loaded, with submodules it's a |
67 |
bit more of an issue. |
68 |
|
69 |
|
70 |
> >> I also set all the functions that aren't meant to be overridden by saved |
71 |
> >> env, profile bashrc, portage bashrc or ebuilds/eclasses readonly. |
72 |
> > |
73 |
> > Don't think much thought was put into this tbh- use* and has* (all but |
74 |
> > useq and hasq basically) are bound to the ebuild environment. |
75 |
> |
76 |
> This is actually true. |
77 |
> |
78 |
> > Why? Because they got mangled transitioning from 2.0.50 2.0.51, for |
79 |
> > the ebuild to function properly it needs to use the original func from |
80 |
> > the environment, not what the ebuild.sh implementation tries to force. |
81 |
> > |
82 |
> > Identified all of them that are affected by this? |
83 |
> |
84 |
> Well, as it stands now, all variables except the sandbox related ones |
85 |
> are defined after env & bashrc are sourced and before the ebuild is |
86 |
> sourced. That means that the env can't override them, which means that |
87 |
> they are considered implementation specific in the current |
88 |
> implementation. I agree that consideration is nonsense, though ;) |
89 |
> |
90 |
> So, to address the problem: What functions are bound to the ebuild |
91 |
> rather than ebuild.sh? |
92 |
pkg_*, src_*, *opts, *into, *depend . |
93 |
|
94 |
Basically, think of which are implementation specific (portageq) vs |
95 |
which aren't directly reliant on implementation details. If it's not |
96 |
implementation specific, it's likely bound to the ebuild env. |
97 |
|
98 |
> Beside {use,has}{,v} I don't know any. |
99 |
> |
100 |
> > Further, all of these are still overridable by *bashrc and env. |
101 |
> |
102 |
> How? |
103 |
readonly -f . |
104 |
|
105 |
bashrc, env, etc, all can force different definitions of functions. |
106 |
|
107 |
This is why ebd sets it's required functions and marks them readonly |
108 |
*before* it even goes near ebuild data; do it the other way around, |
109 |
you're not guranteeing anything. |
110 |
|
111 |
|
112 |
> > Drop the readonly crap; it's not actually blocking anything, just |
113 |
> > attempting to catch non real issues; in the process, it actually is a |
114 |
> > step in the wrong direction. |
115 |
> |
116 |
> I will drop it for now, but I would like to know the answers to above |
117 |
> questions nevertheless. |
118 |
> |
119 |
> > Reordering is a bit arbitrary, but fine. Attempted env changes, would |
120 |
> > avoid those. |
121 |
> |
122 |
> My primary goal is to cut down ebuild.sh to a managable size. I don't |
123 |
> see how that can be solved with a different env handling, tbh. |
124 |
|
125 |
Env handling affects the flow of the code; never said it reduces the |
126 |
total size of code though (just said don't go screwing with readonly). |
127 |
~harring |