1 |
commit: 542c6e6c20a1d93a3a2af47c8de50eac3c891d5d |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Apr 29 20:48:23 2018 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Apr 29 21:26:37 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=542c6e6c |
7 |
|
8 |
MergeProcess: fix deprecated _set_returncode (bug 654276) |
9 |
|
10 |
Move cleanup code from _set_returncode to _async_waitpid_cb, |
11 |
since _set_returncode expects an os.waitpid return value which |
12 |
is inconveniently different from the returncode that is passed to |
13 |
asyncio.AbstractChildWatcher.add_child_handler callbacks. |
14 |
|
15 |
Bug: https://bugs.gentoo.org/654276 |
16 |
|
17 |
pym/portage/dbapi/_MergeProcess.py | 10 +++++++--- |
18 |
1 file changed, 7 insertions(+), 3 deletions(-) |
19 |
|
20 |
diff --git a/pym/portage/dbapi/_MergeProcess.py b/pym/portage/dbapi/_MergeProcess.py |
21 |
index 35591af16..bfbe387e4 100644 |
22 |
--- a/pym/portage/dbapi/_MergeProcess.py |
23 |
+++ b/pym/portage/dbapi/_MergeProcess.py |
24 |
@@ -1,4 +1,4 @@ |
25 |
-# Copyright 2010-2013 Gentoo Foundation |
26 |
+# Copyright 2010-2018 Gentoo Foundation |
27 |
# Distributed under the terms of the GNU General Public License v2 |
28 |
|
29 |
import io |
30 |
@@ -251,8 +251,12 @@ class MergeProcess(ForkProcess): |
31 |
# in order to avoid a race condition. |
32 |
os._exit(1) |
33 |
|
34 |
- def _set_returncode(self, wait_retval): |
35 |
- ForkProcess._set_returncode(self, wait_retval) |
36 |
+ def _async_waitpid_cb(self, *args, **kwargs): |
37 |
+ """ |
38 |
+ Override _async_waitpid_cb to perform cleanup that is |
39 |
+ not necessarily idempotent. |
40 |
+ """ |
41 |
+ ForkProcess._async_waitpid_cb(self, *args, **kwargs) |
42 |
if self.returncode == portage.const.RETURNCODE_POSTINST_FAILURE: |
43 |
self.postinst_failure = True |
44 |
self.returncode = os.EX_OK |