From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 38F0E138334 for ; Mon, 4 Jun 2018 23:47:01 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B4FD2E0ACC; Mon, 4 Jun 2018 23:46:59 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 5B208E0ACC for ; Mon, 4 Jun 2018 23:46:59 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 33F13335C81 for ; Mon, 4 Jun 2018 23:46:58 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id DACAC2C1 for ; Mon, 4 Jun 2018 23:46:56 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1528155855.345256c2d439c5ab580e4226f227db2819883d40.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, pym/_emerge/ X-VCS-Repository: proj/portage X-VCS-Files: pym/_emerge/EbuildBuild.py pym/_emerge/EbuildFetchonly.py pym/portage/package/ebuild/doebuild.py X-VCS-Directories: pym/_emerge/ pym/portage/package/ebuild/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 345256c2d439c5ab580e4226f227db2819883d40 X-VCS-Branch: master Date: Mon, 4 Jun 2018 23:46:56 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 7355e4bd-f08b-423e-8965-a3d25661f39c X-Archives-Hash: baa56157fcd2200e6e2cd55381636c32 commit: 345256c2d439c5ab580e4226f227db2819883d40 Author: Zac Medico gentoo org> AuthorDate: Mon Jun 4 23:32:46 2018 +0000 Commit: Zac Medico gentoo org> CommitDate: Mon Jun 4 23:44:15 2018 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=345256c2 emerge -pf: spawn pkg_nofetch asynchronously (bug 657360) For pretend mode, fix doebuild to skip the spawn_nofetch call that would trigger event loop recursion, and spawn pkg_nofetch asynchronously. Bug: https://bugs.gentoo.org/657360 pym/_emerge/EbuildBuild.py | 16 ++++++++++++++-- pym/_emerge/EbuildFetchonly.py | 5 ++++- pym/portage/package/ebuild/doebuild.py | 15 +++++++-------- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/pym/_emerge/EbuildBuild.py b/pym/_emerge/EbuildBuild.py index 00d4680f5..d9f7f6da7 100644 --- a/pym/_emerge/EbuildBuild.py +++ b/pym/_emerge/EbuildBuild.py @@ -142,8 +142,20 @@ class EbuildBuild(CompositeTask): pkg=pkg, pretend=opts.pretend, settings=settings) retval = fetcher.execute() - self.returncode = retval - self.wait() + if retval == os.EX_OK: + self._current_task = None + self.returncode = os.EX_OK + self._async_wait() + else: + # For pretend mode, the convention it to execute + # pkg_nofetch and return a successful exitcode. + self._start_task(SpawnNofetchWithoutBuilddir( + background=self.background, + portdb=self.pkg.root_config.trees[self._tree].dbapi, + ebuild_path=self._ebuild_path, + scheduler=self.scheduler, + settings=self.settings), + self._default_final_exit) return else: fetcher = EbuildFetcher( diff --git a/pym/_emerge/EbuildFetchonly.py b/pym/_emerge/EbuildFetchonly.py index f88ea96ef..eec2ad208 100644 --- a/pym/_emerge/EbuildFetchonly.py +++ b/pym/_emerge/EbuildFetchonly.py @@ -25,7 +25,10 @@ class EbuildFetchonly(SlotObject): listonly=self.pretend, fetchonly=1, fetchall=self.fetch_all, mydbapi=portdb, tree="porttree") - if rval != os.EX_OK: + # For pretend mode, this error message is suppressed, + # and the unsuccessful return value is used to trigger + # a call to the pkg_nofetch phase. + if rval != os.EX_OK and not self.pretend: msg = "Fetch failed for '%s'" % (pkg.cpv,) eerror(msg, phase="unpack", key=pkg.cpv) diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py index dc443df00..0e94de805 100644 --- a/pym/portage/package/ebuild/doebuild.py +++ b/pym/portage/package/ebuild/doebuild.py @@ -1079,14 +1079,13 @@ def doebuild(myebuild, mydo, _unused=DeprecationWarning, settings=None, debug=0, if not fetch(fetchme, mysettings, listonly=listonly, fetchonly=fetchonly, allow_missing_digests=False, digests=dist_digests): - spawn_nofetch(mydbapi, myebuild, settings=mysettings, - fd_pipes=fd_pipes) - if listonly: - # The convention for listonly mode is to report - # success in any case, even though fetch() may - # return unsuccessfully in order to trigger the - # nofetch phase. - return 0 + # 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 + # to the caller (bug 657360). + if not listonly: + spawn_nofetch(mydbapi, myebuild, settings=mysettings, + fd_pipes=fd_pipes) return 1 if need_distfiles: