1 |
commit: 943bd29a388a7d113066bad660c9bfdb6fab0821 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Apr 29 20:35:37 2018 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Apr 29 20:35:37 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=943bd29a |
7 |
|
8 |
EbuildFetcher: 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/EbuildFetcher.py | 14 +++++++++----- |
18 |
1 file changed, 9 insertions(+), 5 deletions(-) |
19 |
|
20 |
diff --git a/pym/_emerge/EbuildFetcher.py b/pym/_emerge/EbuildFetcher.py |
21 |
index 466beac06..7c2cb3a58 100644 |
22 |
--- a/pym/_emerge/EbuildFetcher.py |
23 |
+++ b/pym/_emerge/EbuildFetcher.py |
24 |
@@ -1,4 +1,4 @@ |
25 |
-# Copyright 1999-2012 Gentoo Foundation |
26 |
+# Copyright 1999-2018 Gentoo Foundation |
27 |
# Distributed under the terms of the GNU General Public License v2 |
28 |
|
29 |
import copy |
30 |
@@ -166,7 +166,7 @@ class _EbuildFetcherProcess(ForkProcess): |
31 |
|
32 |
if not uri_map: |
33 |
# Nothing to fetch. |
34 |
- self._set_returncode((self.pid, os.EX_OK << 8)) |
35 |
+ self.returncode = os.EX_OK |
36 |
self._async_wait() |
37 |
return |
38 |
|
39 |
@@ -178,7 +178,7 @@ class _EbuildFetcherProcess(ForkProcess): |
40 |
if self.prefetch and \ |
41 |
self._prefetch_size_ok(uri_map, settings, ebuild_path): |
42 |
self.config_pool.deallocate(settings) |
43 |
- self._set_returncode((self.pid, os.EX_OK << 8)) |
44 |
+ self.returncode = os.EX_OK |
45 |
self._async_wait() |
46 |
return |
47 |
|
48 |
@@ -327,8 +327,12 @@ class _EbuildFetcherProcess(ForkProcess): |
49 |
if msg: |
50 |
self.scheduler.output(msg, log_path=self.logfile) |
51 |
|
52 |
- def _set_returncode(self, wait_retval): |
53 |
- ForkProcess._set_returncode(self, wait_retval) |
54 |
+ def _async_waitpid_cb(self, *args, **kwargs): |
55 |
+ """ |
56 |
+ Override _async_waitpid_cb to perform cleanup that is |
57 |
+ not necessarily idempotent. |
58 |
+ """ |
59 |
+ ForkProcess._async_waitpid_cb(self, *args, **kwargs) |
60 |
# Collect elog messages that might have been |
61 |
# created by the pkg_nofetch phase. |
62 |
# Skip elog messages for prefetch, in order to avoid duplicates. |