public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sebastian Luther" <SebastianLuther@gmx.de >
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: pym/_emerge/resolver/, pym/_emerge/
Date: Wed,  5 Feb 2014 19:42:09 +0000 (UTC)	[thread overview]
Message-ID: <1391629161.731a3e6ea96acde03150905e28ebb69325acc60f.few@gentoo> (raw)

commit:     731a3e6ea96acde03150905e28ebb69325acc60f
Author:     Sebastian Luther <SebastianLuther <AT> gmx <DOT> de>
AuthorDate: Fri Jan 24 08:43:52 2014 +0000
Commit:     Sebastian Luther <SebastianLuther <AT> gmx <DOT> de >
CommitDate: Wed Feb  5 19:39:21 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=731a3e6e

Replace _slot_collision_info with _package_tracker

---
 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:


             reply	other threads:[~2014-02-05 19:42 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-05 19:42 Sebastian Luther [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-10-04 18:32 [gentoo-commits] proj/portage:master commit in: pym/_emerge/resolver/, pym/_emerge/ Zac Medico
2014-02-05 19:42 Sebastian Luther
2013-06-01  0:17 Zac Medico
2012-12-10  0:26 Zac Medico
2012-11-27  5:34 Zac Medico
2012-09-26  4:11 Zac Medico
2012-06-23  6:28 Zac Medico
2012-06-19 21:27 Zac Medico
2012-01-20 23:44 Arfrever Frehtes Taifersar Arahesis
2011-12-19 20:44 Zac Medico
2011-12-18  2:07 Arfrever Frehtes Taifersar Arahesis
2011-07-09 22:55 Zac Medico
2011-06-27  0:18 Zac Medico
2011-06-21  7:58 Zac Medico

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1391629161.731a3e6ea96acde03150905e28ebb69325acc60f.few@gentoo \
    --to=sebastianluther@gmx.de \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox