commit:     c14ac733a4e05990973d99e13f19aaf9bde57bcb
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 22 20:16:42 2020 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Jul 22 20:20:11 2020 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=c14ac733

_EbuildFetcherProcess: emit eerror for fetch failure in  _proc_join_done

Since ForkProcess now receives process exit status in the
_proc_join_done method instead of the _async_waitpid_cb method,
_EbuildFetcherProcess needs to emit eerror messages there
instead.

Fixes: bde44b75407d ("ForkProcess: replace os.fork with multiprocessing.Process 
(bug 730192)")
Bug: https://bugs.gentoo.org/730192
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>

 lib/_emerge/EbuildFetcher.py | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/lib/_emerge/EbuildFetcher.py b/lib/_emerge/EbuildFetcher.py
index 55349c33c..107a6d590 100644
--- a/lib/_emerge/EbuildFetcher.py
+++ b/lib/_emerge/EbuildFetcher.py
@@ -364,16 +364,11 @@ class _EbuildFetcherProcess(ForkProcess):
                if msg:
                        self.scheduler.output(msg, log_path=self.logfile)
 
-       def _async_waitpid_cb(self, *args, **kwargs):
+       def _proc_join_done(self, proc, future):
                """
-               Override _async_waitpid_cb to perform cleanup that is
-               not necessarily idempotent.
+               Extend _proc_join_done to emit an eerror message for fetch 
failure.
                """
-               ForkProcess._async_waitpid_cb(self, *args, **kwargs)
-               # Collect elog messages that might have been
-               # created by the pkg_nofetch phase.
-               # Skip elog messages for prefetch, in order to avoid duplicates.
-               if not self.prefetch and self.returncode != os.EX_OK:
+               if not self.prefetch and not future.cancelled() and 
proc.exitcode != os.EX_OK:
                        msg_lines = []
                        msg = "Fetch failed for '%s'" % (self.pkg.cpv,)
                        if self.logfile is not None:
@@ -382,3 +377,4 @@ class _EbuildFetcherProcess(ForkProcess):
                        if self.logfile is not None:
                                msg_lines.append(" '%s'" % (self.logfile,))
                        self._eerror(msg_lines)
+               super(_EbuildFetcherProcess, self)._proc_join_done(proc, future)

Reply via email to