From: Zac Medico Date: Tue, 12 Dec 2006 02:22:14 +0000 (-0000) Subject: Optimize dep_check calls in depgraph.validate_blockers() by using a fakedbapi instanc... X-Git-Tag: v2.1.2~313 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=3714f1aa2be08ff9f5c8da9a1d185dc0b704eb65;p=portage.git Optimize dep_check calls in depgraph.validate_blockers() by using a fakedbapi instance instead of the real pordbapi (minimizes available matches). svn path=/main/trunk/; revision=5277 --- diff --git a/bin/emerge b/bin/emerge index ac569b9b1..048c4abb7 100755 --- a/bin/emerge +++ b/bin/emerge @@ -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"