summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pym/_emerge/depgraph.py50
-rw-r--r--pym/portage/tests/resolver/test_depth.py33
2 files changed, 67 insertions, 16 deletions
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 975ae0ca2..2257318d2 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 cecdd37e2..65cfac6c2 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"],