Gentoo Archives: gentoo-dev

From: Jason Stubbs <jstubbs@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Virtuals - required?
Date: Sun, 27 Jun 2004 05:44:28
Message-Id: 200406271441.50728.jstubbs@gentoo.org
In Reply to: Re: [gentoo-dev] Virtuals - required? by Thomas de Grenier de Latour
1 -----BEGIN PGP SIGNED MESSAGE-----
2 Hash: SHA1
3
4 On Sunday 27 June 2004 12:03, Thomas de Grenier de Latour wrote:
5 > On Sun, 27 Jun 2004 09:47:25 +0900
6 > Jason Stubbs <jstubbs@g.o> wrote:
7 > > It would be possible to keep /etc/portage/virtuals.
8 >
9 > Maybe that's possible, but i don't see how. The system you've
10 > proposed is much more powerful than the current one, and that's
11 > a problem: a virtual is no more a simple choice between several
12 > possible packages, thus user preferences can no more be a simple
13 > (set of) package(s) choice.
14
15 When a metaebuild is encountered, check /etc/portage/virtuals for a match. If
16 one exists, prepend the settings to the RDEPEND. Maybe embed is a better word
17 than prepend. Here is what I'm thinking:
18
19 virtual/x11:RDEPEND="|| ( x11-base/xorg-x11 x11-base/xfree )"
20 portage/virtuals:virtual/x11 x11-base/xfree x11-base/xorg-x11
21 expand to "|| ( x11-base/xfree x11-base/xorg-x11
22 || ( x11-base/xorg-x11 x11-base/xfree ) )"
23
24 > To make use of a simple virtuals file like the one currently
25 > available, you would have to limit expressiveness of the
26 > dependency formulae you allow in virtual ebuilds. You must allow
27 > "|| ( A B C )" but forbid "|| ( A && ( B C ) )".
28 > Imo, you can't really use the usual (R)DEPEND but must define a
29 > new kind of formula where only depend atoms and arch? or useflag?
30 > statements operators are allowed. The list of subformulae would be
31 > interpreted as a global disjonction.
32
33 I don't see why the expressiveness must be limited. If there is actually a
34 need, I'll throw this idea away as the whole point is code simplification.
35
36 > > Personally, I think it is easier with my proposal. Presently, it
37 > > requires scanning for PROVIDE in every ebuild in the tree. With
38 > > my proposal, it would only require checking the RDEPEND of the
39 > > metaebuild.
40 >
41 > Here again, the problem is the expressiveness of your model. If
42 > you don't require a simple disjonction of dep atoms but allow an
43 > arbitrary depencies formula, it becomes hard to calculate its set
44 > of models. In general case, the best you can answer is the formula
45 > where "arch?" or "useflag?" statements have been interpreted. It
46 > means you have to expect answers of the form "A or (B and C)" for
47 > instance. That was simply impossible with the original virtuals
48 > system, that's why i think it was easier (answers would have
49 > always been of form "A or B or C").
50 > But if you take the simplified depend formulae i've described
51 > above, then i agree it becomes easy.
52 > That say, what is still hard is to know what virtuals a given
53 > package instanciates (which is required for instance for a correct
54 > implementation of the buildsyspkg feature).
55
56 I don't understand the problem you're describing here.
57
58 > > > - it may make packages cleaning a bit harder: [snip]
59 > >
60 > > That is a difficult problem to get around, but exists regardless
61 > > of how virtuals are implemented.
62 >
63 > Exists a bit less with <=.50 implementations: with this versions,
64 > it's easy to edit the edb/virtuals file to delete a few obsolete
65 > duplicates, and then depclean works fine to finish the cleanup a
66 > safe but effective way.
67 > I've not experimented much with current .51_pre tho, so i won't
68 > comment on this one.
69
70 .51_pre removes /var/cache/edb/virtuals altogether and scans
71 /var/db/pkg/*/*/PROVIDE instead. Hence, the order of the virtuals is
72 arbitrary. /etc/portage/virtuals can still be used to do what your describing
73 here though.
74
75 > > The only way to fix it with my scheme would be to fix depclean
76 >
77 > Yes. It would need addition of special heuristics for
78 > "metaebuilds" dependencies. But for that to work, again, you need
79 > to restrict expressiveness of the dep formula. For instance,
80 > assuming deps are of the form i've described above, then you can
81 > make a depclean that search the smallest solution to this
82 > constraints set:
83 > - at least one of the possible packages must be kept;
84 > - if one is in world, then keep at least this one;
85 > - if one is depended directly by another package, then keep at
86 > least this one;
87 > - if none of the above two cases is verified, then keep at least
88 > the first packages from the list of candidates.
89 > (or something like that...)
90 > My point is that if packagers start to write virtuals with complex
91 > dependencies formula (like "|| ( A && ( B C ) )"), then this
92 > optimal calculation of what must be kept and what can be cleaned
93 > becomes much more tricky.
94
95 See my comment below. The special heuristics are needed already...
96
97 > > (which is broken in many other ways as well...)
98 >
99 > Agreed...
100 >
101 > > Actually, this problem is worse than you've described. app/fooA
102 > > depends on "|| ( bar/pkgA bar/pkgB )" and bar/pkgB is installed
103 > > as a dep from app/fooB when app/fooA is emerged. Afterward,
104 > > bar/pkgA is installed and app/fooB is uninstalled. depclean
105 > > removes bar/pkgB and app/fooA more than likely breaks.
106 >
107 > Well, yes, that's also bad, but at least this one is right
108 > and optimal from the specified dependencies point of view. In
109 > the case i've described, that was not even true.
110 > The issue in your example is more yet another proof that binaries
111 > depencies are more strict than ebuilds dependencies can be. That's
112 > close to the openssl 0.9.6 vs 0.9.7 issues (ie. packages can build
113 > against one or the other, but once built they can run only with
114 > the right one). Or did i misunderstood your example?
115
116 You misunderstood. Take this example from games-board/hexxagon-0.3.1:
117 DEPEND="|| (
118 readline? ( sys-libs/readline )
119 gtk? ( =x11-libs/gtk+-1* )
120 sys-libs/readline
121 )"
122 This package can build against either sys-libs/readline or x11-libs/gtk+-1*
123 but not both. The USE flags complicate it for purposes of the example, but
124 almost all ebuilds that use this syntax are similar.
125
126 emerge -C sys-libs/readline
127 emerge =x11-libs/gtk+-1*
128 USE="-readline gtk" emerge =games-board/hexxagon-0.3.1
129 emerge sys-libs/readline
130 USE="-*" emerge depclean
131
132 Assuming no other packages come into play, hexxagon is now broken as gtk+
133 would be unmerged. I think there's absolutely no way to get around this other
134 than to record what the package was built against. What I was saying earlier
135 is that this is a current problem which must be fixed regardless of any
136 change to virtuals.
137
138 > > Whether it be installed into the var db or not was undecided
139 > > and something I hadn't given much thought to. I have no issue
140 > > with copying it to the the var db.
141 >
142 > Imo, it should appear in db, but as a special case (that would
143 > hence not be backward compatible):
144
145 It would be backward compatible as long as the virtuals are kept in the
146 profiles for some time as well. Portage checks if a package atom is virtual
147 before checking any database.
148
149 > - appear, because it's a necessary link in the backward
150 > dependencies calculation.
151 > - as a special case, because its presence should not be enough to
152 > satisfy a dependency by itself. Think of emerging something that
153 > depends on virtual/jre, then decide the default jre (lets say
154 > blackdown-jdk) sucks and uninstall it, and then install something
155 > else that depends on virtual/jre... result is a non-working
156 > package. I know that you can't track deep dependencies every time
157 > a package gets installed in current portage. Technicaly, this is
158 > just one more case where a broken package is used to satisfy a
159 > dependency just because it's there. That's nothing new, but it's
160 > much more error prone than with usual packages because user don't
161 > really know about this virtuals and hence is not really
162 > responsible for the mess he introduces when he uninstall, for
163 > instance, blackdown-jdk.
164
165 This is very easy. Just check for RESTRICT="metaebuild".
166
167 > So what i suggest is that metaebuilds appear in db, but when they
168 > are used in a dep calculation, the algorithm always goes one step
169 > further(just like with -u) to check whether at least one concrete
170 > packages is really there. And if it's not, then pick the best
171 > concrete package taking /etc/portage/virtuals and ordering of the
172 > depend formula into account (just like if the virtual wasn't
173 > installed).
174
175 One other thing as well... /var/db/pkg is not currently used for dep
176 calculation. When it does become used, $PORTDIR's copy of the metaebuild
177 should be used instead if it exists.
178
179 Regards,
180 Jason Stubbs
181 -----BEGIN PGP SIGNATURE-----
182 Version: GnuPG v1.2.4 (GNU/Linux)
183
184 iQCVAwUBQN5eHVoikN4/5jfsAQK6igP+PfUJu4R79Jio1B63UBUVBvogqbzY7pUS
185 MuKxBlQUcXqMBOOvFkX/AufzpXvHjMYaEs5Kizb/leYVUy9+7coq/eLZLSc2v/Hf
186 7jLMLCVOmCoiu9KJdMZ2O7gdmQHzlSiODTBcSnwo4308z0wNmDN8SQU1YUsHqxJ3
187 WbxjW5L4q8Q=
188 =6fug
189 -----END PGP SIGNATURE-----
190
191 --
192 gentoo-dev@g.o mailing list

Replies

Subject Author
Re: [gentoo-dev] Virtuals - required? Thomas de Grenier de Latour <degrenier@×××××××××××.fr>