Tests: resolver/test_slot_collisions: Check for slot_collision_solutions
authorSebastian Luther <SebastianLuther@gmx.de>
Mon, 9 Aug 2010 05:54:45 +0000 (07:54 +0200)
committerZac Medico <zmedico@gentoo.org>
Thu, 12 Aug 2010 08:17:24 +0000 (01:17 -0700)
pym/_emerge/depgraph.py
pym/portage/tests/resolver/ResolverPlayground.py

index effa6d382aa70bb578f3b9a2cfe488cd19e41ac0..a912385ca17323add91f5571574755683ea48ba1 100644 (file)
@@ -169,6 +169,7 @@ class _dynamic_depgraph_config(object):
                self._slot_collision_nodes = set()
                self._parent_atoms = {}
                self._slot_conflict_parent_atoms = set()
+               self._slot_conflict_handler = None
                self._serialized_tasks_cache = None
                self._scheduler_graph = None
                self._displayed_list = None
@@ -470,8 +471,10 @@ class depgraph(object):
 
                self._show_merge_list()
 
-               handler = slot_conflict_handler(self._dynamic_config._slot_collision_info, \
-                       self._dynamic_config._parent_atoms, self._frozen_config.myopts)
+               self._dynamic_config._slot_conflict_handler = \
+                       slot_conflict_handler(self._dynamic_config._slot_collision_info, \
+                               self._dynamic_config._parent_atoms, self._frozen_config.myopts)
+               handler = self._dynamic_config._slot_conflict_handler
 
                conflict = handler.get_conflict()
                writemsg(conflict, noiselevel=-1)
index d9dcdc2c83f3f77b5e2d9527bb952eeb1e5d5026..4a714445cf4bddb6afb9e9432262686f1488551d 100644 (file)
@@ -204,6 +204,7 @@ class ResolverPlayground(object):
                params = create_depgraph_params(options, action)
                success, depgraph, favorites = backtrack_depgraph(
                        self.settings, self.trees, options, params, action, atoms, None)
+               depgraph.display_problems()
                result = ResolverPlaygroundResult(atoms, success, depgraph, favorites)
                portage.util.noiselimit = 0
 
@@ -227,7 +228,8 @@ class ResolverPlaygroundTestCase(object):
                        "success": None,
                        "mergelist": None,
                        "use_changes": None,
-                       "unstable_keywords": None
+                       "unstable_keywords": None,
+                       "slot_collision_solutions": None,
                        }
                
                self.all_permutations = kwargs.pop("all_permutations", False)
@@ -277,6 +279,7 @@ class ResolverPlaygroundResult(object):
                self.mergelist = None
                self.use_changes = None
                self.unstable_keywords = None
+               self.slot_collision_solutions = None
 
                if self.depgraph._dynamic_config._serialized_tasks_cache is not None:
                        self.mergelist = []
@@ -297,3 +300,19 @@ class ResolverPlaygroundResult(object):
                        self.unstable_keywords = set()
                        for pkg in self.depgraph._dynamic_config._needed_unstable_keywords:
                                self.unstable_keywords.add(pkg.cpv)
+
+               if self.depgraph._dynamic_config._slot_conflict_handler is not None:
+                       self.slot_collision_solutions  = []
+                       handler = self.depgraph._dynamic_config._slot_conflict_handler
+
+                       for solution in handler.solutions:
+                               s = {}
+                               for pkg in solution:
+                                       changes = {}
+                                       for flag, state in solution[pkg].items():
+                                               if state == "enabled":
+                                                       changes[flag] = True
+                                               else:
+                                                       changes[flag] = False
+                                       s[pkg.cpv] = changes
+                               self.slot_collision_solutions.append(s)