Move code from bug #258773 to dep_zapdeps, since the parent always needs to
authorZac Medico <zmedico@gentoo.org>
Mon, 29 Jun 2009 22:41:55 +0000 (22:41 -0000)
committerZac Medico <zmedico@gentoo.org>
Mon, 29 Jun 2009 22:41:55 +0000 (22:41 -0000)
be passed in for atom validation in order to solve bug #275821.

svn path=/main/trunk/; revision=13735

pym/_emerge/depgraph.py
pym/portage/__init__.py

index bb0f4da3bce95865d1117f0a9ac71dd63e2aba2d..25e385521ad0644e5f86a55c93283e783ab60217 100644 (file)
@@ -1593,18 +1593,12 @@ class depgraph(object):
                pkgsettings = self.pkgsettings[root]
                if trees is None:
                        trees = self._filtered_trees
-               if not getattr(priority, "buildtime", False):
-                       # The parent should only be passed to dep_check() for buildtime
-                       # dependencies since that's the only case when it's appropriate
-                       # to trigger the circular dependency avoidance code which uses it.
-                       # It's important not to trigger the same circular dependency
-                       # avoidance code for runtime dependencies since it's not needed
-                       # and it can promote an incorrect package choice.
-                       parent = None
                if True:
                        try:
                                if parent is not None:
                                        trees[root]["parent"] = parent
+                               if priority is not None:
+                                       trees[root]["priority"] = priority
                                if not strict:
                                        portage.dep._dep_check_strict = False
                                mycheck = portage.dep_check(depstring, None,
@@ -1613,6 +1607,8 @@ class depgraph(object):
                        finally:
                                if parent is not None:
                                        trees[root].pop("parent")
+                               if priority is not None:
+                                       trees[root].pop("priority")
                                portage.dep._dep_check_strict = True
                        if not mycheck[0]:
                                raise portage.exception.InvalidDependString(mycheck[1])
index 6a8b401f414fef499cd084f99f6a299ca0ca3789..d14456565279517b8c85fbb253d9b87c9d4638f1 100644 (file)
@@ -7058,6 +7058,7 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
 
        # Alias the trees we'll be checking availability against
        parent   = trees[myroot].get("parent")
+       priority = trees[myroot].get("priority")
        graph_db = trees[myroot].get("graph_db")
        vardb = None
        if "vartree" in trees[myroot]:
@@ -7134,12 +7135,14 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
                                                all_in_graph = False
                                                break
                                if all_in_graph:
-                                       if parent is None:
+                                       if parent is None or priority is None:
                                                preferred_not_installed.append(this_choice)
-                                       else:
+                                       elif priority.buildtime:
                                                # Check if the atom would result in a direct circular
                                                # dependency and try to avoid that if it seems likely
-                                               # to be unresolvable.
+                                               # to be unresolvable. This is only relevant for
+                                               # buildtime deps that aren't already satisfied by an
+                                               # installed package.
                                                cpv_slot_list = [parent]
                                                circular_atom = None
                                                for atom in atoms: