1 |
commit: 08f03935b92e8fcacf95c583e389f349f5db67b8 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Apr 29 19:09:00 2018 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Apr 29 20:27:32 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=08f03935 |
7 |
|
8 |
AbstractEbuildProcess: 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/_emerge/AbstractEbuildProcess.py | 10 +++++++--- |
18 |
1 file changed, 7 insertions(+), 3 deletions(-) |
19 |
|
20 |
diff --git a/pym/_emerge/AbstractEbuildProcess.py b/pym/_emerge/AbstractEbuildProcess.py |
21 |
index 03c834912..2ed175750 100644 |
22 |
--- a/pym/_emerge/AbstractEbuildProcess.py |
23 |
+++ b/pym/_emerge/AbstractEbuildProcess.py |
24 |
@@ -64,7 +64,7 @@ class AbstractEbuildProcess(SpawnProcess): |
25 |
"since PORTAGE_BUILDDIR does not exist: '%s'") % \ |
26 |
(self.phase, self.settings['PORTAGE_BUILDDIR']) |
27 |
self._eerror(textwrap.wrap(msg, 72)) |
28 |
- self._set_returncode((self.pid, 1 << 8)) |
29 |
+ self.returncode = 1 |
30 |
self._async_wait() |
31 |
return |
32 |
|
33 |
@@ -355,8 +355,12 @@ class AbstractEbuildProcess(SpawnProcess): |
34 |
["%s received strange poll event: %s\n" % \ |
35 |
(self.__class__.__name__, event,)]) |
36 |
|
37 |
- def _set_returncode(self, wait_retval): |
38 |
- SpawnProcess._set_returncode(self, wait_retval) |
39 |
+ def _async_waitpid_cb(self, *args, **kwargs): |
40 |
+ """ |
41 |
+ Override _async_waitpid_cb to perform cleanup that is |
42 |
+ not necessarily idempotent. |
43 |
+ """ |
44 |
+ SpawnProcess._async_waitpid_cb(self, *args, **kwargs) |
45 |
|
46 |
if self._exit_timeout_id is not None: |
47 |
self.scheduler.source_remove(self._exit_timeout_id) |