1 |
On Wed, 31 Jan 2007 12:27:10 -0500 |
2 |
Alec Warner <antarus@g.o> wrote: |
3 |
|
4 |
> > Hmm; one could get the same benefit by introducing a new interface |
5 |
> > (e.g. pkg_env_check()) which is defined to return true if the |
6 |
> > environment is ok, false otherwise (with some text to stdout, |
7 |
> > perhaps). The package manager would then run this function, after |
8 |
> > building the depgraph and finding the candidate packages to merge, |
9 |
> > for each candidate package - if any package fails is env_check, |
10 |
> > none of the packages get emerged. Note this is then completely |
11 |
> > independent of depgraph creation. |
12 |
> > |
13 |
> > In the 'tr1' example, I'd imagine something like this: |
14 |
> > |
15 |
> > use.local.desc: boost: Use boost library for tr1 rather than gcc's. |
16 |
> > |
17 |
> > ebuild: |
18 |
> > |
19 |
> > ... |
20 |
> > inherit ... toolchain-funcs versionator ... |
21 |
> > ... |
22 |
> > DEPEND=... boost? ( dev-libs/boost ) ... |
23 |
> > ... |
24 |
> > pkg_env_check() { |
25 |
> > use boost && return 0 |
26 |
> > version_is_at_least "4.1" $(gcc-version) && return 0 |
27 |
> > echo "Either USE boost, or switch to gcc later than 4.1" |
28 |
> > } |
29 |
> > |
30 |
> > |
31 |
> > (with a default definition, "pkg_env_check() { return 0; }" ) |
32 |
> |
33 |
> In an ideal system you'd want this stuff in the metadata cache so that |
34 |
> the resolver can deal with it up front. |
35 |
|
36 |
You're talking about the metadata on the host, rather than the stuff on |
37 |
the rsync servers? I'm not sure you could cache the results even on |
38 |
the host - you would need to know what could affect the results so as |
39 |
to know when the cached information is out of date and has to be |
40 |
recalculated. That would either have to checked on every emerge, or |
41 |
made a separate switch (i.e. rely on the user to tell emerge when the |
42 |
environment has changed). |
43 |
|
44 |
> All resolution is a brute |
45 |
> force metadata search; and assuming we had all the necessary data up |
46 |
> front, we can optimize the search there (see pkgcore and restriction |
47 |
> subsystem) versus IMHO doing a 'dumb' search and then running through |
48 |
> a list of criteria for inclusion. |
49 |
> |
50 |
> This is the same reason why built_with_use in pkg_setup is really just |
51 |
> use_deps; these metadata should be included during resolution, not |
52 |
> after. |
53 |
|
54 |
My concern about dynamic dependencies runs to use deps, as well :) |
55 |
One could consider use-deps to be a special case of Marius' active |
56 |
checks. "how pkg P was built" isn't so different from "slot S of P is |
57 |
active" in terms of dep-graph creation; both are asking about the |
58 |
state of host & target systems, rather than the tree. |
59 |
|
60 |
In the case of USE deps, things are saner because the data doesn't |
61 |
change without the package manager knowing about it. Effectively the |
62 |
depgraph becomes static w.r.t. the tree + installation record (rather |
63 |
than just static w.r.t. the tree). With active checks implemented in |
64 |
the depgraph, however, that is no longer the case - the depgraph can |
65 |
change independently of the tree and the installation record. |
66 |
|
67 |
> With that said, I'm not sure how easy it would be to rewrite that |
68 |
> code; and this is simpler in that it's just a few bash functions as |
69 |
> opposed to more resolver foo. |
70 |
|
71 |
There's a lot to be said for keeping things simple, of course :) It's |
72 |
easy enough to mess up things like dep-graphs in any case - introducing |
73 |
these sorts of dynamic dependencies can render it substantially more |
74 |
complex. |
75 |
|
76 |
Another way to look at it, is to consider how often this sort of thing |
77 |
comes up. My understanding is that it is relatively rare; across the |
78 |
10,000+ packages in the tree only a handful use 'built_with_use' fex. |
79 |
That makes a strong case for having a simple solution in the near term, |
80 |
and re-visit if it becomes commonplace. |
81 |
|
82 |
-- |
83 |
Kevin F. Quinn |