public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Mike Gilbert <floppym@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: Mike Gilbert <floppym@gentoo.org>
Subject: [gentoo-dev] [PATCH] meson.eclass: preserve exit status in phase funcs
Date: Tue, 16 Apr 2024 17:13:19 -0400	[thread overview]
Message-ID: <20240416211319.1498820-1-floppym@gentoo.org> (raw)

When the functions are called with nonfatal, we need to ensure 'popd'
does not clobber the exit status of the called command.

Update meson_src_configure as well just for consistency.

Closes: https://bugs.gentoo.org/930119
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
---
 eclass/meson.eclass | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/eclass/meson.eclass b/eclass/meson.eclass
index 9d7f830e58b0..a22a85887584 100644
--- a/eclass/meson.eclass
+++ b/eclass/meson.eclass
@@ -425,7 +425,10 @@ meson_src_configure() {
 		export -n {C,CPP,CXX,F,OBJC,OBJCXX,LD}FLAGS PKG_CONFIG_{LIBDIR,PATH}
 		echo meson setup "${MESONARGS[@]}" >&2
 		meson setup "${MESONARGS[@]}"
-	) || die -n
+	)
+	local rv=$?
+	[[ ${rv} -eq 0 ]] || die -n "configure failed"
+	return ${rv}
 }
 
 # @FUNCTION: meson_src_compile
@@ -451,9 +454,12 @@ meson_src_compile() {
 
 	set -- meson compile "${mesoncompileargs[@]}"
 	echo "$@" >&2
-	"$@" || die -n "compile failed"
+	"$@"
+	local rv=$?
+	[[ ${rv} -eq 0 ]] || die -n "compile failed"
 
 	popd > /dev/null || die
+	return ${rv}
 }
 
 # @FUNCTION: meson_src_test
@@ -473,9 +479,12 @@ meson_src_test() {
 
 	set -- meson test "${mesontestargs[@]}"
 	echo "$@" >&2
-	"$@" || die -n "tests failed"
+	"$@"
+	local rv=$?
+	[[ ${rv} -eq 0 ]] || die -n "tests failed"
 
 	popd > /dev/null || die
+	return ${rv}
 }
 
 # @FUNCTION: meson_install
@@ -495,9 +504,12 @@ meson_install() {
 
 	set -- meson install "${mesoninstallargs[@]}"
 	echo "$@" >&2
-	"$@" || die -n "install failed"
+	"$@"
+	local rv=$?
+	[[ ${rv} -eq 0 ]] || die -n "install failed"
 
 	popd > /dev/null || die
+	return ${rv}
 }
 
 # @FUNCTION: meson_src_install
-- 
2.44.0



                 reply	other threads:[~2024-04-16 21:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240416211319.1498820-1-floppym@gentoo.org \
    --to=floppym@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox