Optimize ResolverPlayground._create_ebuild_manifests() to use a single
authorZac Medico <zmedico@gentoo.org>
Mon, 20 Sep 2010 00:55:27 +0000 (17:55 -0700)
committerZac Medico <zmedico@gentoo.org>
Mon, 20 Sep 2010 00:55:27 +0000 (17:55 -0700)
config instance, and call digestgen() directly.

pym/portage/tests/resolver/ResolverPlayground.py

index f05bdf184f5a58ae052b380e1ea0a6e071f7af5f..8d2a9fd3b567b3ba43cd1f4a5e1260f8ecff9f79 100644 (file)
@@ -12,6 +12,7 @@ from portage.dbapi.porttree import portagetree
 from portage.dbapi.bintree import binarytree
 from portage.dep import Atom, _repo_separator
 from portage.package.ebuild.config import config
+from portage.package.ebuild.digestgen import digestgen
 from portage._sets import load_default_config
 from portage.versions import catsplit
 
@@ -139,6 +140,8 @@ class ResolverPlayground(object):
                        f.close()
 
        def _create_ebuild_manifests(self, ebuilds):
+               tmpsettings = config(clone=self.settings)
+               tmpsettings['PORTAGE_QUIET'] = '1'
                for cpv in ebuilds:
                        a = Atom("=" + cpv, allow_repo=True)
                        repo = a.repo
@@ -149,12 +152,10 @@ class ResolverPlayground(object):
                        ebuild_dir = os.path.join(repo_dir, a.cp)
                        ebuild_path = os.path.join(ebuild_dir, a.cpv.split("/")[1] + ".ebuild")
 
-                       portage.util.noiselimit = -1
-                       tmpsettings = config(clone=self.settings)
                        portdb = self.trees[self.root]["porttree"].dbapi
-                       portage.doebuild(ebuild_path, "digest", self.root, tmpsettings,
-                               tree="porttree", mydbapi=portdb)
-                       portage.util.noiselimit = 0
+                       tmpsettings['O'] = ebuild_dir
+                       if not digestgen(mysettings=tmpsettings, myportdb=portdb):
+                               raise AssertionError('digest creation failed for %s' % ebuild_path)
 
        def _create_installed(self, installed):
                for cpv in installed: