aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2013-02-11 14:51:09 -0800
committerZac Medico <zmedico@gentoo.org>2013-02-11 14:51:09 -0800
commit041f75fd030074d037458ade3462e0ed395e86c6 (patch)
treec0e1103f9d29df2fb65f6304a62c93ecca33af90
parentDisable IUSE check for binary pkg API consumers. (diff)
downloadportage-041f75fd030074d037458ade3462e0ed395e86c6.tar.gz
portage-041f75fd030074d037458ade3462e0ed395e86c6.tar.bz2
portage-041f75fd030074d037458ade3462e0ed395e86c6.zip
_add_pkg: fix existing_node early return
This fixes a case where it would return early, before calling _add_slot_operator_dep, which could prevent slot-operator backtracking from working properly. This makes SlotChangeWithoutRevBumpTestCase work properly when we add an undesirable app-arch/libarchive-3.1.1 binary package.
-rw-r--r--pym/_emerge/depgraph.py52
-rw-r--r--pym/portage/tests/resolver/test_slot_change_without_revbump.py11
2 files changed, 39 insertions, 24 deletions
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index c3560105c..7423ae0be 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -1653,24 +1653,25 @@ class depgraph(object):
if existing_node:
if existing_node_matches:
# The existing node can be reused.
- if arg_atoms:
- for parent_atom in arg_atoms:
- parent, atom = parent_atom
- self._dynamic_config.digraph.add(existing_node, parent,
- priority=priority)
- self._add_parent_atom(existing_node, parent_atom)
- # If a direct circular dependency is not an unsatisfied
- # buildtime dependency then drop it here since otherwise
- # it can skew the merge order calculation in an unwanted
- # way.
- if existing_node != myparent or \
- (priority.buildtime and not priority.satisfied):
- self._dynamic_config.digraph.addnode(existing_node, myparent,
- priority=priority)
- if dep.atom is not None and dep.parent is not None:
- self._add_parent_atom(existing_node,
- (dep.parent, dep.atom))
- return 1
+ if pkg != existing_node:
+ pkg = existing_node
+ previously_added = True
+ try:
+ arg_atoms = list(self._iter_atoms_for_pkg(pkg))
+ except InvalidDependString as e:
+ if not pkg.installed:
+ # should have been masked before
+ # it was selected
+ raise
+
+ if debug:
+ writemsg_level(
+ "%s%s %s\n" % ("Re-used Child:".ljust(15),
+ pkg, pkg_use_display(pkg,
+ self._frozen_config.myopts,
+ modified_use=self._pkg_use_enabled(pkg))),
+ level=logging.DEBUG, noiselevel=-1)
+
else:
self._add_slot_conflict(pkg)
if debug:
@@ -1721,12 +1722,19 @@ class depgraph(object):
if arg_atoms:
self._dynamic_config._set_nodes.add(pkg)
- # Do this even when addme is False (--onlydeps) so that the
+ # Do this even for onlydeps, so that the
# parent/child relationship is always known in case
# self._show_slot_collision_notice() needs to be called later.
- self._dynamic_config.digraph.add(pkg, myparent, priority=priority)
- if dep.atom is not None and dep.parent is not None:
- self._add_parent_atom(pkg, (dep.parent, dep.atom))
+ # If a direct circular dependency is not an unsatisfied
+ # buildtime dependency then drop it here since otherwise
+ # it can skew the merge order calculation in an unwanted
+ # way.
+ if pkg != dep.parent or \
+ (priority.buildtime and not priority.satisfied):
+ self._dynamic_config.digraph.add(pkg,
+ dep.parent, priority=priority)
+ if dep.atom is not None and dep.parent is not None:
+ self._add_parent_atom(pkg, (dep.parent, dep.atom))
if arg_atoms:
for parent_atom in arg_atoms:
diff --git a/pym/portage/tests/resolver/test_slot_change_without_revbump.py b/pym/portage/tests/resolver/test_slot_change_without_revbump.py
index dbd78dc66..d85ff7e05 100644
--- a/pym/portage/tests/resolver/test_slot_change_without_revbump.py
+++ b/pym/portage/tests/resolver/test_slot_change_without_revbump.py
@@ -25,6 +25,13 @@ class SlotChangeWithoutRevBumpTestCase(TestCase):
},
}
+ binpkgs = {
+ "app-arch/libarchive-3.1.1" : {
+ "EAPI": "5",
+ "SLOT": "0"
+ },
+ }
+
installed = {
"app-arch/libarchive-3.1.1" : {
"EAPI": "5",
@@ -46,13 +53,13 @@ class SlotChangeWithoutRevBumpTestCase(TestCase):
# without revbump needs to trigger a rebuild.
ResolverPlaygroundTestCase(
["kde-base/ark"],
- options = {"--oneshot": True},
+ options = {"--oneshot": True, "--usepkg": True},
success = True,
mergelist = ['app-arch/libarchive-3.1.1', "kde-base/ark-4.10.0"]),
)
- playground = ResolverPlayground(ebuilds=ebuilds,
+ playground = ResolverPlayground(ebuilds=ebuilds, binpkgs=binpkgs,
installed=installed, world=world, debug=False)
try:
for test_case in test_cases: