Gentoo Archives: gentoo-dev

From: Matthieu Sozeau <mattam@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Dynamic SLOTs
Date: Mon, 09 Aug 2004 23:51:55
Message-Id: 20040809233520.GA11892@mattam.ath.cx
In Reply to: Re: [gentoo-dev] Dynamic SLOTs by Jason Stubbs
1 On Wed, Aug 04, 2004 at 08:34:24AM +0900, Jason Stubbs wrote:
2 > On Monday 02 August 2004 06:27, Martin Schlemmer wrote:
3 > > On Sun, 2004-08-01 at 04:01, Jason Stubbs wrote:
4 > > > On Sunday 01 August 2004 01:29, Mike Frysinger wrote:
5 > > > > On Saturday 31 July 2004 04:32 am, Jason Stubbs wrote:
6 > > > > > Well, the idea was that to create local USE flags of the form
7 > > > > > cc-${ARCH}, have the gcc ebuilds use them to configure the cross
8 > > > > > compiler and also have them control the the slot. The only real
9 > > > > > difference to what there is now would be that portage would be able
10 > > > > > to forecast the SLOT correctly.
11 > > > >
12 > > > > so the user would do USE="cc-arm" to get an arm cross compiler ?
13 > > > >
14 > > > > and then in the ebuild we'd have to do something like:
15 > > > > SLOT="cc-arm? ( blah )" ?
16 > > > > how'd would we specify a default slot ?
17 > > >
18 > > > SLOT="!cc-arm? ( !cc-foo? ( !cc-bar? ( !cc-baz ( defaultslot ) ) )"
19 > >
20 > > I really do not know why there hasn't been a '&&' and '||' logic
21 > > added yet? Will it really be that difficult to implement?
22 >
23 > It would take some time to implement and then testing time and what not. The
24 > main reason it hasn't been done is that it doesn't add anything that can't be
25 > done already.
26 >
27 > > > Terrible, no? This is gone anyway.
28 > >
29 > > What exactly do you mean by this?
30 >
31 > There is no point adding complexity to SLOT (and making dep calculation
32 > intricate and very slow) for the benefit of four ebuilds that could be
33 > implemented without the use of dynamic SLOTs anyway.
34 >
35 > As far as I know, allowing ${KV} as a SLOT was a quick hack to prevent
36 > previously installed kernel modules from being unmerged. It was/is a
37 > temporary solution until something better is found. That better solution is
38 > what I'm looking for here.
39 >
40 > Regards,
41 > Jason Stubbs
42 >
43
44 I'm happy those issues are being discussed as i didn't have much incentive to
45 post a feature request like what follows until now. First, some context:
46 I maintain the ML packages and particularly the ocaml ones. As some of
47 you may know, ocaml is not binary compatible from version to version and
48 it is required to recompile all dependent libraries on compiler updates,
49 (in the right order of course). This situation is very similar with Perl
50 or Python actually. Managing more than one version of such packages is
51 currently impossible (using portage only) AFAIK.
52
53 What I would like is a proper framework to deal with this
54 compilers/interpreters, and hopefully one general enough to deal with
55 cross-compilation too. I have hacked a solution on my own to deal with
56 the problem of incompatible compilers, using dynamic SLOTS, an ocaml
57 eclass and an ocaml-config script (similar to gcc-config). All ocaml
58 packages use this eclass which sets the slot to the compiler version and
59 sets some env vars (pathes) to allow flawless cohabitation of the
60 different compiler versions. It works just like a charm. I can update
61 all my packages for new versions of ocaml, do backward-compatibility
62 tests (i'm an ocaml dev) and if i wanted to, i could manage the CVS
63 version of ocaml and all ocaml packages using only portage and my
64 ocaml-config script.
65
66 The problem is obviously that i'm using portage for something it was not
67 intended to do (cleanly, at least). I have some (clear?) ideas about how it
68 could be done though, and i'm willing to give help. Here's my wish:
69
70 *** Portage support for compilers ***
71
72 I never heard anybody mention it, but I think it is required to get a
73 clean implementation. It would introduce some changes:
74
75 - Factorized, standard config files and utilities for all compilers/interpreters,
76 gcc, python, perl, ocaml, you name it. Configurations would be simply a set
77 of env vars, much like what gcc-config uses today.
78 You could set different configurations for different users etc...
79 A set of compiler policies (in the tree) would also be needed to
80 mention the fact that no ocaml compilers are compatible, but that
81 different gcc's are. A new flag could be added to emerge telling him
82 to rebuild automatically all packages that depended on a previous
83 compiler that is incompatible with a newer one.
84
85 - An ebuild metadata variable mentioning the compiler configurations
86 it depends on: a CDEPEND in fact, mentioning which compiler versions
87 it is compatible with. Unset would mean any, but when set, it could
88 well be cached and maybe some pruning in the dep tree could be done too.
89
90 - When invoking an ebuild for some package, portage would simply set
91 the compiler variables (for the compilers mentionned in CDEPEND).
92 The process of dependency checking would introduce one more step on
93 each depended-on pkg check : When a package dependent on the same language
94 as one mentionned is found, try to find an installed one matching the
95 dep requirements and the compiler policies, if none matches, use the
96 same policies as the current one for dep-checks etc... Informative
97 messages could be easily crafted in case of errors.
98
99 Now for the critics, i will point out that my scheme doesn't extend
100 ebuild syntax, which is good as most compiler compatibility problems can
101 be handled at once and for all packages. It would also factorize some
102 code that's between the various *-config scripts and as an added benefit
103 it would make every compiler update easy, getting rid of rebuild
104 scripts. The main advantage is a finer, more robust dependency
105 checking.
106
107 Here's a test case:
108 I've got ocaml-3.07, lablgl and lablgtk merged, i want the latest
109 mldonkey which requires lablgtk-1.2.7 which in turn works only with
110 ocaml-3.08. Portage will see that mldonkey has no particular preference
111 regarding compiler versions, it will check lablgtk which will tell that
112 it needs ocaml-3.08 and no other, so, as you have the opengl USE flag
113 set, portage will check ocaml compiler policies to see if lablgl in 3.07
114 would be compatible with lablgtk compiled with 3.08, the policy says no,
115 hence portage checks that lablgl can be compiled with 3.08 and finally
116 it sets its roadmap to: install 3.08, lablgl for 3.08, lablgtk for 3.08 and
117 finally merge mldonkey for 3.08.
118
119 Now for the cross-compiling, it would greatly help to have such support
120 built into portage. If i want to build ppc packages on my athlon,
121 i can tell portage to use a (more general than just compilers)
122 configuration that's declared incompatible with my current one
123 (as it should be) that sets the root to some other place, have a
124 particular make.conf, cross-compiler config etc... I'm just prospecting here.
125
126 That was just my 2 euros, i'm more than open to criticism about my
127 proposal which i ruminate for some time now (see bug #39246), and
128 i'll get it as far as I can, writing a GLEP and coding included (i'm in
129 holidays after all :).
130
131 Thanks for your patience !
132
133 -- mattam

Replies

Subject Author
Re: [gentoo-dev] Dynamic SLOTs Jason Stubbs <jstubbs@g.o>