public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/tests/resolver/, pym/_emerge/
@ 2011-02-14  4:31 Zac Medico
  0 siblings, 0 replies; 7+ messages in thread
From: Zac Medico @ 2011-02-14  4:31 UTC (permalink / raw
  To: gentoo-commits

commit:     6de6dc1754f232e090cf5a54b2fb9ada1452a3b3
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Feb 13 10:20:24 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Feb 14 04:28:00 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=6de6dc17

depgraph: fix and test --deep control of depth

Control over recursion depth hasn't behaved properly since commit
6503980e0e3bcfce9fbaff85c33d87f616e955a9. Now it is fixed and tested.

---
 pym/_emerge/depgraph.py                  |   44 +++++++++++++++++++++++--
 pym/portage/tests/resolver/test_depth.py |   53 ++++++++++++++++++++++++++++++
 2 files changed, 94 insertions(+), 3 deletions(-)

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 8f1e00a..d817b1d 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -18,7 +18,7 @@ from portage.const import PORTAGE_PACKAGE_ATOM
 from portage.dbapi import dbapi
 from portage.dep import Atom, extract_affecting_use, check_required_use, human_readable_required_use
 from portage.eapi import eapi_has_strong_blocks, eapi_has_required_use
-from portage.exception import InvalidAtom
+from portage.exception import InvalidAtom, InvalidDependString
 from portage.output import colorize, create_color_func, \
 	darkgreen, green
 bad = create_color_func("BAD")
@@ -1225,6 +1225,8 @@ class depgraph(object):
 	def _add_pkg_dep_string(self, pkg, dep_root, dep_priority, dep_string,
 		allow_unsatisfied, ignore_blockers=False):
 		depth = pkg.depth + 1
+		deep = self._dynamic_config.myparams.get("deep", 0)
+		recurse_satisfied = deep is True or depth <= deep
 		debug = "--debug" in self._frozen_config.myopts
 		strict = pkg.type_name != "installed"
 
@@ -1263,6 +1265,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)
 
 			if ignore_blockers and atom.blocker:
@@ -1283,9 +1286,44 @@ class depgraph(object):
 						# none visible, so use highest
 						mypriority.satisfied = inst_pkgs[0]
 
