Optimize dep_check calls in depgraph.validate_blockers() by using a fakedbapi instanc...
authorZac Medico <zmedico@gentoo.org>
Tue, 12 Dec 2006 02:22:14 +0000 (02:22 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 12 Dec 2006 02:22:14 +0000 (02:22 -0000)
svn path=/main/trunk/; revision=5277

bin/emerge

index ac569b9b1dec3981f96061d64e731528b8625dc9..048c4abb741f12c2f13414585c996979de4c1ff8 100755 (executable)
@@ -1472,6 +1472,19 @@ class depgraph:
                        # been pulled into the depgraph.  This is not enabled by default
                        # due to the performance penalty that is incurred by all the
                        # additional dep_check calls that are required.
+
+                       # Optimization hack for dep_check calls that minimizes the
+                       # available matches by replacing the portdb with a fakedbapi
+                       # instance.
+                       class FakePortageTree(object):
+                               def __init__(self, mydb):
+                                       self.dbapi = mydb
+                       dep_check_trees = {}
+                       for myroot in self.trees:
+                               dep_check_trees[myroot] = self.trees[myroot].copy()
+                               dep_check_trees[myroot]["porttree"] = \
+                                       FakePortageTree(self.mydbapi[myroot])
+
                        dep_keys = ["DEPEND","RDEPEND","PDEPEND"]
                        for myroot in self.trees:
                                pkg_node_map = self.pkg_node_map[myroot]
@@ -1494,7 +1507,7 @@ class depgraph:
                                                # optimize dep_check calls by eliminating atoms via
                                                # dep_wordreduce and dep_eval calls.
                                                success, atoms = portage.dep_check(depstr, final_db,
-                                                       pkgsettings, myuse=myuse, trees=self.trees,
+                                                       pkgsettings, myuse=myuse, trees=dep_check_trees,
                                                        myroot=myroot)
                                                if not success:
                                                        print "\n\n"