1 |
On 01/20/2018 04:23 PM, Alec Warner wrote: |
2 |
> On Sat, Jan 20, 2018 at 7:10 PM, Zac Medico <zmedico@g.o |
3 |
> <mailto:zmedico@g.o>> wrote: |
4 |
> |
5 |
> diff --git a/pym/portage/dep/dep_check.py b/pym/portage/dep/dep_check.py |
6 |
> index 7cf338819..c56f545ec 100644 |
7 |
> --- a/pym/portage/dep/dep_check.py |
8 |
> +++ b/pym/portage/dep/dep_check.py |
9 |
> @@ -499,7 +499,8 @@ def dep_zapdeps(unreduced, reduced, myroot, |
10 |
> use_binaries=0, trees=None): |
11 |
> cp_map[avail_pkg.cp] = avail_pkg |
12 |
> |
13 |
> new_slot_count = (len(slot_map) if graph_db is None else |
14 |
> - sum(not graph_db.match_pkgs(slot_atom) for |
15 |
> slot_atom in slot_map)) |
16 |
> + sum(not graph_db.match_pkgs(slot_atom) for |
17 |
> slot_atom in slot_map |
18 |
> + if not slot_atom.cp.startswith("virtual/"))) |
19 |
> |
20 |
> |
21 |
> I see this logic all over dep_zapdeps. But AFAIK its already using |
22 |
> instances of Atom here. |
23 |
> Can't we encode the cost inside of Atom, so that we don't need to carve |
24 |
> out that virtual atoms are 0 cost? |
25 |
> |
26 |
> Then we could write something like: |
27 |
> |
28 |
> new_slot_count = len(slot_map) if graph_db is None else |
29 |
> sum(slot_atom.cost() for slot_atom in slot_map if not |
30 |
> graph_db.match_pkgs(slot_atom)) |
31 |
> |
32 |
> Then virtuals would just have a cost() of 0. And others could have other |
33 |
> costs (or just 1.) |
34 |
|
35 |
That seems like a very practical approach. However, the cost is actually |
36 |
a property of the matched package rather than the atom itself. It's only |
37 |
because of GLEP 37 that we can treat the "virtual" category specially, |
38 |
but GLEP 37 actually says nothing about the "virtual" category! There's |
39 |
also a java-virtuals category! |
40 |
|
41 |
This mess was the motivation for my PROPERTIES=virtual suggestion: |
42 |
|
43 |
https://archives.gentoo.org/gentoo-dev/message/9d449a18a96a25a547fcfd40544085cf |
44 |
|
45 |
If we implement something like PROPERTIES=virtual, then cost becomes a |
46 |
property of the package instance rather than the atom. |
47 |
-- |
48 |
Thanks, |
49 |
Zac |