diff options
author | Zac Medico <zmedico@gentoo.org> | 2020-04-07 22:00:56 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2020-04-07 22:29:48 -0700 |
commit | 28adac2b67f46e11b4cf9116761d888e91e55f3c (patch) | |
tree | 2ba6d0d9027f2955c622f5722e8105034b0b6276 | |
parent | Revert "PipeLogger: non-blocking write to pipe (bug 709746)" (diff) | |
download | portage-28adac2b67f46e11b4cf9116761d888e91e55f3c.tar.gz portage-28adac2b67f46e11b4cf9116761d888e91e55f3c.tar.bz2 portage-28adac2b67f46e11b4cf9116761d888e91e55f3c.zip |
Revert "SpawnProcess: use async_start method (bug 709746)"
This reverts commit 5c40c3e7ec180c9c7d1eea521d69487177c7f519.
Bug: https://bugs.gentoo.org/716636
Signed-off-by: Zac Medico <zmedico@gentoo.org>
-rw-r--r-- | lib/_emerge/AbstractEbuildProcess.py | 2 | ||||
-rw-r--r-- | lib/_emerge/AsynchronousLock.py | 15 | ||||
-rw-r--r-- | lib/_emerge/BinpkgExtractorAsync.py | 9 | ||||
-rw-r--r-- | lib/_emerge/BinpkgFetcher.py | 9 | ||||
-rw-r--r-- | lib/_emerge/EbuildFetcher.py | 9 | ||||
-rw-r--r-- | lib/_emerge/SpawnProcess.py | 8 | ||||
-rw-r--r-- | lib/portage/dbapi/bintree.py | 4 | ||||
-rw-r--r-- | lib/portage/tests/util/futures/test_iter_completed.py | 6 | ||||
-rw-r--r-- | lib/portage/util/_async/AsyncFunction.py | 9 | ||||
-rw-r--r-- | lib/portage/util/_async/FileDigester.py | 9 |
10 files changed, 19 insertions, 61 deletions
diff --git a/lib/_emerge/AbstractEbuildProcess.py b/lib/_emerge/AbstractEbuildProcess.py index 09b76830d..fd8a40cc1 100644 --- a/lib/_emerge/AbstractEbuildProcess.py +++ b/lib/_emerge/AbstractEbuildProcess.py @@ -182,7 +182,7 @@ class AbstractEbuildProcess(SpawnProcess): self.fd_pipes[0] = null_fd try: - yield SpawnProcess._async_start(self) + SpawnProcess._start(self) finally: if null_fd is not None: os.close(null_fd) diff --git a/lib/_emerge/AsynchronousLock.py b/lib/_emerge/AsynchronousLock.py index 9efaaceac..aed1bcb15 100644 --- a/lib/_emerge/AsynchronousLock.py +++ b/lib/_emerge/AsynchronousLock.py @@ -1,4 +1,4 @@ -# Copyright 2010-2020 Gentoo Authors +# Copyright 2010-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 import fcntl @@ -21,7 +21,6 @@ from portage.exception import TryAgain from portage.localization import _ from portage.locks import lockfile, unlockfile from portage.util import writemsg_level -from portage.util.futures.compat_coroutine import coroutine from _emerge.AbstractPollTask import AbstractPollTask from _emerge.AsynchronousTask import AsynchronousTask from _emerge.SpawnProcess import SpawnProcess @@ -44,10 +43,6 @@ class AsynchronousLock(AsynchronousTask): _use_process_by_default = True def _start(self): - self.scheduler.run_until_complete(self._async_start()) - - @coroutine - def _async_start(self): if not self._force_async: try: @@ -70,7 +65,7 @@ class AsynchronousLock(AsynchronousTask): _force_dummy=self._force_dummy) self._imp.addExitListener(self._imp_exit) - yield self._imp.async_start() + self._imp.start() def _imp_exit(self, imp): # call exit listeners @@ -188,10 +183,6 @@ class _LockProcess(AbstractPollTask): ('_acquired', '_kill_test', '_proc', '_files', '_unlock_future') def _start(self): - self.scheduler.run_until_complete(self._async_start()) - - @coroutine - def _async_start(self): in_pr, in_pw = os.pipe() out_pr, out_pw = os.pipe() self._files = {} @@ -220,7 +211,7 @@ class _LockProcess(AbstractPollTask): fd_pipes={0:out_pr, 1:in_pw, 2:sys.__stderr__.fileno()}, scheduler=self.scheduler) self._proc.addExitListener(self._proc_exit) - yield self._proc.async_start() + self._proc.start() os.close(out_pr) os.close(in_pw) diff --git a/lib/_emerge/BinpkgExtractorAsync.py b/lib/_emerge/BinpkgExtractorAsync.py index 5f4caa794..3733bdeb5 100644 --- a/lib/_emerge/BinpkgExtractorAsync.py +++ b/lib/_emerge/BinpkgExtractorAsync.py @@ -1,4 +1,4 @@ -# Copyright 1999-2020 Gentoo Authors +# Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 import logging @@ -10,7 +10,6 @@ from portage.util.compression_probe import ( compression_probe, _compressors, ) -from portage.util.futures.compat_coroutine import coroutine from portage.process import find_binary from portage.util import ( shlex_split, @@ -28,10 +27,6 @@ class BinpkgExtractorAsync(SpawnProcess): _shell_binary = portage.const.BASH_BINARY def _start(self): - self.scheduler.run_until_complete(self._async_start()) - - @coroutine - def _async_start(self): tar_options = "" if "xattr" in self.features: process = subprocess.Popen(["tar", "--help"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) @@ -110,4 +105,4 @@ class BinpkgExtractorAsync(SpawnProcess): portage._shell_quote(self.image_dir), 128 + signal.SIGPIPE)] - yield SpawnProcess._async_start(self) + SpawnProcess._start(self) diff --git a/lib/_emerge/BinpkgFetcher.py b/lib/_emerge/BinpkgFetcher.py index 640eead91..36d027de3 100644 --- a/lib/_emerge/BinpkgFetcher.py +++ b/lib/_emerge/BinpkgFetcher.py @@ -1,4 +1,4 @@ -# Copyright 1999-2020 Gentoo Authors +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 import functools @@ -16,7 +16,6 @@ import portage from portage import os from portage.util._async.AsyncTaskFuture import AsyncTaskFuture from portage.util._pty import _create_pty_or_pipe -from portage.util.futures.compat_coroutine import coroutine if sys.hexversion >= 0x3000000: long = int @@ -86,10 +85,6 @@ class _BinpkgFetcherProcess(SpawnProcess): __slots__ = ("pkg", "pretend", "locked", "pkg_path", "_lock_obj") def _start(self): - self.scheduler.run_until_complete(self._async_start()) - - @coroutine - def _async_start(self): pkg = self.pkg pretend = self.pretend bintree = pkg.root_config.trees["bintree"] @@ -163,7 +158,7 @@ class _BinpkgFetcherProcess(SpawnProcess): self.env = fetch_env if settings.selinux_enabled(): self._selinux_type = settings["PORTAGE_FETCH_T"] - yield SpawnProcess._async_start(self) + SpawnProcess._start(self) def _pipe(self, fd_pipes): """When appropriate, use a pty so that fetcher progress bars, diff --git a/lib/_emerge/EbuildFetcher.py b/lib/_emerge/EbuildFetcher.py index d315d4f02..1e40994fb 100644 --- a/lib/_emerge/EbuildFetcher.py +++ b/lib/_emerge/EbuildFetcher.py @@ -1,4 +1,4 @@ -# Copyright 1999-2020 Gentoo Authors +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 import copy @@ -20,7 +20,6 @@ from portage.package.ebuild.fetch import ( ) from portage.util._async.AsyncTaskFuture import AsyncTaskFuture from portage.util._async.ForkProcess import ForkProcess -from portage.util.futures.compat_coroutine import coroutine from portage.util._pty import _create_pty_or_pipe from _emerge.CompositeTask import CompositeTask @@ -188,10 +187,6 @@ class _EbuildFetcherProcess(ForkProcess): return success def _start(self): - self.scheduler.run_until_complete(self._async_start()) - - @coroutine - def _async_start(self): root_config = self.pkg.root_config portdb = root_config.trees["porttree"].dbapi @@ -230,7 +225,7 @@ class _EbuildFetcherProcess(ForkProcess): settings["NOCOLOR"] = nocolor self._settings = settings - yield ForkProcess._async_start(self) + ForkProcess._start(self) # Free settings now since it's no longer needed in # this process (the subprocess has a private copy). diff --git a/lib/_emerge/SpawnProcess.py b/lib/_emerge/SpawnProcess.py index ba58d9d0e..395d66bb9 100644 --- a/lib/_emerge/SpawnProcess.py +++ b/lib/_emerge/SpawnProcess.py @@ -1,4 +1,4 @@ -# Copyright 2008-2020 Gentoo Authors +# Copyright 2008-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 try: @@ -20,7 +20,6 @@ from portage.localization import _ from portage.output import EOutput from portage.util import writemsg_level from portage.util._async.PipeLogger import PipeLogger -from portage.util.futures.compat_coroutine import coroutine class SpawnProcess(SubProcess): @@ -43,10 +42,7 @@ class SpawnProcess(SubProcess): _CGROUP_CLEANUP_RETRY_MAX = 8 def _start(self): - self.scheduler.run_until_complete(self._async_start()) - @coroutine - def _async_start(self): if self.fd_pipes is None: self.fd_pipes = {} else: @@ -146,8 +142,8 @@ class SpawnProcess(SubProcess): log_file_path=log_file_path, stdout_fd=stdout_fd) self._pipe_logger.addExitListener(self._pipe_logger_exit) + self._pipe_logger.start() self._registered = True - yield self._pipe_logger.async_start() def _can_log(self, slave_fd): return True diff --git a/lib/portage/dbapi/bintree.py b/lib/portage/dbapi/bintree.py index facb8b2b5..311c9a78a 100644 --- a/lib/portage/dbapi/bintree.py +++ b/lib/portage/dbapi/bintree.py @@ -1,4 +1,4 @@ -# Copyright 1998-2020 Gentoo Authors +# Copyright 1998-2019 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 from __future__ import unicode_literals @@ -283,7 +283,7 @@ class bindbapi(fakedbapi): logfile=settings.get('PORTAGE_LOG_FILE'), scheduler=SchedulerInterface(loop)) - yield extractor.async_start() + extractor.start() yield extractor.async_wait() if extractor.returncode != os.EX_OK: raise PortageException("Error Extracting '{}'".format(pkg_path)) diff --git a/lib/portage/tests/util/futures/test_iter_completed.py b/lib/portage/tests/util/futures/test_iter_completed.py index fa0594303..03ace915a 100644 --- a/lib/portage/tests/util/futures/test_iter_completed.py +++ b/lib/portage/tests/util/futures/test_iter_completed.py @@ -16,12 +16,8 @@ from portage.util.futures.iter_completed import ( class SleepProcess(ForkProcess): __slots__ = ('future', 'seconds') def _start(self): - self.scheduler.run_until_complete(self._async_start()) - - @coroutine - def _async_start(self): self.addExitListener(self._future_done) - yield ForkProcess._async_start(self) + ForkProcess._start(self) def _future_done(self, task): if not self.future.cancelled(): diff --git a/lib/portage/util/_async/AsyncFunction.py b/lib/portage/util/_async/AsyncFunction.py index bd7e84ea3..1dffa36cc 100644 --- a/lib/portage/util/_async/AsyncFunction.py +++ b/lib/portage/util/_async/AsyncFunction.py @@ -1,4 +1,4 @@ -# Copyright 2015-2020 Gentoo Authors +# Copyright 2015 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 import pickle @@ -6,7 +6,6 @@ import traceback from portage import os from portage.util._async.ForkProcess import ForkProcess -from portage.util.futures.compat_coroutine import coroutine from _emerge.PipeReader import PipeReader class AsyncFunction(ForkProcess): @@ -23,10 +22,6 @@ class AsyncFunction(ForkProcess): '_async_func_reader', '_async_func_reader_pw') def _start(self): - self.scheduler.run_until_complete(self._async_start()) - - @coroutine - def _async_start(self): pr, pw = os.pipe() self.fd_pipes = {} self.fd_pipes[pw] = pw @@ -36,7 +31,7 @@ class AsyncFunction(ForkProcess): scheduler=self.scheduler) self._async_func_reader.addExitListener(self._async_func_reader_exit) self._async_func_reader.start() - yield ForkProcess._async_start(self) + ForkProcess._start(self) os.close(pw) def _run(self): diff --git a/lib/portage/util/_async/FileDigester.py b/lib/portage/util/_async/FileDigester.py index d156a2015..bb99b9b6d 100644 --- a/lib/portage/util/_async/FileDigester.py +++ b/lib/portage/util/_async/FileDigester.py @@ -1,10 +1,9 @@ -# Copyright 2013-2020 Gentoo Authors +# Copyright 2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 from portage import os from portage.checksum import perform_multiple_checksums from portage.util._async.ForkProcess import ForkProcess -from portage.util.futures.compat_coroutine import coroutine from _emerge.PipeReader import PipeReader class FileDigester(ForkProcess): @@ -19,10 +18,6 @@ class FileDigester(ForkProcess): '_digest_pipe_reader', '_digest_pw') def _start(self): - self.scheduler.run_until_complete(self._async_start()) - - @coroutine - def _async_start(self): pr, pw = os.pipe() self.fd_pipes = {} self.fd_pipes[pw] = pw @@ -32,7 +27,7 @@ class FileDigester(ForkProcess): scheduler=self.scheduler) self._digest_pipe_reader.addExitListener(self._digest_pipe_reader_exit) self._digest_pipe_reader.start() - yield ForkProcess._async_start(self) + ForkProcess._start(self) os.close(pw) def _run(self): |