Gentoo Archives: gentoo-alt

From: Markus Duft <mduft@g.o>
To: gentoo-alt@l.g.o
Subject: Re: [gentoo-alt] branched prefix chaining
Date: Wed, 08 Jul 2009 06:03:34
Message-Id: 1247032845.4495.32.camel@localhost
In Reply to: [gentoo-alt] branched prefix chaining by Viktor Griph
1 On Wed, 2009-07-08 at 00:58 +0200, Viktor Griph wrote:
2 > Hi,
3 >
4
5 Hey!
6
7 Good to hear that somebody (apart from me/us) is playing with this :) i
8 will try and (as the author of the patch) add some useful comments ;)
9
10 > I've just started playing with the prefix-chaining abilities, and I
11 > find it quite useful. However what is the reason for not allowing
12 > multiple read only prefixes in a chained prefix? I'm currently working
13 > with a setup where the policy is that each application should be
14 > installed in it's own prefix, which means that if there should be only
15 > one log chain of prefixes it would possible get very long, whereas if
16 > it were branching it could be kept at a relatively low depth.
17
18 The reason for not allowing multiple prefixes in one level of the chain
19 is to keep things simple in the first place. There may be problems when
20 the same package can be found in multiple parent prefixes on the same
21 tier, as portage would need to choose one of them to use, but it won't
22 be guaranteed that that version will be really linked, since at build
23 time, all of them would be reachable by the compiler/linker (it of
24 course needs to know all of the parents). (ATTENTION: the above applies
25 only if inheriting RDEPENDS, not if only DEPENDS are inherited).
26
27 Also I couldn't think of a real use case where this would be absolutely
28 necessary. i admit that I'm slightly influenced by the use case here at
29 our company: we have one "system prefix", building upon that we have a
30 "framework prefix" and again, building upon that the "application
31 prefix".
32 the "system prefix" is shared upon all "framework prefixes". each
33 "framework prefix" is used by multiple "application prefixed" each of
34 them containing one final application. So we're perfect with a one
35 dimensional chain. (the "one dimensional" is from the POV of each
36 involved prefix, of course. looking at the whole picture we have this:
37
38 s1
39 |
40 +--+--+
41 f1 f2 f3
42 | | +--+
43 | | | |
44 a1 a2 a3 a4
45
46 so, none of the applications (a1-a4) know of each other. those prefixes
47 are unrelated and each application has a one dimensional direct chain to
48 s1).
49
50 could you describe your current and desired setup a little closer? would
51 be interesting... :)
52
53 >
54 > I'm tempted to try to change this myself, but before I do I'd like to
55 > get some input on why it was made the way it is. A few things I've
56 > noticed about the chaining prefixes as they are now:
57 > 1) the prefixes are linked in with no particular order in portage, but
58 > follows the chain in /etc/profile. I'm not sure if the portage order
59 > makes any difference as I've very little experience with this yet, but
60 > I think that those prefixes should be included in order as well.
61
62 what do you mean by "linked in with no particular order in portage"?
63 since the chaining is a strictly one dimensional chain (at least
64 ATM :)), the ordering is implicit. the top most prefix (it may or may
65 not contain it's own portage btw.) reads it's config, finds a readonly
66 prefix, reads that one's config, finds another one, etc. this way the
67 whole chain of configurations is built up during portage startup. hope
68 that was clear...?
69
70 >
71 > My idea on how branching prefixes could be done is similar to how the
72 > chaining prefixes work now, but with a little extra logic required to
73 > not include the same prefix more than once.
74
75 so you want something like this?:
76
77 a
78 |
79 +--+--+
80 b c d
81 +--+ |
82 e |
83 +--+
84 f
85
86 where f inherits from *all* prefixes? i guess there is a reason why
87 modern OO languages forbid multiple inheritance - it's a headache! :)
88 And still those languages are quite popular, and seemingly don't lack
89 any obvious big features. one of them is java, so lack of multiple
90 inheritance can't really hurt, can it?
91
92 > I think that changing the current inclusion to a breath first tree
93 > traversal with marking of already visited prefixes should work for the
94 > portage tree. When it comes to the environment I really don't see why
95 > it is made from /etc/profile recursively currently. Wouldn't it make
96 > more sence to have env-update simply source the profile.env of the
97 > parent prefix, and poin it with the env.d at the current level, and
98 > possible include a utility for recursively doing env-update in several
99 > prefix-chains if needed. At least that's the way I think would work
100 > the best when it comes to multiple readonly prefixes. Is there any
101 > reason why this wouldn't work? (Other than the fact that this would be
102 > a depth first inclusion instead of a breath first inclusion as I
103 > suggested for portage, if the order matters.)
104
105 phew. IIRC it took me a few days to get that right in my head only,
106 without implementing it (implementation was done in a few minutes
107 actually) - thinking back to the problems i faced, the only one that
108 jumps to my mind right now was that a patched env-update would not
109 suffice because any of the parent prefix can change without us getting
110 any note of it. (however of course there are more problems of that kind,
111 like the parent prefix not knowing us, so he won't prevent unmerging
112 libraries the child prefix needs).
113
114 also, changing the type of inheritance (RDEPEND, DEPEND, PDEPEND) would
115 require an env-update call - one thing that for sure is forgotten at
116 least half of the time.
117
118 if more comes to my mind, i will tell you :)
119
120 i'd be happy to discuss my points, if you find them void ;)
121
122 Cheers, Markus
123
124 >
125 >
126 > Viktor Griph
127 >

Replies

Subject Author
Re: [gentoo-alt] branched prefix chaining Viktor Griph <viktor@×××××.se>