From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 46596138350 for ; Wed, 8 Apr 2020 05:56:51 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 031EEE0942; Wed, 8 Apr 2020 05:56:50 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id DDD37E0942 for ; Wed, 8 Apr 2020 05:56:49 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 6200E34F0E9 for ; Wed, 8 Apr 2020 05:56:48 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id A91DE1C8 for ; Wed, 8 Apr 2020 05:56:46 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1586323785.c2ffa9413bbad9d56cbed6e1d779c204fafafc69.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: lib/_emerge/ X-VCS-Repository: proj/portage X-VCS-Files: lib/_emerge/BinpkgFetcher.py X-VCS-Directories: lib/_emerge/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: c2ffa9413bbad9d56cbed6e1d779c204fafafc69 X-VCS-Branch: master Date: Wed, 8 Apr 2020 05:56:46 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 3112249a-27a7-491b-865d-63ff35aa1023 X-Archives-Hash: 036de8d58a26f1280848c237d1c13bf3 commit: c2ffa9413bbad9d56cbed6e1d779c204fafafc69 Author: Zac Medico gentoo org> AuthorDate: Wed Apr 8 04:48:05 2020 +0000 Commit: Zac Medico gentoo org> CommitDate: Wed Apr 8 05:29:45 2020 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=c2ffa941 Revert "_BinpkgFetcherProcess: fix async_lock event loop recursion (bug 711178)" This reverts commit 1681309f252a4e91d7256b895a9af26ef82a9b30. Bug: https://bugs.gentoo.org/716636 Signed-off-by: Zac Medico gentoo.org> lib/_emerge/BinpkgFetcher.py | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/lib/_emerge/BinpkgFetcher.py b/lib/_emerge/BinpkgFetcher.py index e788cb05d..640eead91 100644 --- a/lib/_emerge/BinpkgFetcher.py +++ b/lib/_emerge/BinpkgFetcher.py @@ -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 import asyncio from portage.util.futures.compat_coroutine import coroutine if sys.hexversion >= 0x3000000: @@ -206,7 +205,6 @@ class _BinpkgFetcherProcess(SpawnProcess): except OSError: pass - @coroutine def async_lock(self): """ This raises an AlreadyLocked exception if lock() is called @@ -217,22 +215,22 @@ class _BinpkgFetcherProcess(SpawnProcess): if self._lock_obj is not None: raise self.AlreadyLocked((self._lock_obj,)) - async_lock = self._lock_obj = AsynchronousLock(path=self.pkg_path, + result = self.scheduler.create_future() + + def acquired_lock(async_lock): + if async_lock.wait() == os.EX_OK: + self.locked = True + result.set_result(None) + else: + result.set_exception(AssertionError( + "AsynchronousLock failed with returncode %s" + % (async_lock.returncode,))) + + self._lock_obj = AsynchronousLock(path=self.pkg_path, scheduler=self.scheduler) - try: - yield async_lock.async_start() - yield async_lock.async_wait() - except asyncio.CancelledError: - if async_lock.poll() is None: - async_lock.cancel() - raise - - if async_lock.returncode != os.EX_OK: - raise AssertionError( - "AsynchronousLock failed with returncode %s" - % (async_lock.returncode,)) - - self.locked = True + self._lock_obj.addExitListener(acquired_lock) + self._lock_obj.start() + return result class AlreadyLocked(portage.exception.PortageException): pass