aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2020-03-02 08:49:33 -0800
committerZac Medico <zmedico@gentoo.org>2020-03-02 08:51:15 -0800
commit0bf72716cacc7f79abb61ad3ce33332c743809c9 (patch)
treed192626a6b3a136ba0f59b58d7daef8a1cb73cc5 /lib
parentbin/socks5-server.py: PEP 492 coroutines with async and await syntax (diff)
downloadportage-0bf72716cacc7f79abb61ad3ce33332c743809c9.tar.gz
portage-0bf72716cacc7f79abb61ad3ce33332c743809c9.tar.bz2
portage-0bf72716cacc7f79abb61ad3ce33332c743809c9.zip
doebuild: avoid emerge --pretend --fetchonly event loop recursion
Fixes: ec654122c0eb ("fetch: drop privileges early for NFS root_squash (bug 601252)") Bug: https://bugs.gentoo.org/601252 Signed-off-by: Zac Medico <zmedico@gentoo.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/portage/package/ebuild/doebuild.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/portage/package/ebuild/doebuild.py b/lib/portage/package/ebuild/doebuild.py
index 384a3e632..75fcb8a51 100644
--- a/lib/portage/package/ebuild/doebuild.py
+++ b/lib/portage/package/ebuild/doebuild.py
@@ -1095,8 +1095,16 @@ def doebuild(myebuild, mydo, _unused=DeprecationWarning, settings=None, debug=0,
digests=dist_digests)
loop = asyncio._safe_loop()
- if not loop.run_until_complete(loop.run_in_executor(ForkExecutor(loop=loop),
- _fetch_subprocess, fetchme, mysettings, listonly, dist_digests)):
+ if loop.is_running():
+ # Called by EbuildFetchonly for emerge --pretend --fetchonly.
+ success = fetch(fetchme, mysettings, listonly=listonly,
+ fetchonly=fetchonly, allow_missing_digests=False,
+ digests=dist_digests)
+ else:
+ success = loop.run_until_complete(
+ loop.run_in_executor(ForkExecutor(loop=loop),
+ _fetch_subprocess, fetchme, mysettings, listonly, dist_digests))
+ if not success:
# Since listonly mode is called by emerge --pretend in an
# asynchronous context, spawn_nofetch would trigger event loop
# recursion here, therefore delegate execution of pkg_nofetch