From 33a3a2d9cdc44e07aaece8fdf08a3d3bde6e5d82 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sun, 15 May 2011 02:02:08 -0700 Subject: [PATCH] EbuildMerge: inherit from CompositeTask --- pym/_emerge/Binpkg.py | 3 +-- pym/_emerge/EbuildBuild.py | 3 +-- pym/_emerge/EbuildMerge.py | 20 ++++++++++---------- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/pym/_emerge/Binpkg.py b/pym/_emerge/Binpkg.py index bc6b85da2..1ed5c1fe0 100644 --- a/pym/_emerge/Binpkg.py +++ b/pym/_emerge/Binpkg.py @@ -315,12 +315,11 @@ class Binpkg(CompositeTask): settings["PORTAGE_BINPKG_FILE"] = self._pkg_path settings.backup_changes("PORTAGE_BINPKG_FILE") - merge = EbuildMerge(find_blockers=self.find_blockers, + task = EbuildMerge(find_blockers=self.find_blockers, ldpath_mtimes=self.ldpath_mtimes, logger=self.logger, pkg=self.pkg, pkg_count=self.pkg_count, pkg_path=self._pkg_path, scheduler=self.scheduler, settings=settings, tree=self._tree, world_atom=self.world_atom) - task = merge.create_task() task.addExitListener(self._install_exit) return task diff --git a/pym/_emerge/EbuildBuild.py b/pym/_emerge/EbuildBuild.py index 1de8fbf50..a678ede04 100644 --- a/pym/_emerge/EbuildBuild.py +++ b/pym/_emerge/EbuildBuild.py @@ -330,7 +330,7 @@ class EbuildBuild(CompositeTask): ebuild_path = self._ebuild_path tree = self._tree - merge = EbuildMerge(find_blockers=self.find_blockers, + task = EbuildMerge(find_blockers=self.find_blockers, ldpath_mtimes=ldpath_mtimes, logger=logger, pkg=pkg, pkg_count=pkg_count, pkg_path=ebuild_path, scheduler=self.scheduler, @@ -343,7 +343,6 @@ class EbuildBuild(CompositeTask): (pkg_count.curval, pkg_count.maxval, pkg.cpv) logger.log(msg, short_msg=short_msg) - task = merge.create_task() task.addExitListener(self._install_exit) return task diff --git a/pym/_emerge/EbuildMerge.py b/pym/_emerge/EbuildMerge.py index 78711b7b1..28d17f995 100644 --- a/pym/_emerge/EbuildMerge.py +++ b/pym/_emerge/EbuildMerge.py @@ -1,26 +1,24 @@ # Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -from _emerge.SlotObject import SlotObject -import portage +from _emerge.CompositeTask import CompositeTask from portage import os from portage.dbapi._MergeProcess import MergeProcess from portage.dbapi.vartree import dblink -class EbuildMerge(SlotObject): +class EbuildMerge(CompositeTask): __slots__ = ("find_blockers", "logger", "ldpath_mtimes", "pkg", "pkg_count", "pkg_path", "pretend", - "scheduler", "settings", "tree", "world_atom") + "settings", "tree", "world_atom") - def create_task(self): + def _start(self): root_config = self.pkg.root_config settings = self.settings mycat = settings["CATEGORY"] mypkg = settings["PF"] pkgloc = settings["D"] infloc = os.path.join(settings["PORTAGE_BUILDDIR"], "build-info") - myroot = root_config.root myebuild = settings["EBUILD"] mydbapi = root_config.trees[self.tree].dbapi vartree = root_config.trees["vartree"] @@ -33,11 +31,12 @@ class EbuildMerge(SlotObject): background=background, blockers=self.find_blockers, pkgloc=pkgloc, infloc=infloc, myebuild=myebuild, mydbapi=mydbapi, prev_mtimes=self.ldpath_mtimes, logfile=logfile) - merge_task.addExitListener(self._log_exit) - return merge_task - def _log_exit(self, task): - if task.returncode != os.EX_OK: + self._start_task(merge_task, self._merge_exit) + + def _merge_exit(self, merge_task): + if self._final_exit(merge_task) != os.EX_OK: + self.wait() return pkg = self.pkg @@ -55,3 +54,4 @@ class EbuildMerge(SlotObject): logger.log(" ::: completed emerge (%s of %s) %s to %s" % \ (pkg_count.curval, pkg_count.maxval, pkg.cpv, pkg.root)) + self.wait() -- 2.26.2