public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] portage r10100 - main/trunk/pym/_emerge
@ 2008-05-02 19:58 Zac Medico (zmedico)
  0 siblings, 0 replies; only message in thread
From: Zac Medico (zmedico) @ 2008-05-02 19:58 UTC (permalink / raw
  To: gentoo-commits

Author: zmedico
Date: 2008-05-02 19:58:13 +0000 (Fri, 02 May 2008)
New Revision: 10100

Modified:
   main/trunk/pym/_emerge/__init__.py
Log:
Use Package instance attributes to clean up and simplify
depgraph.validate_blockers().


Modified: main/trunk/pym/_emerge/__init__.py
===================================================================
--- main/trunk/pym/_emerge/__init__.py	2008-05-02 19:22:09 UTC (rev 10099)
+++ main/trunk/pym/_emerge/__init__.py	2008-05-02 19:58:13 UTC (rev 10100)
@@ -3120,15 +3120,6 @@
 			"--nodeps" in self.myopts:
 			return True
 
-		modified_slots = {}
-		for myroot in self.trees:
-			myslots = {}
-			modified_slots[myroot] = myslots
-			final_db = self.mydbapi[myroot]
-			for pkg in self._slot_pkg_map[myroot].itervalues():
-				if not (pkg.installed or pkg.onlydeps):
-					myslots[pkg.slot_atom] = pkg.cpv
-
 		#if "deep" in self.myparams:
 		if True:
 			# Pull in blockers from all installed packages that haven't already
@@ -3211,7 +3202,9 @@
 						finally:
 							portage.dep._dep_check_strict = True
 						if not success:
-							if pkg.slot_atom in modified_slots[myroot]:
+							replacement_pkg = final_db.match_pkgs(pkg.slot_atom)
+							if replacement_pkg and \
+								replacement_pkg[0].operation == "merge":
 								# This package is being replaced anyway, so
 								# ignore invalid dependencies so as not to
 								# annoy the user too much (otherwise they'd be
@@ -3257,11 +3250,11 @@
 
 			blocked_initial = []
 			for atom in atoms:
-				blocked_initial.extend(initial_db.match(atom))
+				blocked_initial.extend(initial_db.match_pkgs(atom))
 
 			blocked_final = []
 			for atom in atoms:
-				blocked_final.extend(final_db.match(atom))
+				blocked_final.extend(final_db.match_pkgs(atom))
 
 			if not blocked_initial and not blocked_final:
 				parent_pkgs = self._blocker_parents.parent_nodes(blocker)
@@ -3271,27 +3264,11 @@
 					if not self._blocker_parents.child_nodes(pkg):
 						self._blocker_parents.remove(pkg)
 				continue
-			blocked_slots_initial = {}
-			blocked_slots_final = {}
-			for cpv in blocked_initial:
-				blocked_slots_initial[cpv] = \
-					"%s:%s" % (portage.dep_getkey(cpv),
-						initial_db.aux_get(cpv, ["SLOT"])[0])
-			for cpv in blocked_final:
-				blocked_slots_final[cpv] = \
-					"%s:%s" % (portage.dep_getkey(cpv),
-						final_db.aux_get(cpv, ["SLOT"])[0])
 			for parent in self._blocker_parents.parent_nodes(blocker):
-				ptype, proot, pcpv, pstatus = parent
-				pdbapi = self.trees[proot][self.pkg_tree_map[ptype]].dbapi
-				pslot = pdbapi.aux_get(pcpv, ["SLOT"])[0]
-				pslot_atom = "%s:%s" % (portage.dep_getkey(pcpv), pslot)
-				parent_static = pslot_atom not in modified_slots[proot]
 				unresolved_blocks = False
 				depends_on_order = set()
-				for cpv in blocked_initial:
-					slot_atom = blocked_slots_initial[cpv]
-					if slot_atom == pslot_atom:
+				for pkg in blocked_initial:
+					if pkg.slot_atom == parent.slot_atom:
 						# TODO: Support blocks within slots in cases where it
 						# might make sense.  For example, a new version might
 						# require that the old version be uninstalled at build
@@ -3303,39 +3280,31 @@
 						# is already done and this would be likely to
 						# confuse users if displayed like a normal blocker.
 						continue
-					if pstatus == "merge":
+					if parent.operation == "merge":
 						# Maybe the blocked package can be replaced or simply
 						# unmerged to resolve this block.
-						inst_pkg = self._pkg_cache[
-							("installed", myroot, cpv, "nomerge")]
-						depends_on_order.add((inst_pkg, parent))
+						depends_on_order.add((pkg, parent))
 						continue
 					# None of the above blocker resolutions techniques apply,
 					# so apparently this one is unresolvable.
 					unresolved_blocks = True
-				for cpv in blocked_final:
-					slot_atom = blocked_slots_final[cpv]
-					if slot_atom == pslot_atom:
+				for pkg in blocked_final:
+					if pkg.slot_atom == parent.slot_atom:
 						# TODO: Support blocks within slots.
 						continue
-					if parent_static and \
-						slot_atom not in modified_slots[myroot]:
+					if parent.operation == "nomerge" and \
+						pkg.operation == "nomerge":
 						# This blocker will be handled the next time that a
 						# merge of either package is triggered.
 						continue
 
 					# Maybe the blocking package can be
 					# unmerged to resolve this block.
-					try:
-						blocked_pkg = self._slot_pkg_map[myroot][slot_atom]
-					except KeyError:
-						blocked_pkg = self._pkg_cache[
-							("installed", myroot, cpv, "nomerge")]
-					if pstatus == "merge" and blocked_pkg.installed:
-						depends_on_order.add((blocked_pkg, parent))
+					if parent.operation == "merge" and pkg.installed:
+						depends_on_order.add((pkg, parent))
 						continue
-					elif pstatus == "nomerge":
-						depends_on_order.add((parent, blocked_pkg))
+					elif parent.operation == "nomerge":
+						depends_on_order.add((parent, pkg))
 						continue
 					# None of the above blocker resolutions techniques apply,
 					# so apparently this one is unresolvable.

-- 
gentoo-commits@lists.gentoo.org mailing list



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-05-02 19:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-02 19:58 [gentoo-commits] portage r10100 - main/trunk/pym/_emerge Zac Medico (zmedico)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox