Asynchronously lock the build directory, and use AsyncTaskFuture
to fit the resulting future into the CompositeTask framework that
EbuildBuild uses.

Bug: https://bugs.gentoo.org/614112
---
 pym/_emerge/EbuildBuild.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/pym/_emerge/EbuildBuild.py b/pym/_emerge/EbuildBuild.py
index f1a2103a3..9d4afd0ea 100644
--- a/pym/_emerge/EbuildBuild.py
+++ b/pym/_emerge/EbuildBuild.py
@@ -150,8 +150,13 @@ class EbuildBuild(CompositeTask):
 
                self._build_dir = EbuildBuildDir(
                        scheduler=self.scheduler, settings=settings)
-               self._build_dir.lock()
+               self._start_task(
+                       AsyncTaskFuture(future=self._build_dir.async_lock()),
+                       self._start_pre_clean)
 
+       def _start_pre_clean(self, lock_task):
+               self._assert_current(lock_task)
+               lock_task.future.result()
                # Cleaning needs to happen before fetch, since the build dir
                # is used for log handling.
                msg = " === (%s of %s) Cleaning (%s::%s)" % \
-- 
2.13.6


Reply via email to