Add a PackageMerge class to serve as an asynchronous interface to package
authorZac Medico <zmedico@gentoo.org>
Sun, 6 Jul 2008 15:17:10 +0000 (15:17 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 6 Jul 2008 15:17:10 +0000 (15:17 -0000)
merges. For now it executes synchronously inside the start() method.

svn path=/main/trunk/; revision=10961

pym/_emerge/__init__.py

index f1316e92bf4bb19e721cd76b3cc266a49066646c..ca69164b5fe5fb5bc28e6bf02c8c04433d05a39c 100644 (file)
@@ -2893,6 +2893,18 @@ class MergeListItem(CompositeTask):
                retval = self._install_task.install()
                return retval
 
+class PackageMerge(CompositeTask):
+       """
+       TODO: Implement asynchronous merge so that the scheduler can
+       run while a merge is executing.
+       """
+
+       __slots__ = ("merge",)
+
+       def start(self):
+               self.returncode = self.merge.merge()
+               self.wait()
+
 class DependencyArg(object):
        def __init__(self, arg=None, root_config=None):
                self.arg = arg
@@ -7850,7 +7862,9 @@ class Scheduler(object):
                        retval = task.wait()
 
                        if retval == os.EX_OK:
-                               retval = task.merge()
+                               task = PackageMerge(merge=task)
+                               task.start()
+                               retval = task.wait()
 
                        if retval == os.EX_OK:
                                self.curval += 1