1 |
Fix new_slot_count to exclude virtual packages, since they are considered |
2 |
to have zero-cost. This solves an issue where the catalyst stage1 build |
3 |
would unexpectedly pull in static-dev to satisfy virtual/dev-manager, |
4 |
but eudev is the preferred choice. |
5 |
|
6 |
Bug: https://bugs.gentoo.org/645190 |
7 |
Fixes: 9fdaf9bdbdf5 ("dep_check: use DNF to optimize overlapping virtual || deps (bug 632026)") |
8 |
Reported-by: Ben Kohler <bkohler@×××××.com> |
9 |
--- |
10 |
pym/portage/dep/dep_check.py | 3 +- |
11 |
.../resolver/test_virtual_minimize_children.py | 61 ++++++++++++++++++++++ |
12 |
2 files changed, 63 insertions(+), 1 deletion(-) |
13 |
|
14 |
diff --git a/pym/portage/dep/dep_check.py b/pym/portage/dep/dep_check.py |
15 |
index 7cf338819..c56f545ec 100644 |
16 |
--- a/pym/portage/dep/dep_check.py |
17 |
+++ b/pym/portage/dep/dep_check.py |
18 |
@@ -499,7 +499,8 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None): |
19 |
cp_map[avail_pkg.cp] = avail_pkg |
20 |
|
21 |
new_slot_count = (len(slot_map) if graph_db is None else |
22 |
- sum(not graph_db.match_pkgs(slot_atom) for slot_atom in slot_map)) |
23 |
+ sum(not graph_db.match_pkgs(slot_atom) for slot_atom in slot_map |
24 |
+ if not slot_atom.cp.startswith("virtual/"))) |
25 |
|
26 |
this_choice = _dep_choice(atoms=atoms, slot_map=slot_map, |
27 |
cp_map=cp_map, all_available=all_available, |
28 |
diff --git a/pym/portage/tests/resolver/test_virtual_minimize_children.py b/pym/portage/tests/resolver/test_virtual_minimize_children.py |
29 |
index 6eb0409f2..287445e58 100644 |
30 |
--- a/pym/portage/tests/resolver/test_virtual_minimize_children.py |
31 |
+++ b/pym/portage/tests/resolver/test_virtual_minimize_children.py |
32 |
@@ -226,3 +226,64 @@ class VirtualMinimizeChildrenTestCase(TestCase): |
33 |
finally: |
34 |
playground.debug = False |
35 |
playground.cleanup() |
36 |
+ |
37 |
+ def testVirtualDevManager(self): |
38 |
+ ebuilds = { |
39 |
+ 'sys-fs/eudev-3.1.5': {}, |
40 |
+ 'sys-fs/static-dev-0.1': {}, |
41 |
+ 'sys-fs/udev-233': {}, |
42 |
+ 'virtual/dev-manager-0': { |
43 |
+ 'RDEPEND': ''' |
44 |
+ || ( |
45 |
+ virtual/udev |
46 |
+ sys-fs/static-dev |
47 |
+ )''' |
48 |
+ }, |
49 |
+ 'virtual/udev-0': { |
50 |
+ 'RDEPEND': ''' |
51 |
+ || ( |
52 |
+ >=sys-fs/eudev-2.1.1 |
53 |
+ >=sys-fs/udev-217 |
54 |
+ )''' |
55 |
+ }, |
56 |
+ } |
57 |
+ |
58 |
+ test_cases = ( |
59 |
+ # Test bug 645190, where static-dev was pulled in instead |
60 |
+ # of eudev. |
61 |
+ ResolverPlaygroundTestCase( |
62 |
+ [ |
63 |
+ 'virtual/dev-manager', |
64 |
+ ], |
65 |
+ success=True, |
66 |
+ mergelist=( |
67 |
+ 'sys-fs/eudev-3.1.5', |
68 |
+ 'virtual/udev-0', |
69 |
+ 'virtual/dev-manager-0', |
70 |
+ ), |
71 |
+ ), |
72 |
+ # Test static-dev preference. |
73 |
+ ResolverPlaygroundTestCase( |
74 |
+ [ |
75 |
+ 'sys-fs/static-dev', |
76 |
+ 'virtual/dev-manager', |
77 |
+ ], |
78 |
+ all_permutations=True, |
79 |
+ success=True, |
80 |
+ mergelist=( |
81 |
+ 'sys-fs/static-dev-0.1', |
82 |
+ 'virtual/dev-manager-0', |
83 |
+ ), |
84 |
+ ), |
85 |
+ ) |
86 |
+ |
87 |
+ playground = ResolverPlayground(debug=False, ebuilds=ebuilds) |
88 |
+ |
89 |
+ try: |
90 |
+ for test_case in test_cases: |
91 |
+ playground.run_TestCase(test_case) |
92 |
+ self.assertEqual(test_case.test_success, True, |
93 |
+ test_case.fail_msg) |
94 |
+ finally: |
95 |
+ playground.debug = False |
96 |
+ playground.cleanup() |
97 |
-- |
98 |
2.13.6 |