EbuildMerge: inherit from CompositeTask
authorZac Medico <zmedico@gentoo.org>
Sun, 15 May 2011 09:02:08 +0000 (02:02 -0700)
committerZac Medico <zmedico@gentoo.org>
Sun, 15 May 2011 09:02:08 +0000 (02:02 -0700)
pym/_emerge/Binpkg.py
pym/_emerge/EbuildBuild.py
pym/_emerge/EbuildMerge.py

index bc6b85da238a96dcebe9681fc6262e8f3ca9f241..1ed5c1fe04c1374e679e065475912318e4f28495 100644 (file)
@@ -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
 
index 1de8fbf504bf15fc6be7b83a871d27b8df6d2dd8..a678ede045af794287db7dc03fe1cde09c9c1dff 100644 (file)
@@ -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
 
index 78711b7b17b7a47a51e38c6b47a05a1255afabe4..28d17f995ced8453d3d987194a5cfc8509c46161 100644 (file)
@@ -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()