[prev in list] [next in list] [prev in thread] [next in thread]
List: gentoo-portage-dev
Subject: [gentoo-portage-dev] [PATCH 3/6] Binpkg: use async_lock (bug 614112)
From: Zac Medico <zmedico () gentoo ! org>
Date: 2018-04-21 8:24:37
Message-ID: 20180421082440.32706-4-zmedico () gentoo ! org
[Download RAW message or body]
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)
--
2.13.6
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic