commit: 4917a7da16ac5450451f54d4685be1d8b403f9ad
Author: Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 9 08:04:21 2025 +0000
Commit: Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Sun Aug 17 19:00:36 2025 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=4917a7da
EAPI 9 has pipestatus
Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>
bin/eapi.sh | 1 +
bin/phase-helpers.sh | 17 +++++++++++++++++
bin/save-ebuild-env.sh | 3 ++-
3 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/bin/eapi.sh b/bin/eapi.sh
index 272d9e4a74..8e51a8ac54 100644
--- a/bin/eapi.sh
+++ b/bin/eapi.sh
@@ -42,6 +42,7 @@ ___eapi_has_hasq() [[ ${1-${EAPI-0}} == [0-7] ]]
___eapi_has_hasv() [[ ${1-${EAPI-0}} == [0-7] ]]
___eapi_has_in_iuse() [[ ${1-${EAPI-0}} != [0-5] ]]
___eapi_has_nonfatal() [[ ${1-${EAPI-0}} != [0-3] ]]
+___eapi_has_pipestatus() [[ ${1-${EAPI-0}} != [0-8] ]]
___eapi_has_useq() [[ ${1-${EAPI-0}} == [0-7] ]]
___eapi_has_usex() [[ ${1-${EAPI-0}} != [0-4] ]]
___eapi_has_version_functions() [[ ${1-${EAPI-0}} != [0-6] ]]
diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index 89f1f6f2f8..e97ebc7169 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -1162,3 +1162,20 @@ if ___eapi_has_in_iuse; then
contains_word "$1" "${IUSE_EFFECTIVE}"
}
fi
+
+if ___eapi_has_pipestatus; then
+ pipestatus() {
+ local status=( "${PIPESTATUS[@]}" )
+ local s ret=0 verbose=""
+
+ [[ ${1} == -v ]] && { verbose=1; shift; }
+ [[ $# -ne 0 ]] && die "usage: pipestatus [-v]"
+
+ for s in "${status[@]}"; do
+ [[ ${s} -ne 0 ]] && ret=${s}
+ done
+
+ [[ ${verbose} ]] && echo "${status[@]}"
+ return "${ret}"
+ }
+fi
diff --git a/bin/save-ebuild-env.sh b/bin/save-ebuild-env.sh
index 32837e8950..242b58b70f 100644
--- a/bin/save-ebuild-env.sh
+++ b/bin/save-ebuild-env.sh
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
-# Copyright 1999-2024 Gentoo Authors
+# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @FUNCTION: __save_ebuild_env
@@ -130,6 +130,7 @@ __save_ebuild_env() (
___eapi_has_in_iuse && REPLY+=( in_iuse )
___eapi_has_eapply && REPLY+=( __eapply_patch eapply patch )
___eapi_has_usex && REPLY+=( usex )
+ ___eapi_has_pipestatus && REPLY+=( pipestatus )
# Destroy the collected functions.
unset -f "${REPLY[@]}"