aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2020-04-07 22:07:25 -0700
committerZac Medico <zmedico@gentoo.org>2020-04-07 22:29:49 -0700
commita0700108913e85b359ea7c579147f8f1d7825b9e (patch)
treed05f70e5c4ec24ee8c7ea5905d3b1192a896a601 /lib/_emerge
parentRevert "AsynchronousTask: Call _start_hook after _start_async" (diff)
downloadportage-a0700108913e85b359ea7c579147f8f1d7825b9e.tar.gz
portage-a0700108913e85b359ea7c579147f8f1d7825b9e.tar.bz2
portage-a0700108913e85b359ea7c579147f8f1d7825b9e.zip
Revert "EbuildPhase: add _async_start coroutine"
This reverts commit c7e52d0466211907d20cdbc04f1e90e7da626694. Bug: https://bugs.gentoo.org/716636 Signed-off-by: Zac Medico <zmedico@gentoo.org>
Diffstat (limited to 'lib/_emerge')
-rw-r--r--lib/_emerge/EbuildPhase.py21
-rw-r--r--lib/_emerge/SequentialTaskQueue.py14
2 files changed, 13 insertions, 22 deletions
diff --git a/lib/_emerge/EbuildPhase.py b/lib/_emerge/EbuildPhase.py
index f6b380e05..477e0ba97 100644
--- a/lib/_emerge/EbuildPhase.py
+++ b/lib/_emerge/EbuildPhase.py
@@ -23,7 +23,7 @@ from portage.util._dyn_libs.soname_deps_qa import (
)
from portage.package.ebuild.prepare_build_dirs import (_prepare_workdir,
_prepare_fake_distdir, _prepare_fake_filesdir)
-from portage.util.futures.compat_coroutine import coroutine, coroutine_return
+from portage.util.futures.compat_coroutine import coroutine
from portage.util import writemsg
from portage.util._async.AsyncTaskFuture import AsyncTaskFuture
from portage.util.futures.executor.fork import ForkExecutor
@@ -69,10 +69,6 @@ class EbuildPhase(CompositeTask):
_locked_phases = ("setup", "preinst", "postinst", "prerm", "postrm")
def _start(self):
- self.scheduler.run_until_complete(self._async_start())
-
- @coroutine
- def _async_start(self):
need_builddir = self.phase not in EbuildProcess._phases_without_builddir
@@ -142,17 +138,20 @@ class EbuildPhase(CompositeTask):
env_extractor = BinpkgEnvExtractor(background=self.background,
scheduler=self.scheduler, settings=self.settings)
if env_extractor.saved_env_exists():
- self._current_task = env_extractor
- yield env_extractor.async_start()
- yield env_extractor.async_wait()
- if self._default_exit(env_extractor) != os.EX_OK:
- self._async_wait()
- coroutine_return()
+ self._start_task(env_extractor, self._env_extractor_exit)
+ return
# If the environment.bz2 doesn't exist, then ebuild.sh will
# source the ebuild as a fallback.
self._start_lock()
+ def _env_extractor_exit(self, env_extractor):
+ if self._default_exit(env_extractor) != os.EX_OK:
+ self.wait()
+ return
+
+ self._start_lock()
+
def _start_lock(self):
if (self.phase in self._locked_phases and
"ebuild-locks" in self.settings.features):
diff --git a/lib/_emerge/SequentialTaskQueue.py b/lib/_emerge/SequentialTaskQueue.py
index 38ebb98d8..656e5cf7c 100644
--- a/lib/_emerge/SequentialTaskQueue.py
+++ b/lib/_emerge/SequentialTaskQueue.py
@@ -1,11 +1,9 @@
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from collections import deque
import sys
-from portage.util.futures import asyncio
-from portage.util.futures.compat_coroutine import coroutine
from portage.util.SlotObject import SlotObject
class SequentialTaskQueue(SlotObject):
@@ -43,23 +41,17 @@ class SequentialTaskQueue(SlotObject):
cancelled = getattr(task, "cancelled", None)
if not cancelled:
self.running_tasks.add(task)
- future = asyncio.ensure_future(self._task_coroutine(task), loop=task.scheduler)
- future.add_done_callback(lambda future: future.cancelled() or future.result())
# This callback will be invoked as soon as the task
# exits (before the future's done callback is called),
# and this is required in order for bool(self) to have
# an updated value for Scheduler._schedule to base
# assumptions upon. Delayed updates to bool(self) is
- # what caused Scheduler to hang as in bug 709746.
+ # what caused Scheduler to hang as in bug 711322.
task.addExitListener(self._task_exit)
+ task.start()
finally:
self._scheduling = False
- @coroutine
- def _task_coroutine(self, task):
- yield task.async_start()
- yield task.async_wait()
-
def _task_exit(self, task):
"""
Since we can always rely on exit listeners being called, the set of