public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/tests/resolver/, pym/_emerge/
Date: Mon, 14 Feb 2011 04:31:38 +0000 (UTC)	[thread overview]
Message-ID: <463249dfb5a2d715f9dc8e8cd531fad372e9f5fc.zmedico@gentoo> (raw)

commit:     463249dfb5a2d715f9dc8e8cd531fad372e9f5fc
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Feb 13 13:55:18 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Feb 14 04:29:41 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=463249df

depgraph: fix and test depth control for virtuals

---
 pym/_emerge/depgraph.py                  |   50 +++++++++++++++++++++++++-----
 pym/portage/tests/resolver/test_depth.py |   33 +++++++++++++++-----
 2 files changed, 67 insertions(+), 16 deletions(-)

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 975ae0c..2257318 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -1257,6 +1257,7 @@ class depgraph(object):
 
 		root_config = self._frozen_config.roots[dep_root]
 		vardb = root_config.trees["vartree"].dbapi
+		traversed_virt_pkgs = set()
 
 		for atom, child in self._minimize_children(
 			pkg, dep_priority, root_config, selected_atoms[pkg]):
@@ -1297,7 +1298,6 @@ class depgraph(object):
 			# available for optimization of merge order.
 			ignored = False
 			if not atom.blocker and \
-				not is_virt and \
 				not recurse_satisfied and \
 				mypriority.satisfied and \
 				mypriority.satisfied.visible and \
@@ -1323,9 +1323,12 @@ class depgraph(object):
 					dep.child = None
 					self._dynamic_config._ignored_deps.append(dep)
 
-			if not ignored and not self._add_dep(dep,
-				allow_unsatisfied=allow_unsatisfied):
-				return 0
+			if not ignored:
+				if not self._add_dep(dep,
+					allow_unsatisfied=allow_unsatisfied):
+					return 0
+				if is_virt:
+					traversed_virt_pkgs.add(dep.child)
 
 		selected_atoms.pop(pkg)
 
@@ -1337,6 +1340,8 @@ class depgraph(object):
 		for virt_dep, atoms in selected_atoms.items():
 
 			virt_pkg = virt_dep.child
+			if virt_pkg not in traversed_virt_pkgs:
+				continue
 
 			if debug:
 				writemsg_level("Candidates: %s: %s\n" % \
@@ -1353,6 +1358,7 @@ class depgraph(object):
 				# from dep_check, map it back to the original, in
 				# order to avoid distortion in places like display
 				# or conflict resolution code.
+				is_virt = hasattr(atom, '_orig_atom')
 				atom = getattr(atom, '_orig_atom', atom)
 
 				# This is a GLEP 37 virtual, so its deps are all runtime.
@@ -1371,11 +1377,39 @@ class depgraph(object):
 
 				# Dependencies of virtuals are considered to have the
 				# same depth as the virtual itself.
-				if not self._add_dep(Dependency(atom=atom,
+				dep = Dependency(atom=atom,
 					blocker=atom.blocker, child=child, depth=virt_dep.depth,
-					parent=virt_pkg, priority=mypriority, root=dep_root),
-					allow_unsatisfied=allow_unsatisfied):
-					return 0
+					parent=virt_pkg, priority=mypriority, root=dep_root)
+
+				ignored = False
+				if not atom.blocker and \
+					not recurse_satisfied and \
+					mypriority.satisfied and \
+					mypriority.satisfied.visible and \
+					dep.child is not None and \
+					not dep.child.installed:
+					myarg = None
+					if dep.root == self._frozen_config.target_root:
+						try:
+								myarg = next(
+									self._iter_atoms_for_pkg(dep.child))
+						except StopIteration:
+								pass
+						except InvalidDependString:
+							if not dep.child.installed:
+								raise
+
+					if myarg is None:
+						ignored = True
+						dep.child = None
+						self._dynamic_config._ignored_deps.append(dep)
+
+				if not ignored:
+					if not self._add_dep(dep,
+						allow_unsatisfied=allow_unsatisfied):
+						return 0
+					if is_virt:
+						traversed_virt_pkgs.add(dep.child)
 
 		if debug:
 			writemsg_level("Exiting... %s\n" % (pkg,),

diff --git a/pym/portage/tests/resolver/test_depth.py b/pym/portage/tests/resolver/test_depth.py
index cecdd37..65cfac6 100644
--- a/pym/portage/tests/resolver/test_depth.py
+++ b/pym/portage/tests/resolver/test_depth.py
@@ -123,19 +123,28 @@ class ResolverDepthTestCase(TestCase):
 				["virtual/jre"],
 				options = {"--update" : True},
 				success = True,
+				mergelist = ['virtual/jre-1.6.0-r1', 'virtual/jre-1.5.0-r1']),
+
+			# Recursively traversed virtual dependencies, and their
+			# direct dependencies, are considered to have the same
+			# depth as direct dependencies.
+			ResolverPlaygroundTestCase(
+				["virtual/jre"],
+				options = {"--update" : True, "--deep" : 1},
+				success = True,
 				mergelist = ['dev-java/icedtea-6.1-r1', 'dev-java/gcj-jdk-4.5-r1', 'virtual/jdk-1.6.0-r1', 'virtual/jdk-1.5.0-r1', 'virtual/jre-1.6.0-r1', 'virtual/jre-1.5.0-r1']),
 
 			ResolverPlaygroundTestCase(
 				["virtual/jre:1.5"],
 				options = {"--update" : True},
 				success = True,
-				mergelist = ['dev-java/gcj-jdk-4.5-r1', 'virtual/jdk-1.5.0-r1', 'virtual/jre-1.5.0-r1']),
+				mergelist = ['virtual/jre-1.5.0-r1']),
 
 			ResolverPlaygroundTestCase(
 				["virtual/jre:1.6"],
 				options = {"--update" : True},
 				success = True,
-				mergelist = ['dev-java/icedtea-6.1-r1', 'virtual/jdk-1.6.0-r1', 'virtual/jre-1.6.0-r1']),
+				mergelist = ['virtual/jre-1.6.0-r1']),
 
 			# Test that we don't pull in any unnecessary updates
 			# when --update is not specified, even though we
@@ -146,12 +155,20 @@ class ResolverDepthTestCase(TestCase):
 				success = True,
 				mergelist = ["dev-java/ant-core-1.8"]),
 
-			# FIXME: pulls in unwanted updates without --deep: ['dev-java/icedtea-6.1-r1', 'virtual/jdk-1.6.0-r1', 'dev-java/ant-core-1.8']
-			#ResolverPlaygroundTestCase(
-			#	["dev-java/ant-core"],
-			#	options = {"--update" : True},
-			#	success = True,
-			#	mergelist = ["dev-java/ant-core-1.8"]),
+			ResolverPlaygroundTestCase(
+				["dev-java/ant-core"],
+				options = {"--update" : True},
+				success = True,
+				mergelist = ["dev-java/ant-core-1.8"]),
+
+			# Recursively traversed virtual dependencies, and their
+			# direct dependencies, are considered to have the same
+			# depth as direct dependencies.
+			ResolverPlaygroundTestCase(
+				["dev-java/ant-core"],
+				options = {"--update" : True, "--deep" : 1},
+				success = True,
+				mergelist = ['dev-java/icedtea-6.1-r1', 'virtual/jdk-1.6.0-r1', 'dev-java/ant-core-1.8']),
 
 			ResolverPlaygroundTestCase(
 				["dev-db/hsqldb"],



             reply	other threads:[~2011-02-14  4:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-14  4:31 Zac Medico [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-05-26  6:18 [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/tests/resolver/, pym/_emerge/ Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-04 20:03 Zac Medico
2011-02-14  4:31 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=463249dfb5a2d715f9dc8e8cd531fad372e9f5fc.zmedico@gentoo \
    --to=zmedico@gentoo.org \
    --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