From bf8bed7916ce3be898adc24c424705730ed06a02 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Tue, 10 Aug 2010 00:37:54 -0700 Subject: [PATCH] When executing the 'depend' phase inside aux_get(), use the EbuildMetadataPhase class, so we can eliminate redundant code. --- pym/portage/dbapi/porttree.py | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py index b0cd5f49a..1db15da51 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -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 -- 2.26.2