From 6edc8e26b9b08108beb1415268167a787df3be3d Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 28 Jun 2008 05:24:13 +0000 Subject: [PATCH] Split out an EbuildMerge class. svn path=/main/trunk/; revision=10829 --- pym/_emerge/__init__.py | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index 4d252526c..23de6ef01 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -1451,6 +1451,30 @@ class EbuildFetcher(Task): mydbapi=portdb, tree="porttree") return retval +class EbuildMerge(Task): + + __slots__ = ("find_blockers", "ldpath_mtimes", + "pkg", "pretend", "settings") + + def _get_hash_key(self): + hash_key = getattr(self, "_hash_key", None) + if hash_key is None: + self._hash_key = ("EbuildMerge", self.pkg._get_hash_key()) + return self._hash_key + + def execute(self): + root_config = self.pkg.root_config + settings = self.settings + retval = portage.merge(settings["CATEGORY"], + settings["PF"], settings["D"], + os.path.join(settings["PORTAGE_BUILDDIR"], + "build-info"), root_config.root, settings, + myebuild=settings["EBUILD"], + mytree="porttree", mydbapi=root_config.trees["porttree"].dbapi, + vartree=vartree, prev_mtimes=self.ldpath_mtimes, + blockers=self.find_blockers) + return retval + class BinpkgFetcher(Task): __slots__ = ("use_locks", "pkg", "pretend", @@ -6460,14 +6484,12 @@ class MergeTask(object): if retval != os.EX_OK: raise self._pkg_failure(retval) - retval = portage.merge(pkgsettings["CATEGORY"], - pkgsettings["PF"], pkgsettings["D"], - os.path.join(pkgsettings["PORTAGE_BUILDDIR"], - "build-info"), myroot, pkgsettings, - myebuild=pkgsettings["EBUILD"], - mytree="porttree", mydbapi=portdb, - vartree=vartree, prev_mtimes=ldpath_mtimes, - blockers=self._find_blockers(pkg)) + merge = EbuildMerge( + find_blockers=self._find_blockers(pkg), + ldpath_mtimes=ldpath_mtimes, + pkg=pkg, pretend=pretend, settings=pkgsettings) + retval = merge.execute() + if retval != os.EX_OK: raise self._pkg_failure(retval) finally: -- 2.26.2