1 |
commit: 4b897286cf94c6ec2c556a75ea2e67798e1157cc |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Dec 1 23:22:59 2012 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Dec 1 23:22:59 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=4b897286 |
7 |
|
8 |
emerge --depclean: rm unavailable slot bug 445506 |
9 |
|
10 |
--- |
11 |
pym/_emerge/depgraph.py | 8 ++ |
12 |
.../resolver/test_depclean_slot_unavailable.py | 79 ++++++++++++++++++++ |
13 |
2 files changed, 87 insertions(+), 0 deletions(-) |
14 |
|
15 |
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py |
16 |
index f5fe435..65a94ab 100644 |
17 |
--- a/pym/_emerge/depgraph.py |
18 |
+++ b/pym/_emerge/depgraph.py |
19 |
@@ -4634,6 +4634,14 @@ class depgraph(object): |
20 |
unmasked = [pkg for pkg in matches if not pkg.masks] |
21 |
if unmasked: |
22 |
matches = unmasked |
23 |
+ if len(matches) > 1: |
24 |
+ # Now account for packages for which existing |
25 |
+ # ebuilds are masked or unavailable (bug #445506). |
26 |
+ unmasked = [pkg for pkg in matches if |
27 |
+ self._equiv_ebuild_visible(pkg)] |
28 |
+ if unmasked: |
29 |
+ matches = unmasked |
30 |
+ |
31 |
pkg = matches[-1] # highest match |
32 |
in_graph = self._dynamic_config._slot_pkg_map[root].get(pkg.slot_atom) |
33 |
return pkg, in_graph |
34 |
|
35 |
diff --git a/pym/portage/tests/resolver/test_depclean_slot_unavailable.py b/pym/portage/tests/resolver/test_depclean_slot_unavailable.py |
36 |
new file mode 100644 |
37 |
index 0000000..9d17189 |
38 |
--- /dev/null |
39 |
+++ b/pym/portage/tests/resolver/test_depclean_slot_unavailable.py |
40 |
@@ -0,0 +1,79 @@ |
41 |
+# Copyright 2012 Gentoo Foundation |
42 |
+# Distributed under the terms of the GNU General Public License v2 |
43 |
+ |
44 |
+from portage.tests import TestCase |
45 |
+from portage.tests.resolver.ResolverPlayground import (ResolverPlayground, |
46 |
+ ResolverPlaygroundTestCase) |
47 |
+ |
48 |
+class DepcleanUnavailableSlotTestCase(TestCase): |
49 |
+ |
50 |
+ def testDepcleanUnavailableSlot(self): |
51 |
+ """ |
52 |
+ Test bug #445506, where we want to remove the slot |
53 |
+ for which the ebuild is no longer available, even |
54 |
+ though its version is higher. |
55 |
+ """ |
56 |
+ |
57 |
+ ebuilds = { |
58 |
+ "sys-kernel/gentoo-sources-3.0.53": { |
59 |
+ "SLOT": "3.0.53", |
60 |
+ "KEYWORDS": "x86" |
61 |
+ }, |
62 |
+ } |
63 |
+ |
64 |
+ installed = { |
65 |
+ "sys-kernel/gentoo-sources-3.0.53": { |
66 |
+ "SLOT": "3.0.53", |
67 |
+ "KEYWORDS": "x86" |
68 |
+ }, |
69 |
+ "sys-kernel/gentoo-sources-3.2.21": { |
70 |
+ "SLOT": "3.2.21", |
71 |
+ "KEYWORDS": "x86" |
72 |
+ }, |
73 |
+ } |
74 |
+ |
75 |
+ world = [ "sys-kernel/gentoo-sources" ] |
76 |
+ |
77 |
+ test_cases = ( |
78 |
+ |
79 |
+ ResolverPlaygroundTestCase( |
80 |
+ [], |
81 |
+ options = {"--depclean": True}, |
82 |
+ success = True, |
83 |
+ cleanlist = ["sys-kernel/gentoo-sources-3.2.21"]), |
84 |
+ ) |
85 |
+ |
86 |
+ playground = ResolverPlayground(ebuilds=ebuilds, |
87 |
+ installed=installed, world=world, debug=False) |
88 |
+ try: |
89 |
+ for test_case in test_cases: |
90 |
+ playground.run_TestCase(test_case) |
91 |
+ self.assertEqual(test_case.test_success, True, test_case.fail_msg) |
92 |
+ finally: |
93 |
+ playground.cleanup() |
94 |
+ |
95 |
+ # Now make the newer version availale and verify that |
96 |
+ # the lower version is depcleaned. |
97 |
+ ebuilds.update({ |
98 |
+ "sys-kernel/gentoo-sources-3.2.21": { |
99 |
+ "SLOT": "3.2.21", |
100 |
+ "KEYWORDS": "x86" |
101 |
+ }, |
102 |
+ }) |
103 |
+ |
104 |
+ test_cases = ( |
105 |
+ ResolverPlaygroundTestCase( |
106 |
+ [], |
107 |
+ options = {"--depclean": True}, |
108 |
+ success = True, |
109 |
+ cleanlist = ["sys-kernel/gentoo-sources-3.0.53"]), |
110 |
+ ) |
111 |
+ |
112 |
+ playground = ResolverPlayground(ebuilds=ebuilds, |
113 |
+ installed=installed, world=world, debug=False) |
114 |
+ try: |
115 |
+ for test_case in test_cases: |
116 |
+ playground.run_TestCase(test_case) |
117 |
+ self.assertEqual(test_case.test_success, True, test_case.fail_msg) |
118 |
+ finally: |
119 |
+ playground.cleanup() |