commit: ee5305f26a0bdc6054307289c2487c241735bcbb Author: Zac Medico <zmedico <AT> gentoo <DOT> org> AuthorDate: Sat Apr 21 07:32:45 2018 +0000 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> CommitDate: Sun Apr 22 18:30:52 2018 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=ee5305f2
Binpkg: use async_lock (bug 614112) Asynchronously lock the build directory, and use AsyncTaskFuture to fit the resulting future into the CompositeTask framework that Binpkg uses. Bug: https://bugs.gentoo.org/614112 pym/_emerge/Binpkg.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/pym/_emerge/Binpkg.py b/pym/_emerge/Binpkg.py index 09a1fe680..e9c5ef568 100644 --- a/pym/_emerge/Binpkg.py +++ b/pym/_emerge/Binpkg.py @@ -112,15 +112,25 @@ class Binpkg(CompositeTask): self.wait() return - pkg = self.pkg - pkg_count = self.pkg_count if not (self.opts.pretend or self.opts.fetchonly): - self._build_dir.lock() + self._start_task( + AsyncTaskFuture(future=self._build_dir.async_lock()), + self._start_fetcher) + else: + self._start_fetcher() + + def _start_fetcher(self, lock_task=None): + if lock_task is not None: + self._assert_current(lock_task) + lock_task.future.result() # Initialize PORTAGE_LOG_FILE (clean_log won't work without it). portage.prepare_build_dirs(self.settings["ROOT"], self.settings, 1) # If necessary, discard old log so that we don't # append to it. self._build_dir.clean_log() + + pkg = self.pkg + pkg_count = self.pkg_count fetcher = BinpkgFetcher(background=self.background, logfile=self.settings.get("PORTAGE_LOG_FILE"), pkg=self.pkg, pretend=self.opts.pretend, scheduler=self.scheduler)
