1 |
For cases such as || ( X <A-2 ), where X is unsatisfiable and A-1 is |
2 |
installed, fix dep_zapdeps to make the correct choice. |
3 |
--- |
4 |
pym/portage/dep/dep_check.py | 10 ++++ |
5 |
pym/portage/tests/resolver/test_or_choices.py | 73 +++++++++++++++++++++++++++ |
6 |
2 files changed, 83 insertions(+) |
7 |
|
8 |
diff --git a/pym/portage/dep/dep_check.py b/pym/portage/dep/dep_check.py |
9 |
index 22eed96..4386b5e 100644 |
10 |
--- a/pym/portage/dep/dep_check.py |
11 |
+++ b/pym/portage/dep/dep_check.py |
12 |
@@ -287,6 +287,7 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None): |
13 |
unsat_use_non_installed = [] |
14 |
other_installed = [] |
15 |
other_installed_some = [] |
16 |
+ other_installed_any_slot = [] |
17 |
other = [] |
18 |
|
19 |
# unsat_use_* must come after preferred_non_installed |
20 |
@@ -301,6 +302,7 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None): |
21 |
unsat_use_non_installed, |
22 |
other_installed, |
23 |
other_installed_some, |
24 |
+ other_installed_any_slot, |
25 |
other, |
26 |
) |
27 |
|
28 |
@@ -504,6 +506,14 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None): |
29 |
other_installed.append(this_choice) |
30 |
elif some_installed: |
31 |
other_installed_some.append(this_choice) |
32 |
+ |
33 |
+ # Use Atom(atom.cp) for a somewhat "fuzzy" match, since |
34 |
+ # the whole atom may be too specific. For example, see |
35 |
+ # bug #522652, where using the whole atom leads to an |
36 |
+ # unsatisfiable choice. |
37 |
+ elif any(vardb.match(Atom(atom.cp)) for atom in atoms |
38 |
+ if not atom.blocker): |
39 |
+ other_installed_any_slot.append(this_choice) |
40 |
else: |
41 |
other.append(this_choice) |
42 |
|
43 |
diff --git a/pym/portage/tests/resolver/test_or_choices.py b/pym/portage/tests/resolver/test_or_choices.py |
44 |
index 90e6814..d9d14f0 100644 |
45 |
--- a/pym/portage/tests/resolver/test_or_choices.py |
46 |
+++ b/pym/portage/tests/resolver/test_or_choices.py |
47 |
@@ -132,3 +132,76 @@ class OrChoicesTestCase(TestCase): |
48 |
self.assertEqual(test_case.test_success, True, test_case.fail_msg) |
49 |
finally: |
50 |
playground.cleanup() |
51 |
+ |
52 |
+ |
53 |
+ def testInitiallyUnsatisfied(self): |
54 |
+ |
55 |
+ ebuilds = { |
56 |
+ |
57 |
+ "app-misc/A-1" : { |
58 |
+ "EAPI": "5", |
59 |
+ "SLOT": "0/1" |
60 |
+ }, |
61 |
+ |
62 |
+ "app-misc/A-2" : { |
63 |
+ "EAPI": "5", |
64 |
+ "SLOT": "0/2" |
65 |
+ }, |
66 |
+ |
67 |
+ "app-misc/B-0" : { |
68 |
+ "EAPI": "5", |
69 |
+ "RDEPEND": "app-misc/A:=" |
70 |
+ }, |
71 |
+ |
72 |
+ "app-misc/C-0" : { |
73 |
+ "EAPI": "5", |
74 |
+ "RDEPEND": "|| ( app-misc/X <app-misc/A-2 )" |
75 |
+ }, |
76 |
+ |
77 |
+ } |
78 |
+ |
79 |
+ installed = { |
80 |
+ |
81 |
+ "app-misc/A-1" : { |
82 |
+ "EAPI": "5", |
83 |
+ "SLOT": "0/1" |
84 |
+ }, |
85 |
+ |
86 |
+ "app-misc/B-0" : { |
87 |
+ "EAPI": "5", |
88 |
+ "RDEPEND": "app-misc/A:0/1=" |
89 |
+ }, |
90 |
+ |
91 |
+ "app-misc/C-0" : { |
92 |
+ "EAPI": "5", |
93 |
+ "RDEPEND": "|| ( app-misc/X <app-misc/A-2 )" |
94 |
+ }, |
95 |
+ |
96 |
+ } |
97 |
+ |
98 |
+ world = ["app-misc/B", "app-misc/C"] |
99 |
+ |
100 |
+ test_cases = ( |
101 |
+ |
102 |
+ # Test bug #522652, where the unsatisfiable app-misc/X |
103 |
+ # atom is selected, and the dependency is placed into |
104 |
+ # _initially_unsatisfied_deps where it is ignored, causing |
105 |
+ # upgrade to app-misc/A-2 (breaking a dependency of |
106 |
+ # app-misc/C-0). |
107 |
+ ResolverPlaygroundTestCase( |
108 |
+ ["app-misc/A"], |
109 |
+ options = {}, |
110 |
+ success = True, |
111 |
+ mergelist = ['app-misc/A-1'] |
112 |
+ ), |
113 |
+ |
114 |
+ ) |
115 |
+ |
116 |
+ playground = ResolverPlayground(ebuilds=ebuilds, |
117 |
+ installed=installed, world=world, debug=False) |
118 |
+ try: |
119 |
+ for test_case in test_cases: |
120 |
+ playground.run_TestCase(test_case) |
121 |
+ self.assertEqual(test_case.test_success, True, test_case.fail_msg) |
122 |
+ finally: |
123 |
+ playground.cleanup() |
124 |
-- |
125 |
1.8.5.5 |