When searching for a "sys-apps/portage" installation task, use match_pkgs()
authorZac Medico <zmedico@gentoo.org>
Fri, 2 May 2008 20:31:33 +0000 (20:31 -0000)
committerZac Medico <zmedico@gentoo.org>
Fri, 2 May 2008 20:31:33 +0000 (20:31 -0000)
instead of sequential search. (trunk r10104)

svn path=/main/branches/2.1.2/; revision=10105

bin/emerge

index 38997c2e084d1f0674523e91916256d961a04651..2eb370f020c1a76ac534d10bb18877d596d187c8 100755 (executable)
@@ -3577,7 +3577,7 @@ class depgraph(object):
                complete = "complete" in self.myparams
                myblocker_parents = self._blocker_parents.copy()
                asap_nodes = []
-               portage_node = None
+
                def get_nodes(**kwargs):
                        """
                        Returns leaf nodes excluding Uninstall instances
@@ -3588,13 +3588,15 @@ class depgraph(object):
                                node.operation != "uninstall"]
 
                # sys-apps/portage needs special treatment if ROOT="/"
-               for node in mygraph.order:
-                       if isinstance(node, Package) and \
-                               "sys-apps/portage" == node.cp and \
-                               "/" == node.root:
-                               portage_node = node
-                               asap_nodes.append(node)
-                               break
+               portage_node = self.mydbapi["/"].match_pkgs("sys-apps/portage")
+               if portage_node:
+                       portage_node = portage_node[0]
+               else:
+                       portage_node = None
+               if portage_node is not None and \
+                       (not mygraph.contains(portage_node) or \
+                       portage_node.operation == "nomerge"):
+                       portage_node = None
 
                ignore_priority_soft_range = [None]
                ignore_priority_soft_range.extend(