Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Cc: Zac Medico <zmedico@g.o>
Subject: [gentoo-portage-dev] [PATCH 4/6] EbuildBuild: use async_lock (bug 614112)
Date: Sat, 21 Apr 2018 08:28:41
Message-Id: 20180421082440.32706-5-zmedico@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH 0/6] EbuildBuildDir: add async_lock method (bug 614112) by Zac Medico
1 Asynchronously lock the build directory, and use AsyncTaskFuture
2 to fit the resulting future into the CompositeTask framework that
3 EbuildBuild uses.
4
5 Bug: https://bugs.gentoo.org/614112
6 ---
7 pym/_emerge/EbuildBuild.py | 7 ++++++-
8 1 file changed, 6 insertions(+), 1 deletion(-)
9
10 diff --git a/pym/_emerge/EbuildBuild.py b/pym/_emerge/EbuildBuild.py
11 index f1a2103a3..9d4afd0ea 100644
12 --- a/pym/_emerge/EbuildBuild.py
13 +++ b/pym/_emerge/EbuildBuild.py
14 @@ -150,8 +150,13 @@ class EbuildBuild(CompositeTask):
15
16 self._build_dir = EbuildBuildDir(
17 scheduler=self.scheduler, settings=settings)
18 - self._build_dir.lock()
19 + self._start_task(
20 + AsyncTaskFuture(future=self._build_dir.async_lock()),
21 + self._start_pre_clean)
22
23 + def _start_pre_clean(self, lock_task):
24 + self._assert_current(lock_task)
25 + lock_task.future.result()
26 # Cleaning needs to happen before fetch, since the build dir
27 # is used for log handling.
28 msg = " === (%s of %s) Cleaning (%s::%s)" % \
29 --
30 2.13.6