1 |
This fixes a case with --onlydeps were dep_zapdeps would pull in an |
2 |
avoidable direct circular dependency on an onlydeps node. The logic |
3 |
changes only apply to --onlydeps, so there's no chance of regressions |
4 |
for cases when --onlydeps is not enabled. |
5 |
|
6 |
X-Gentoo-Bug: 524916 |
7 |
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=524916 |
8 |
--- |
9 |
pym/portage/dep/dep_check.py | 9 ++-- |
10 |
.../tests/resolver/test_onlydeps_circular.py | 49 ++++++++++++++++++++++ |
11 |
2 files changed, 53 insertions(+), 5 deletions(-) |
12 |
create mode 100644 pym/portage/tests/resolver/test_onlydeps_circular.py |
13 |
|
14 |
diff --git a/pym/portage/dep/dep_check.py b/pym/portage/dep/dep_check.py |
15 |
index 4386b5e..5dbe283 100644 |
16 |
--- a/pym/portage/dep/dep_check.py |
17 |
+++ b/pym/portage/dep/dep_check.py |
18 |
@@ -429,11 +429,10 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None): |
19 |
all_in_graph = False |
20 |
break |
21 |
circular_atom = None |
22 |
- if all_in_graph: |
23 |
- if parent is None or priority is None: |
24 |
- pass |
25 |
- elif priority.buildtime and \ |
26 |
- not (priority.satisfied or priority.optional): |
27 |
+ if not (parent is None or priority is None) and \ |
28 |
+ (parent.onlydeps or |
29 |
+ (all_in_graph and priority.buildtime and \ |
30 |
+ not (priority.satisfied or priority.optional))): |
31 |
# Check if the atom would result in a direct circular |
32 |
# dependency and try to avoid that if it seems likely |
33 |
# to be unresolvable. This is only relevant for |
34 |
diff --git a/pym/portage/tests/resolver/test_onlydeps_circular.py b/pym/portage/tests/resolver/test_onlydeps_circular.py |
35 |
new file mode 100644 |
36 |
index 0000000..f7cd0a2 |
37 |
--- /dev/null |
38 |
+++ b/pym/portage/tests/resolver/test_onlydeps_circular.py |
39 |
@@ -0,0 +1,49 @@ |
40 |
+# Copyright 2014 Gentoo Foundation |
41 |
+# Distributed under the terms of the GNU General Public License v2 |
42 |
+ |
43 |
+from portage.tests import TestCase |
44 |
+from portage.tests.resolver.ResolverPlayground import ResolverPlayground, ResolverPlaygroundTestCase |
45 |
+ |
46 |
+class OnlydepsTestCase(TestCase): |
47 |
+ |
48 |
+ def testOnlydeps(self): |
49 |
+ ebuilds = { |
50 |
+ "app-misc/A-1": { |
51 |
+ "EAPI": "5", |
52 |
+ "SLOT": "1", |
53 |
+ "DEPEND": "|| ( app-misc/B app-misc/A:1 )" |
54 |
+ }, |
55 |
+ "app-misc/A-2": { |
56 |
+ "EAPI": "5", |
57 |
+ "SLOT": "2", |
58 |
+ }, |
59 |
+ "app-misc/B-0": { |
60 |
+ "EAPI": "5", |
61 |
+ } |
62 |
+ } |
63 |
+ |
64 |
+ installed = { |
65 |
+ "app-misc/A-2": { |
66 |
+ "EAPI": "5", |
67 |
+ "SLOT": "2", |
68 |
+ } |
69 |
+ } |
70 |
+ |
71 |
+ test_cases = ( |
72 |
+ # bug 524916 - direct circular dep should not pull |
73 |
+ # in an onlydeps node when possible |
74 |
+ ResolverPlaygroundTestCase( |
75 |
+ ["app-misc/A:1"], |
76 |
+ success = True, |
77 |
+ options = { "--onlydeps": True }, |
78 |
+ mergelist = ["app-misc/B-0"]), |
79 |
+ ) |
80 |
+ |
81 |
+ playground = ResolverPlayground(ebuilds=ebuilds, |
82 |
+ installed=installed, debug=False) |
83 |
+ try: |
84 |
+ for test_case in test_cases: |
85 |
+ playground.run_TestCase(test_case) |
86 |
+ self.assertEqual(test_case.test_success, True, test_case.fail_msg) |
87 |
+ finally: |
88 |
+ playground.cleanup() |
89 |
-- |
90 |
2.0.4 |