From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id AD1D8138A1F for ; Wed, 29 Jan 2014 15:34:11 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 18B18E0B84; Wed, 29 Jan 2014 15:33:32 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 0D0D1E0B79 for ; Wed, 29 Jan 2014 15:33:30 +0000 (UTC) Received: from localhost.localdomain ([88.150.18.76]) by mail.gmx.com (mrgmx103) with ESMTPSA (Nemesis) id 0MI5rO-1W7y6x0eMQ-003yVk for ; Wed, 29 Jan 2014 16:33:29 +0100 From: Sebastian Luther To: gentoo-portage-dev@lists.gentoo.org Subject: [gentoo-portage-dev] [PATCH 04/10] Replace _slot_collision_info with _package_tracker Date: Wed, 29 Jan 2014 16:33:08 +0100 Message-Id: <1391009594-22750-5-git-send-email-SebastianLuther@gmx.de> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1391009594-22750-1-git-send-email-SebastianLuther@gmx.de> References: <1391009594-22750-1-git-send-email-SebastianLuther@gmx.de> X-Provags-ID: V03:K0:qOGR6EZJ6Wm1WtfE/+HiIoWxNbpsxfbG6gkaYfbyqkrOA3NcYon 1cNul5CENCn603m2JHyU6HwW9wD6JKlxV5IOFY65lkMUp/WFE9cKPpnn3uj/WtTAC5pvfSC rmDjfwDnLo3WWFEJpnENhArHPBqq5rzh7iqlS90d6LstLaOYwCmvD2JRJlhU7UBdwWQ6YEr GmHKdQzyETsKPpakGdj3Q== Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-portage-dev@lists.gentoo.org Reply-to: gentoo-portage-dev@lists.gentoo.org X-Archives-Salt: 0b5be651-cb25-493b-b504-564b872162b2 X-Archives-Hash: b31482c586a8a3e1ae75ab49cd0966b5 --- pym/_emerge/depgraph.py | 59 ++++++++++++---------------------- pym/_emerge/resolver/slot_collision.py | 22 ++++++------- 2 files changed, 31 insertions(+), 50 deletions(-) diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index 9d234c2..484ac14 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -378,11 +378,6 @@ class _dynamic_depgraph_config(object): # This use used to check if we have accounted for blockers # relevant to a package. self._traversed_pkg_deps = set() - # This should be ordered such that the backtracker will - # attempt to solve conflicts which occurred earlier first, - # since an earlier conflict can be the cause of a conflict - # which occurs later. - self._slot_collision_info = OrderedDict() # Slot collision nodes are not allowed to block other packages since # blocker validation is only able to account for one package per slot. self._slot_collision_nodes = set() @@ -915,7 +910,7 @@ class depgraph(object): cases. """ - if not self._dynamic_config._slot_collision_info: + if not any(self._dynamic_config._package_tracker.slot_conflicts()): return self._show_merge_list() @@ -971,16 +966,18 @@ class depgraph(object): is called, so that all relevant reverse dependencies are available for use in backtracking decisions. """ - for (slot_atom, root), slot_nodes in \ - self._dynamic_config._slot_collision_info.items(): - self._process_slot_conflict(root, slot_atom, slot_nodes) + for conflict in self._dynamic_config._package_tracker.slot_conflicts(): + self._process_slot_conflict(conflict) - def _process_slot_conflict(self, root, slot_atom, slot_nodes): + def _process_slot_conflict(self, conflict): """ Process slot conflict data to identify specific atoms which lead to conflict. These atoms only match a subset of the packages that have been pulled into a given slot. """ + root = conflict.root + slot_atom = conflict.atom + slot_nodes = conflict.pkgs debug = "--debug" in self._frozen_config.myopts @@ -1999,7 +1996,6 @@ class depgraph(object): existing_node, existing_node_matches = \ self._check_slot_conflict(pkg, dep.atom) - slot_collision = False if existing_node: if existing_node_matches: # The existing node can be reused. @@ -2032,19 +2028,7 @@ class depgraph(object): modified_use=self._pkg_use_enabled(existing_node))), level=logging.DEBUG, noiselevel=-1) - slot_collision = True - - if slot_collision: - # Now add this node to the graph so that self.display() - # can show use flags and --tree portage.output. This node is - # only being partially added to the graph. It must not be - # allowed to interfere with the other nodes that have been - # added. - # Even though the graph is now invalid, continue to process - # dependencies so that things like --fetchonly can still - # function despite collisions. - pass - elif not previously_added: + if not previously_added: self._dynamic_config._package_tracker.add_pkg(pkg) self._dynamic_config._filtered_trees[pkg.root]["porttree"].dbapi._clear_cache() self._dynamic_config._highest_pkg_cache.clear() @@ -2156,14 +2140,6 @@ class depgraph(object): def _add_slot_conflict(self, pkg): self._dynamic_config._slot_collision_nodes.add(pkg) - slot_key = (pkg.slot_atom, pkg.root) - slot_nodes = self._dynamic_config._slot_collision_info.get(slot_key) - if slot_nodes is None: - slot_nodes = set() - slot_nodes.update(self._dynamic_config._package_tracker.match( - pkg.root, pkg.slot_atom, installed=False)) - self._dynamic_config._slot_collision_info[slot_key] = slot_nodes - slot_nodes.add(pkg) def _add_pkg_deps(self, pkg, allow_unsatisfied=False): @@ -3284,7 +3260,8 @@ class depgraph(object): except self._unknown_internal_error: return False, myfavorites - if (self._dynamic_config._slot_collision_info and + have_slot_conflict = any(self._dynamic_config._package_tracker.slot_conflicts()) + if (have_slot_conflict and not self._accept_blocker_conflicts()) or \ (self._dynamic_config._allow_backtracking and "slot conflict" in self._dynamic_config._backtrack_infos): @@ -6806,7 +6783,8 @@ class depgraph(object): # conflicts (or by blind luck). raise self._unknown_internal_error() - if self._dynamic_config._slot_collision_info and \ + have_slot_conflict = any(self._dynamic_config._package_tracker.slot_conflicts()) + if have_slot_conflict and \ not self._accept_blocker_conflicts(): self._dynamic_config._serialized_tasks_cache = retlist self._dynamic_config._scheduler_graph = scheduler_graph @@ -6881,13 +6859,17 @@ class depgraph(object): # the reasons are not apparent from the normal merge list # display. - slot_collision_info = self._dynamic_config._slot_collision_info - conflict_pkgs = {} for blocker in blockers: for pkg in chain(self._dynamic_config._blocked_pkgs.child_nodes(blocker), \ self._dynamic_config._blocker_parents.parent_nodes(blocker)): - if (pkg.slot_atom, pkg.root) in slot_collision_info: + + is_slot_conflict_pkg = False + for conflict in self._dynamic_config._package_tracker.slot_conflicts(): + if conflict.root == pkg.root and conflict.atom == pkg.slot_atom: + is_slot_conflict_pkg = True + break + if is_slot_conflict_pkg: # The slot conflict display has better noise reduction # than the unsatisfied blockers display, so skip # unsatisfied blockers display for packages involved @@ -7370,7 +7352,8 @@ class depgraph(object): self._dynamic_config._circular_deps_for_display) unresolved_conflicts = False - if self._dynamic_config._slot_collision_info: + have_slot_conflict = any(self._dynamic_config._package_tracker.slot_conflicts()) + if have_slot_conflict: unresolved_conflicts = True self._show_slot_collision_notice() if self._dynamic_config._unsatisfied_blockers_for_display is not None: diff --git a/pym/_emerge/resolver/slot_collision.py b/pym/_emerge/resolver/slot_collision.py index a193baa..ca3fb74 100644 --- a/pym/_emerge/resolver/slot_collision.py +++ b/pym/_emerge/resolver/slot_collision.py @@ -89,10 +89,11 @@ class slot_conflict_handler(object): self.debug = "--debug" in self.myopts if self.debug: writemsg("Starting slot conflict handler\n", noiselevel=-1) - #slot_collision_info is a dict mapping (slot atom, root) to set - #of packages. The packages in the set all belong to the same - #slot. - self.slot_collision_info = depgraph._dynamic_config._slot_collision_info + + # List of tuples, where each tuple represents a slot conflict. + self.all_conflicts = [] + for conflict in depgraph._dynamic_config._package_tracker.slot_conflicts(): + self.all_conflicts.append((conflict.root, conflict.atom, conflict.pkgs)) #A dict mapping packages to pairs of parent package #and parent atom @@ -109,8 +110,7 @@ class slot_conflict_handler(object): all_conflict_atoms_by_slotatom = [] #fill conflict_pkgs, all_conflict_atoms_by_slotatom - for (atom, root), pkgs \ - in self.slot_collision_info.items(): + for root, atom, pkgs in self.all_conflicts: conflict_pkgs.append(list(pkgs)) all_conflict_atoms_by_slotatom.append(set()) @@ -249,8 +249,7 @@ class slot_conflict_handler(object): msg.append("!!! into the dependency graph, resulting" + \ " in a slot conflict:\n\n") - for (slot_atom, root), pkgs \ - in self.slot_collision_info.items(): + for root, slot_atom, pkgs in self.all_conflicts: msg.append("%s" % (slot_atom,)) if root != self.depgraph._frozen_config._running_root.root: msg.append(" for %s" % (root,)) @@ -536,13 +535,13 @@ class slot_conflict_handler(object): return None if len(solutions)==1: - if len(self.slot_collision_info)==1: + if len(self.all_conflicts) == 1: msg += "It might be possible to solve this slot collision\n" else: msg += "It might be possible to solve these slot collisions\n" msg += "by applying all of the following changes:\n" else: - if len(self.slot_collision_info)==1: + if len(self.all_conflicts) == 1: msg += "It might be possible to solve this slot collision\n" else: msg += "It might be possible to solve these slot collisions\n" @@ -583,8 +582,7 @@ class slot_conflict_handler(object): if not pkg.installed: continue - for (atom, root), pkgs \ - in self.slot_collision_info.items(): + for root, atom, pkgs in self.all_conflicts: if pkg not in pkgs: continue for other_pkg in pkgs: -- 1.8.3.2