From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 895AA1580E0 for ; Sun, 01 Jun 2025 21:47:52 +0000 (UTC) Received: from lists.gentoo.org (bobolink.gentoo.org [140.211.166.189]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) (Authenticated sender: relay-lists.gentoo.org@gentoo.org) by smtp.gentoo.org (Postfix) with ESMTPSA id 73F253430B2 for ; Sun, 01 Jun 2025 21:47:52 +0000 (UTC) Received: from bobolink.gentoo.org (localhost [127.0.0.1]) by bobolink.gentoo.org (Postfix) with ESMTP id BB81011047D; Sun, 01 Jun 2025 21:47:43 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bobolink.gentoo.org (Postfix) with ESMTPS id B1EA211047D for ; Sun, 01 Jun 2025 21:47:43 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 6984B3430A6 for ; Sun, 01 Jun 2025 21:47:43 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 0F65E20FB for ; Sun, 01 Jun 2025 21:47:42 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1748814119.0da2f7f852bc0168e9f857f93b93cf1df8567d4e.sam@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: bin/ X-VCS-Repository: proj/portage X-VCS-Files: bin/phase-helpers.sh X-VCS-Directories: bin/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 0da2f7f852bc0168e9f857f93b93cf1df8567d4e X-VCS-Branch: master Date: Sun, 01 Jun 2025 21:47:42 +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-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: bd4632f1-ac8f-4a87-b275-a1c6d347e0a5 X-Archives-Hash: 0e091c66e0977cbdfa832d80ffa0ae10 commit: 0da2f7f852bc0168e9f857f93b93cf1df8567d4e Author: Kerin Millar plushkava net> AuthorDate: Fri May 30 05:52:05 2025 +0000 Commit: Sam James gentoo org> CommitDate: Sun Jun 1 21:41:59 2025 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=0da2f7f8 phase-helpers.sh: render the exit status of _eapply_patch() meaningful It isn't necessary to know the exact exit status value of the patch(1) utility. PMS only requires for eapply() to return a non-zero status in the case that something goes wrong and nonfatal is in effect. Even if that were not the case, having _eapply_patch() be implemented as an impure function that sets a variable in an upper scope just to convey an exit status value is a rather odd way of going about things. Simplify all of this by ensuring that _eapply_patch() returns non-zero in the nonfatal case. Note that it takes advantange of the preceding commit to do so; it is now guaranteed that __helpers_die() returns something other than 0, where nonfatal is in effect. Consequently, eapply() can now respond directly to the return value, rather than proceed to consult the 'failed' variable, which has been eliminated. Signed-off-by: Kerin Millar plushkava.net> Signed-off-by: Sam James gentoo.org> bin/phase-helpers.sh | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh index bef0abbcc9..ddc446d738 100644 --- a/bin/phase-helpers.sh +++ b/bin/phase-helpers.sh @@ -978,7 +978,7 @@ fi if ___eapi_has_eapply; then eapply() { - local f failed patch_cmd path + local f patch_cmd path local -a files operands options _eapply_get_files() { @@ -1010,8 +1010,7 @@ if ___eapi_has_eapply; then fi "${patch_cmd}" "${patch_opts[@]}" < "${patch}" - failed=${?} - if ! eend "${failed}"; then + if ! eend "$?"; then __helpers_die "patch -p1 $* failed with ${patch}" fi } @@ -1055,20 +1054,12 @@ if ___eapi_has_eapply; then einfo "Applying patches from ${path} ..." for f in "${files[@]}"; do - _eapply_patch "${f}" ' ' "${options[@]}" - - # in case of nonfatal - [[ ${failed} -ne 0 ]] && return "${failed}" + _eapply_patch "${f}" ' ' "${options[@]}" || return done else - _eapply_patch "${path}" '' "${options[@]}" - - # In case of nonfatal - [[ ${failed} -ne 0 ]] && return "${failed}" + _eapply_patch "${path}" '' "${options[@]}" || return fi done - - return 0 } fi