When executing the 'depend' phase inside aux_get(), use the
authorZac Medico <zmedico@gentoo.org>
Tue, 10 Aug 2010 07:37:54 +0000 (00:37 -0700)
committerZac Medico <zmedico@gentoo.org>
Tue, 10 Aug 2010 07:37:54 +0000 (00:37 -0700)
EbuildMetadataPhase class, so we can eliminate redundant code.

pym/portage/dbapi/porttree.py

index b0cd5f49a617371cb4a29d06686b7aa864dbc1a2..1db15da514cd6cc3ecc05c52a4aaa7049aac8d56 100644 (file)
@@ -35,6 +35,8 @@ from portage import _encodings
 from portage import _unicode_decode
 from portage import _unicode_encode
 from portage import OrderedDict
+from _emerge.EbuildMetadataPhase import EbuildMetadataPhase
+from _emerge.TaskScheduler import TaskScheduler
 
 import os as _os
 import codecs
@@ -524,8 +526,7 @@ class portdbapi(dbapi):
                if metadata is not None:
                        return None
 
-               import _emerge
-               process = _emerge.EbuildMetadataPhase(cpv=cpv, ebuild_path=ebuild_path,
+               process = EbuildMetadataPhase(cpv=cpv, ebuild_path=ebuild_path,
                        ebuild_mtime=emtime, metadata_callback=self._metadata_callback,
                        portdb=self, repo_path=repo_path, settings=self.doebuild_settings)
                return process
@@ -664,16 +665,24 @@ class portdbapi(dbapi):
 
                        if eapi is not None and not portage.eapi_is_supported(eapi):
                                mydata['EAPI'] = eapi
+                               self._metadata_callback(
+                                       mycpv, myebuild, mylocation, mydata, emtime)
                        else:
-                               myret = doebuild(myebuild, "depend",
-                                       self.doebuild_settings["ROOT"], self.doebuild_settings,
-                                       dbkey=mydata, tree="porttree", mydbapi=self)
-                               if myret != os.EX_OK:
+                               sched = TaskScheduler()
+                               proc = EbuildMetadataPhase(cpv=mycpv, ebuild_path=myebuild,
+                                       ebuild_mtime=emtime,
+                                       metadata_callback=self._metadata_callback, portdb=self,
+                                       repo_path=mylocation, scheduler=sched.sched_iface,
+                                       settings=self.doebuild_settings)
+
+                               sched.add(proc)
+                               sched.run()
+
+                               if proc.returncode != os.EX_OK:
                                        self._broken_ebuilds.add(myebuild)
                                        raise KeyError(mycpv)
 
-                       self._metadata_callback(
-                               mycpv, myebuild, mylocation, mydata, emtime)
+                               mydata.update(proc.metadata)
 
                        if mydata.get("INHERITED", False):
                                mydata["_eclasses_"] = self._repo_info[mylocation