-			if not self._add_dep(Dependency(atom=atom,
+			dep = Dependency(atom=atom,
 				blocker=atom.blocker, child=child, depth=depth, parent=pkg,
-				priority=mypriority, root=dep_root),
+				priority=mypriority, root=dep_root)
+
+			# In some cases, dep_check will return deps that shouldn't
+			# be proccessed any further, so they are identified and
+			# discarded here. Try to discard as few as possible since
+			# discarded dependencies reduce the amount of information
+			# 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 \
+				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:
+							# This shouldn't happen since the package
+							# should have been masked.
+							raise
+
+				if myarg is None:
+					# Existing child selection may not be valid unless
+					# it's added to the graph immediately, since "complete"
+					# mode may select a different child later.
+					ignored = True
+					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
 

diff --git a/pym/portage/tests/resolver/test_depth.py b/pym/portage/tests/resolver/test_depth.py
new file mode 100644
index 0000000..5a30941
--- /dev/null
+++ b/pym/portage/tests/resolver/test_depth.py
@@ -0,0 +1,53 @@
+# Copyright 2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+from portage.tests import TestCase
+from portage.tests.resolver.ResolverPlayground import (ResolverPlayground,
+	ResolverPlaygroundTestCase)
+
+class ResolverDepthTestCase(TestCase):
+
+	def testResolverDepth(self):
+
+		ebuilds = {
+			"dev-libs/A-1": {"RDEPEND" : "dev-libs/B"},
+			"dev-libs/A-2": {"RDEPEND" : "dev-libs/B"},
+			"dev-libs/B-1": {"RDEPEND" : "dev-libs/C"},
+			"dev-libs/B-2": {"RDEPEND" : "dev-libs/C"},
+			"dev-libs/C-1": {},
+			"dev-libs/C-2": {},
+			}
+
+		installed = {
+			"dev-libs/A-1": {"RDEPEND" : "dev-libs/B"},
+			"dev-libs/B-1": {"RDEPEND" : "dev-libs/C"},
+			"dev-libs/C-1": {},
+			}
+
+		test_cases = (
+			ResolverPlaygroundTestCase(
+				["dev-libs/A"],
+				options = {"--update": True, "--deep": 0},
+				success = True,
+				mergelist = ["dev-libs/A-2"]),
+
+			ResolverPlaygroundTestCase(
+				["dev-libs/A"],
+				options = {"--update": True, "--deep": 1},
+				success = True,
+				mergelist = ["dev-libs/B-2", "dev-libs/A-2"]),
+
+			ResolverPlaygroundTestCase(
+				["dev-libs/A"],
+				options = {"--update": True, "--deep": 3},
+				success = True,
+				mergelist = ["dev-libs/C-2", "dev-libs/B-2", "dev-libs/A-2"]),
+			)
+
+		playground = ResolverPlayground(ebuilds=ebuilds, installed=installed)
+		try:
+			for test_case in test_cases:
+				playground.run_TestCase(test_case)
+				self.assertEqual(test_case.test_success, True, test_case.fail_msg)
+		finally:
+			playground.cleanup()



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/tests/resolver/, pym/_emerge/
@ 2011-02-14  4:31 Zac Medico
  0 siblings, 0 replies; 7+ messages in thread
From: Zac Medico @ 2011-02-14  4:31 UTC (permalink / raw
  To: gentoo-commits

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"],



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/tests/resolver/, pym/_emerge/
@ 2011-05-04 20:03 Zac Medico
  0 siblings, 0 replies; 7+ messages in thread
From: Zac Medico @ 2011-05-04 20:03 UTC (permalink / raw
  To: gentoo-commits

commit:     6a58b5518697cb979f9c6b0acd9337d3660e316d
Author:     Sebastian Luther <SebastianLuther <AT> gmx <DOT> de>
AuthorDate: Wed Apr 27 20:36:15 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed May  4 19:32:18 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=6a58b551

--autounmask: Don't change masked/forced flags

This will fix bug #364701.

---
 pym/_emerge/depgraph.py                          |    6 +++-
 pym/portage/tests/resolver/ResolverPlayground.py |    2 +-
 pym/portage/tests/resolver/test_autounmask.py    |   31 +++++++++++++++++++++-
 3 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 91ec759..fabc2df 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -3094,7 +3094,11 @@ class depgraph(object):
 			if required_use and check_required_use(required_use, old_use, pkg.iuse.is_valid_flag) and \
 				not check_required_use(required_use, new_use, pkg.iuse.is_valid_flag):
 				return old_use
-			
+
+			if pkg.use.mask.intersection(new_changes) or \
+				pkg.use.force.intersection(new_changes):
+				return old_use
+
 			self._dynamic_config._needed_use_config_changes[pkg] = (new_use, new_changes)
 			if want_restart_for_use_change(pkg, new_use):
 				self._dynamic_config._need_restart = True

diff --git a/pym/portage/tests/resolver/ResolverPlayground.py b/pym/portage/tests/resolver/ResolverPlayground.py
index 709adfa..1c5d974 100644
--- a/pym/portage/tests/resolver/ResolverPlayground.py
+++ b/pym/portage/tests/resolver/ResolverPlayground.py
@@ -32,7 +32,7 @@ class ResolverPlayground(object):
 	"""
 
 	config_files = frozenset(("package.use", "package.mask", "package.keywords", \
-		"package.unmask", "package.properties", "package.license"))
+		"package.unmask", "package.properties", "package.license", "use.mask", "use.force"))
 
 	def __init__(self, ebuilds={}, installed={}, profile={}, repo_configs={}, \
 		user_config={}, sets={}, world=[], debug=False):

diff --git a/pym/portage/tests/resolver/test_autounmask.py b/pym/portage/tests/resolver/test_autounmask.py
index 4100fbd..124abe1 100644
--- a/pym/portage/tests/resolver/test_autounmask.py
+++ b/pym/portage/tests/resolver/test_autounmask.py
@@ -16,6 +16,12 @@ class AutounmaskTestCase(TestCase):
 			"dev-libs/C-1": {},
 			"dev-libs/D-1": {},
 
+			#ebuilds to test if we allow changing of masked or forced flags
+			"dev-libs/E-1": { "SLOT": 1, "DEPEND": "dev-libs/F[masked-flag]", "EAPI": 2},
+			"dev-libs/E-2": { "SLOT": 2, "DEPEND": "dev-libs/G[-forced-flag]", "EAPI": 2},
+			"dev-libs/F-1": { "IUSE": "masked-flag"},
+			"dev-libs/G-1": { "IUSE": "forced-flag"},
+
 			#ebuilds to test keyword changes
 			"app-misc/Z-1": { "KEYWORDS": "~x86", "DEPEND": "app-misc/Y" },
 			"app-misc/Y-1": { "KEYWORDS": "~x86" },
@@ -185,9 +191,32 @@ class AutounmaskTestCase(TestCase):
 					options = { "--autounmask": True },
 					use_changes = None,
 					success = False),
+
+				#Make sure we don't change masked/forced flags.
+				ResolverPlaygroundTestCase(
+					["dev-libs/E:1"],
+					options = {"--autounmask": True},
+					use_changes = None,
+					success = False),
+				ResolverPlaygroundTestCase(
+					["dev-libs/E:2"],
+					options = {"--autounmask": True},
+					use_changes = None,
+					success = False),
 			)
 
-		playground = ResolverPlayground(ebuilds=ebuilds)
+		profile = {
+			"use.mask":
+				(
+					"masked-flag",
+				),
+			"use.force":
+				(
+					"forced-flag",
+				),
+		}
+
+		playground = ResolverPlayground(ebuilds=ebuilds, profile=profile)
 		try:
 			for test_case in test_cases:
 				playground.run_TestCase(test_case)



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/tests/resolver/, pym/_emerge/
@ 2011-05-26  6:18 Zac Medico
  0 siblings, 0 replies; 7+ messages in thread
From: Zac Medico @ 2011-05-26  6:18 UTC (permalink / raw
  To: gentoo-commits

commit:     71400a9fd37e6a127011bb9f74bf397b05a57ded
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat May 21 03:49:08 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 26 03:43:05 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=71400a9f

test_merge_order: test hard blocker resolution

---
 pym/_emerge/depgraph.py                        |    3 +--
 pym/portage/tests/resolver/test_merge_order.py |   16 +++++++++++++---
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index e6f9b12..808103c 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -5130,8 +5130,7 @@ class depgraph(object):
 
 				msg.append("\n")
 
-			sys.stderr.write("".join(msg))
-			sys.stderr.flush()
+			writemsg("".join(msg), noiselevel=-1)
 
 		if "--quiet" not in self._frozen_config.myopts:
 			show_blocker_docs_link()

diff --git a/pym/portage/tests/resolver/test_merge_order.py b/pym/portage/tests/resolver/test_merge_order.py
index 6c929f7..e7f1aa4 100644
--- a/pym/portage/tests/resolver/test_merge_order.py
+++ b/pym/portage/tests/resolver/test_merge_order.py
@@ -11,6 +11,7 @@ class MergeOrderTestCase(TestCase):
 		ebuilds = {
 			"app-misc/blocker-buildtime-a-1" : {},
 			"app-misc/blocker-runtime-a-1" : {},
+			"app-misc/blocker-runtime-hard-a-1" : {},
 			"app-misc/circ-post-runtime-a-1": {
 				"PDEPEND": "app-misc/circ-post-runtime-b",
 			},
@@ -24,8 +25,9 @@ class MergeOrderTestCase(TestCase):
 				"RDEPEND": "app-misc/circ-runtime-a",
 			},
 			"app-misc/installed-blocker-a-1" : {
+				"EAPI"   : "2",
 				"DEPEND" : "!app-misc/blocker-buildtime-a",
-				"RDEPEND" : "!app-misc/blocker-runtime-a",
+				"RDEPEND" : "!app-misc/blocker-runtime-a !!app-misc/blocker-runtime-hard-a",
 			},
 			"app-misc/some-app-a-1": {
 				"RDEPEND": "app-misc/circ-runtime-a app-misc/circ-runtime-b",
@@ -37,9 +39,10 @@ class MergeOrderTestCase(TestCase):
 
 		installed = {
 			"app-misc/installed-blocker-a-1" : {
+				"EAPI"   : "2",
 				"DEPEND" : "!app-misc/blocker-buildtime-a",
-				"RDEPEND" : "!app-misc/blocker-runtime-a",
-			}
+				"RDEPEND" : "!app-misc/blocker-runtime-a !!app-misc/blocker-runtime-hard-a",
+			},
 		}
 
 		test_cases = (
@@ -72,6 +75,13 @@ class MergeOrderTestCase(TestCase):
 				["app-misc/blocker-runtime-a"],
 				success = True,
 				mergelist = ["app-misc/blocker-runtime-a-1", "app-misc/installed-blocker-a-1", "!app-misc/blocker-runtime-a"]),
+			# An installed package has a hard runtime blocker that
+			# will not resolve automatically (unless the option
+			# requested in bug 250286 is implemented).
+			ResolverPlaygroundTestCase(
+				["app-misc/blocker-runtime-hard-a"],
+				success = False,
+				mergelist = ['app-misc/blocker-runtime-hard-a-1', '!!app-misc/blocker-runtime-hard-a']),
 		)
 
 		playground = ResolverPlayground(ebuilds=ebuilds, installed=installed)



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/tests/resolver/, pym/_emerge/
@ 2011-05-26  6:18 Zac Medico
  0 siblings, 0 replies; 7+ messages in thread
From: Zac Medico @ 2011-05-26  6:18 UTC (permalink / raw
  To: gentoo-commits

commit:     75b0a8aed8e56f02c0b455b4ee31fdc7e2b464cf
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun May 22 23:48:42 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 26 04:24:53 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=75b0a8ae

_add_pkg_dep_string: handle satisfied virt_dep

This fixes a problem with the asap LIBC_PACKAGE_ATOM test case for
bug #303567.

---
 pym/_emerge/depgraph.py                        |   11 +++++++++++
 pym/portage/tests/resolver/test_merge_order.py |   10 +++++++---
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 4cb4593..8307e8f 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -1341,6 +1341,17 @@ class depgraph(object):
 					(virt_pkg.cpv, [str(x) for x in atoms]),
 					noiselevel=-1, level=logging.DEBUG)
 
+			inst_pkgs = vardb.match_pkgs(atom)
+			if inst_pkgs:
+				for inst_pkg in inst_pkgs:
+					if self._pkg_visibility_check(inst_pkg):
+						# highest visible
+						virt_dep.priority.satisfied = inst_pkg
+						break
+				if not virt_dep.priority.satisfied:
+					# none visible, so use highest
+					virt_dep.priority.satisfied = inst_pkgs[0]
+
 			if not self._add_pkg(virt_pkg, virt_dep):
 				return 0
 

diff --git a/pym/portage/tests/resolver/test_merge_order.py b/pym/portage/tests/resolver/test_merge_order.py
index 1b7cddd..ee3c786 100644
--- a/pym/portage/tests/resolver/test_merge_order.py
+++ b/pym/portage/tests/resolver/test_merge_order.py
@@ -127,18 +127,22 @@ class MergeOrderTestCase(TestCase):
 			},
 			"sys-libs/glibc-2.11" : {
 				"DEPEND" : "virtual/os-headers",
+				"RDEPEND": "",
 			},
 			"sys-libs/glibc-2.13" : {
 				"DEPEND" : "virtual/os-headers",
+				"RDEPEND": "",
 			},
 			"virtual/os-headers-0" : {
 				"RDEPEND" : "sys-kernel/linux-headers",
 			},
 			"sys-kernel/linux-headers-2.6.38": {
 				"DEPEND" : "app-arch/xz-utils",
+				"RDEPEND": "",
 			},
 			"sys-kernel/linux-headers-2.6.39": {
 				"DEPEND" : "app-arch/xz-utils",
+				"RDEPEND": "",
 			},
 			"app-arch/xz-utils-5.0.1" : {},
 			"app-arch/xz-utils-5.0.2" : {},
@@ -182,12 +186,14 @@ class MergeOrderTestCase(TestCase):
 			},
 			"sys-libs/glibc-2.11" : {
 				"DEPEND" : "virtual/os-headers",
+				"RDEPEND": "",
 			},
 			"virtual/os-headers-0" : {
 				"RDEPEND" : "sys-kernel/linux-headers",
 			},
 			"sys-kernel/linux-headers-2.6.38": {
 				"DEPEND" : "app-arch/xz-utils",
+				"RDEPEND": "",
 			},
 			"app-arch/xz-utils-5.0.1" : {},
 		}
@@ -321,14 +327,12 @@ class MergeOrderTestCase(TestCase):
 			# Test that OS_HEADERS_PACKAGE_ATOM and LIBC_PACKAGE_ATOM
 			# are merged asap, in order to account for implicit
 			# dependencies. See bug #303567.
-			# TODO: optimize this to ensure that glibc comes before xz-utils
 			ResolverPlaygroundTestCase(
 				["app-arch/xz-utils", "sys-kernel/linux-headers", "sys-libs/glibc"],
 				options = {"--complete-graph" : True},
 				success = True,
 				all_permutations = True,
-				ambiguous_merge_order = True,
-				mergelist = ['sys-kernel/linux-headers-2.6.39', ('app-arch/xz-utils-5.0.2', 'sys-libs/glibc-2.13')]),
+				mergelist = ['sys-kernel/linux-headers-2.6.39', 'sys-libs/glibc-2.13', 'app-arch/xz-utils-5.0.2']),
 		)
 
 		playground = ResolverPlayground(ebuilds=ebuilds, installed=installed)



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/tests/resolver/, pym/_emerge/
@ 2011-05-26  6:18 Zac Medico
  0 siblings, 0 replies; 7+ messages in thread
From: Zac Medico @ 2011-05-26  6:18 UTC (permalink / raw
  To: gentoo-commits

commit:     488b65fbcb14481b0903f8a8534579f5d83d775d
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon May 23 05:39:57 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 26 04:25:20 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=488b65fb

_serialize_tasks: prefer unsatisfied asap child

Optimally, satisfied deps are always merged after the asap nodes that
depend on them.

---
 pym/_emerge/depgraph.py                        |   28 ++++++++++++++++++-----
 pym/portage/tests/resolver/test_merge_order.py |    9 +++++--
 2 files changed, 28 insertions(+), 9 deletions(-)

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 8307e8f..7989835 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -4539,6 +4539,7 @@ class depgraph(object):
 					if nodes:
 						# If there is a mixture of merges and uninstalls,
 						# do the uninstalls first.
+						good_uninstalls = None
 						if len(nodes) > 1:
 							good_uninstalls = []
 							for node in nodes:
@@ -4550,7 +4551,9 @@ class depgraph(object):
 							else:
 								nodes = nodes
 
-						if ignore_priority is None and not tree_mode:
+						if good_uninstalls or len(nodes) == 1 or \
+							(ignore_priority is None and \
+							not asap_nodes and not tree_mode):
 							# Greedily pop all of these nodes since no
 							# relationship has been ignored. This optimization
 							# destroys --tree output, so it's disabled in tree
@@ -4563,12 +4566,25 @@ class depgraph(object):
 							#    will not produce a leaf node, so avoid it.
 							#  * It's normal for a selected uninstall to be a
 							#    root node, so don't check them for parents.
-							for node in nodes:
-								if node.operation == "uninstall" or \
-									mygraph.parent_nodes(node):
-									selected_nodes = [node]
+							if asap_nodes:
+								prefer_asap_parents = (True, False)
+							else:
+								prefer_asap_parents = (False,)
+							for check_asap_parent in prefer_asap_parents:
+								if check_asap_parent:
+									for node in nodes:
+										parents = mygraph.parent_nodes(node,
+											ignore_priority=DepPrioritySatisfiedRange.ignore_soft)
+										if parents and set(parents).intersection(asap_nodes):
+											selected_nodes = [node]
+											break
+								else:
+									for node in nodes:
+										if mygraph.parent_nodes(node):
+											selected_nodes = [node]
+											break
+								if selected_nodes:
 									break
-
 						if selected_nodes:
 							break
 

diff --git a/pym/portage/tests/resolver/test_merge_order.py b/pym/portage/tests/resolver/test_merge_order.py
index ee3c786..1057300 100644
--- a/pym/portage/tests/resolver/test_merge_order.py
+++ b/pym/portage/tests/resolver/test_merge_order.py
@@ -112,12 +112,13 @@ class MergeOrderTestCase(TestCase):
 			"app-misc/some-app-c-1": {
 				"RDEPEND": "app-misc/circ-buildtime-a app-misc/circ-buildtime-b",
 			},
+			"app-admin/eselect-python-20100321" : {},
 			"sys-apps/portage-2.1.9.42" : {
 				"DEPEND"  : "dev-lang/python",
 				"RDEPEND" : "dev-lang/python",
 			},
 			"sys-apps/portage-2.1.9.49" : {
-				"DEPEND"  : "dev-lang/python",
+				"DEPEND"  : "dev-lang/python >=app-admin/eselect-python-20091230",
 				"RDEPEND" : "dev-lang/python",
 			},
 			"dev-lang/python-3.1" : {},
@@ -318,12 +319,14 @@ class MergeOrderTestCase(TestCase):
 				["app-misc/blocker-runtime-hard-a"],
 				success = False,
 				mergelist = ['app-misc/blocker-runtime-hard-a-1', '!!app-misc/blocker-runtime-hard-a']),
-			# Test that PORTAGE_PACKAGE_ATOM is merged asap.
+			# Test that PORTAGE_PACKAGE_ATOM is merged asap. Optimally,
+			# satisfied deps are always merged after the asap nodes that
+			# depend on them.
 			ResolverPlaygroundTestCase(
 				["dev-lang/python", portage.const.PORTAGE_PACKAGE_ATOM],
 				success = True,
 				all_permutations = True,
-				mergelist = ['sys-apps/portage-2.1.9.49', 'dev-lang/python-3.2']),
+				mergelist = ['app-admin/eselect-python-20100321', 'sys-apps/portage-2.1.9.49', 'dev-lang/python-3.2']),
 			# Test that OS_HEADERS_PACKAGE_ATOM and LIBC_PACKAGE_ATOM
 			# are merged asap, in order to account for implicit
 			# dependencies. See bug #303567.



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/tests/resolver/, pym/_emerge/
@ 2011-05-26  6:18 Zac Medico
  0 siblings, 0 replies; 7+ messages in thread
From: Zac Medico @ 2011-05-26  6:18 UTC (permalink / raw
  To: gentoo-commits

commit:     330f09e54dd4813e70f9d9b6f945f7a524356908
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue May 24 23:59:13 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 26 04:31:20 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=330f09e5

test_merge_order: test asap PDEPEND (bug #180045)

---
 pym/_emerge/depgraph.py                        |    1 +
 pym/portage/tests/resolver/test_merge_order.py |   33 ++++++++++++++++++++++++
 2 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 7989835..21d5c19 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -4633,6 +4633,7 @@ class depgraph(object):
 							continue
 						if child in asap_nodes:
 							continue
+						# Merge PDEPEND asap for bug #180045.
 						asap_nodes.append(child)
 
 			if selected_nodes and len(selected_nodes) > 1:

diff --git a/pym/portage/tests/resolver/test_merge_order.py b/pym/portage/tests/resolver/test_merge_order.py
index ba3d9b4..e00f820 100644
--- a/pym/portage/tests/resolver/test_merge_order.py
+++ b/pym/portage/tests/resolver/test_merge_order.py
@@ -150,6 +150,26 @@ class MergeOrderTestCase(TestCase):
 			},
 			"app-arch/xz-utils-5.0.1" : {},
 			"app-arch/xz-utils-5.0.2" : {},
+			"dev-util/pkgconfig-0.25-r2" : {},
+			"kde-base/kdelibs-3.5.7" : {
+				"PDEPEND" : "kde-misc/kdnssd-avahi",
+			},
+			"kde-misc/kdnssd-avahi-0.1.2" : {
+				"DEPEND"  : "kde-base/kdelibs app-arch/xz-utils dev-util/pkgconfig",
+				"RDEPEND" : "kde-base/kdelibs",
+			},
+			"kde-base/kdnssd-3.5.7" : {
+				"DEPEND"  : "kde-base/kdelibs",
+				"RDEPEND" : "kde-base/kdelibs",
+			},
+			"kde-base/libkdegames-3.5.7" : {
+				"DEPEND"  : "kde-base/kdelibs",
+				"RDEPEND" : "kde-base/kdelibs",
+			},
+			"kde-base/kmines-3.5.7" : {
+				"DEPEND"  : "kde-base/libkdegames",
+				"RDEPEND" : "kde-base/libkdegames",
+			}
 		}
 
 		installed = {
@@ -342,6 +362,19 @@ class MergeOrderTestCase(TestCase):
 				all_permutations = True,
 				ambiguous_merge_order = True,
 				mergelist = ['sys-kernel/linux-headers-2.6.39', 'sys-devel/gcc-4.5.2', 'sys-libs/glibc-2.13', ('app-arch/xz-utils-5.0.2', 'sys-devel/binutils-2.20.1')]),
+			# Test asap install of PDEPEND for bug #180045.
+			ResolverPlaygroundTestCase(
+				["kde-base/kmines", "kde-base/kdnssd", "kde-base/kdelibs", "app-arch/xz-utils"],
+				success = True,
+				all_permutations = True,
+				ambiguous_merge_order = True,
+				merge_order_assertions = (
+					('dev-util/pkgconfig-0.25-r2', 'kde-misc/kdnssd-avahi-0.1.2'),
+					('kde-misc/kdnssd-avahi-0.1.2', 'kde-base/libkdegames-3.5.7'),
+					('kde-misc/kdnssd-avahi-0.1.2', 'kde-base/kdnssd-3.5.7'),
+					('kde-base/libkdegames-3.5.7', 'kde-base/kmines-3.5.7'),
+				),
+				mergelist = [('kde-base/kdelibs-3.5.7', 'dev-util/pkgconfig-0.25-r2', 'kde-misc/kdnssd-avahi-0.1.2', 'app-arch/xz-utils-5.0.2', 'kde-base/libkdegames-3.5.7', 'kde-base/kdnssd-3.5.7', 'kde-base/kmines-3.5.7')]),
 		)
 
 		playground = ResolverPlayground(ebuilds=ebuilds, installed=installed)



^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-05-26  6:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-26  6:18 [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/tests/resolver/, pym/_emerge/ Zac Medico
  -- strict thread matches above, loose matches on Subject: below --
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
2011-02-14  4:31 Zac Medico

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