1 |
> |
2 |
> |
3 |
> Hmm; one could get the same benefit by introducing a new interface |
4 |
> (e.g. pkg_env_check()) which is defined to return true if the |
5 |
> environment is ok, false otherwise (with some text to stdout, perhaps). |
6 |
> The package manager would then run this function, after building the |
7 |
> depgraph and finding the candidate packages to merge, for each |
8 |
> candidate package - if any package fails is env_check, none of the |
9 |
> packages get emerged. Note this is then completely independent of |
10 |
> depgraph creation. |
11 |
> |
12 |
> In the 'tr1' example, I'd imagine something like this: |
13 |
> |
14 |
> use.local.desc: boost: Use boost library for tr1 rather than gcc's. |
15 |
> |
16 |
> ebuild: |
17 |
> |
18 |
> ... |
19 |
> inherit ... toolchain-funcs versionator ... |
20 |
> ... |
21 |
> DEPEND=... boost? ( dev-libs/boost ) ... |
22 |
> ... |
23 |
> pkg_env_check() { |
24 |
> use boost && return 0 |
25 |
> version_is_at_least "4.1" $(gcc-version) && return 0 |
26 |
> echo "Either USE boost, or switch to gcc later than 4.1" |
27 |
> } |
28 |
> |
29 |
> |
30 |
> (with a default definition, "pkg_env_check() { return 0; }" ) |
31 |
|
32 |
In an ideal system you'd want this stuff in the metadata cache so that |
33 |
the resolver can deal with it up front. All resolution is a brute force |
34 |
metadata search; and assuming we had all the necessary data up front, we |
35 |
can optimize the search there (see pkgcore and restriction subsystem) |
36 |
versus IMHO doing a 'dumb' search and then running through a list of |
37 |
criteria for inclusion. |
38 |
|
39 |
This is the same reason why built_with_use in pkg_setup is really just |
40 |
use_deps; these metadata should be included during resolution, not after. |
41 |
|
42 |
With that said, I'm not sure how easy it would be to rewrite that code; |
43 |
and this is simpler in that it's just a few bash functions as opposed to |
44 |
more resolver foo. |
45 |
-- |
46 |
gentoo-portage-dev@g.o mailing list |