1 |
commit: 9b013dc77de62604d151f82831ca3cd494788d5f |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Apr 29 20:42:31 2018 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Apr 29 20:44:27 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=9b013dc7 |
7 |
|
8 |
EbuildMetadataPhase: 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/EbuildMetadataPhase.py | 17 ++++++++++------- |
18 |
1 file changed, 10 insertions(+), 7 deletions(-) |
19 |
|
20 |
diff --git a/pym/_emerge/EbuildMetadataPhase.py b/pym/_emerge/EbuildMetadataPhase.py |
21 |
index d146424c3..7a5310b83 100644 |
22 |
--- a/pym/_emerge/EbuildMetadataPhase.py |
23 |
+++ b/pym/_emerge/EbuildMetadataPhase.py |
24 |
@@ -1,4 +1,4 @@ |
25 |
-# Copyright 1999-2013 Gentoo Foundation |
26 |
+# Copyright 1999-2018 Gentoo Foundation |
27 |
# Distributed under the terms of the GNU General Public License v2 |
28 |
|
29 |
from _emerge.SubProcess import SubProcess |
30 |
@@ -49,14 +49,14 @@ class EbuildMetadataPhase(SubProcess): |
31 |
if not parsed_eapi: |
32 |
# An empty EAPI setting is invalid. |
33 |
self._eapi_invalid(None) |
34 |
- self._set_returncode((self.pid, 1 << 8)) |
35 |
+ self.returncode = 1 |
36 |
self._async_wait() |
37 |
return |
38 |
|
39 |
self.eapi_supported = portage.eapi_is_supported(parsed_eapi) |
40 |
if not self.eapi_supported: |
41 |
self.metadata = {"EAPI": parsed_eapi} |
42 |
- self._set_returncode((self.pid, os.EX_OK << 8)) |
43 |
+ self.returncode = os.EX_OK |
44 |
self._async_wait() |
45 |
return |
46 |
|
47 |
@@ -124,8 +124,7 @@ class EbuildMetadataPhase(SubProcess): |
48 |
|
49 |
if isinstance(retval, int): |
50 |
# doebuild failed before spawning |
51 |
- self._unregister() |
52 |
- self._set_returncode((self.pid, retval << 8)) |
53 |
+ self.returncode = retval |
54 |
self._async_wait() |
55 |
return |
56 |
|
57 |
@@ -155,8 +154,12 @@ class EbuildMetadataPhase(SubProcess): |
58 |
|
59 |
return True |
60 |
|
61 |
- def _set_returncode(self, wait_retval): |
62 |
- SubProcess._set_returncode(self, wait_retval) |
63 |
+ def _async_waitpid_cb(self, *args, **kwargs): |
64 |
+ """ |
65 |
+ Override _async_waitpid_cb to perform cleanup that is |
66 |
+ not necessarily idempotent. |
67 |
+ """ |
68 |
+ SubProcess._async_waitpid_cb(self, *args, **kwargs) |
69 |
# self._raw_metadata is None when _start returns |
70 |
# early due to an unsupported EAPI |
71 |
if self.returncode == os.EX_OK and \ |