From c1a2218aa4e233492a9f137130bca4a1cde9df6c Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 28 Jun 2008 06:10:23 +0000 Subject: [PATCH] Split out an EbuildBuild class. svn path=/main/trunk/; revision=10831 --- pym/_emerge/__init__.py | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index d9a008dee..61e67f1c5 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 EbuildBuild(Task): + + __slots__ = ("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 = ("EbuildBuild", self.pkg._get_hash_key()) + return self._hash_key + + def execute(self): + root_config = self.pkg.root_config + portdb = root_config.trees["porttree"].dbapi + vartree = root_config.trees["vartree"] + ebuild_path = portdb.findname(self.pkg.cpv) + debug = self.settings.get("PORTAGE_DEBUG") == "1" + + retval = portage.doebuild(ebuild_path, "install", + root_config.root, self.settings, debug, vartree=vartree, + mydbapi=portdb, tree="porttree", + prev_mtimes=self.ldpath_mtimes) + return retval + class EbuildMerge(Task): __slots__ = ("find_blockers", "ldpath_mtimes", @@ -6478,10 +6502,10 @@ class MergeTask(object): short_msg = "emerge: (%s of %s) %s Compile" % \ (mergecount, len(mymergelist), pkg_key) emergelog(xterm_titles, msg, short_msg=short_msg) - retval = portage.doebuild(y, "install", myroot, - pkgsettings, self.edebug, vartree=vartree, - mydbapi=portdb, tree="porttree", - prev_mtimes=ldpath_mtimes) + + build = EbuildBuild(ldpath_mtimes=ldpath_mtimes, + pkg=pkg, pretend=pretend, settings=pkgsettings) + retval = build.execute() if retval != os.EX_OK: raise self._pkg_failure(retval) -- 2.26.2