commit: 9e07f3a45c1b321edd07530b278498cb09f8983c
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 6 03:14:41 2018 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Jun 6 03:21:38 2018 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=9e07f3a4
_unlock_builddir_exit: fix cancel/returncode interaction
When the _unlock_builddir_exit returncode parameter has not been
specified, do not attempt to cancel the current task, since the
task has already completed. This mirrors logic added to the
Binpkg _unlock_builddir_exit method in the previous commit.
Fixes: 937d0156aa06 ("CompositeTask: handle SIGINT/TERM cancelled futures (bug
657436)")
Bug: https://bugs.gentoo.org/657436
pym/_emerge/AbstractEbuildProcess.py | 8 ++++++--
pym/_emerge/EbuildBuild.py | 4 ++--
pym/_emerge/PackageUninstall.py | 4 ++--
3 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/pym/_emerge/AbstractEbuildProcess.py
b/pym/_emerge/AbstractEbuildProcess.py
index 370cac529..af6429a00 100644
--- a/pym/_emerge/AbstractEbuildProcess.py
+++ b/pym/_emerge/AbstractEbuildProcess.py
@@ -412,7 +412,11 @@ class AbstractEbuildProcess(SpawnProcess):
def _unlock_builddir_exit(self, unlock_future, returncode=None):
# Normally, async_unlock should not raise an exception here.
- unlock_future.result()
+ unlock_future.cancelled() or unlock_future.result()
if returncode is not None:
- self.returncode = returncode
+ if unlock_future.cancelled():
+ self.cancelled = True
+ self._was_cancelled()
+ else:
+ self.returncode = returncode
SpawnProcess._async_wait(self)
diff --git a/pym/_emerge/EbuildBuild.py b/pym/_emerge/EbuildBuild.py
index 8d264dd1c..ab5a4da74 100644
--- a/pym/_emerge/EbuildBuild.py
+++ b/pym/_emerge/EbuildBuild.py
@@ -354,12 +354,12 @@ class EbuildBuild(CompositeTask):
def _unlock_builddir_exit(self, unlock_task, returncode=None):
self._assert_current(unlock_task)
- if unlock_task.cancelled:
+ if unlock_task.cancelled and returncode is not None:
self._default_final_exit(unlock_task)
return
# Normally, async_unlock should not raise an exception here.
- unlock_task.future.result()
+ unlock_task.future.cancelled() or unlock_task.future.result()
if returncode is not None:
self.returncode = returncode
self._async_wait()
diff --git a/pym/_emerge/PackageUninstall.py b/pym/_emerge/PackageUninstall.py
index cb3413056..43210b4bc 100644
--- a/pym/_emerge/PackageUninstall.py
+++ b/pym/_emerge/PackageUninstall.py
@@ -116,12 +116,12 @@ class PackageUninstall(CompositeTask):
def _unlock_builddir_exit(self, unlock_task, returncode=None):
self._assert_current(unlock_task)
- if unlock_task.cancelled:
+ if unlock_task.cancelled and returncode is not None:
self._default_final_exit(unlock_task)
return
# Normally, async_unlock should not raise an exception here.
- unlock_task.future.result()
+ unlock_task.future.cancelled() or unlock_task.future.result()
if returncode is not None:
self.returncode = returncode
self._async_wait()