commit: 21b9458ec44fab14d915f64476dd8b48f7081cc5
Author: Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 27 15:10:04 2025 +0000
Commit: Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Fri Nov 28 08:18:13 2025 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=21b9458e
*.sh: Replace internal assert calls
assert() cannot be used in EAPI 9. Instead, define an internal
__pipestatus() function.
Thanks to Florian Schmaus for pointing this out.
Fixes: afaf72e840d910c17e23335c8069c5bd40faf4f7
Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>
bin/isolated-functions.sh | 9 +++++++++
bin/misc-functions.sh | 5 +++--
bin/phase-functions.sh | 6 +++---
3 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh
index 393a36ed64..7d43d71314 100644
--- a/bin/isolated-functions.sh
+++ b/bin/isolated-functions.sh
@@ -30,6 +30,15 @@ assert() {
done
}
+# Simplified version of pipestatus() for internal use
+__pipestatus() {
+ local status=( "${PIPESTATUS[@]}" ) s ret=0
+ for s in "${status[@]}"; do
+ [[ ${s} -ne 0 ]] && ret=${s}
+ done
+ return "${ret}"
+}
+
shopt -s extdebug
# __dump_trace([number of funcs on stack to skip],
diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh
index 204500e2ac..22531d98b1 100755
--- a/bin/misc-functions.sh
+++ b/bin/misc-functions.sh
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# shellcheck disable=SC2128
-# Copyright 1999-2024 Gentoo Authors
+# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
#
# Miscellaneous shell functions that make use of the ebuild env but don't need
@@ -540,7 +540,8 @@ __dyn_package() {
gtar ${tar_options} -cf - ${PORTAGE_BINPKG_TAR_OPTS} -C "${D}"
. | \
${PORTAGE_COMPRESSION_COMMAND} >
"${PORTAGE_BINPKG_TMPFILE}"
- assert "failed to pack binary package:
'${PORTAGE_BINPKG_TMPFILE}'"
+ __pipestatus \
+ || die "failed to pack binary package:
'${PORTAGE_BINPKG_TMPFILE}'"
PYTHONPATH=${PORTAGE_PYTHONPATH:-${PORTAGE_PYM_PATH}} \
"${PORTAGE_PYTHON:-/usr/bin/python}"
"${PORTAGE_BIN_PATH}"/xpak-helper.py recompose \
diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh
index 98b2784c96..cd22209595 100644
--- a/bin/phase-functions.sh
+++ b/bin/phase-functions.sh
@@ -753,7 +753,7 @@ __dyn_install() {
__save_ebuild_env --exclude-init-phases | __filter_readonly_variables \
--filter-path --filter-sandbox --allow-extra-vars > \
"${PORTAGE_BUILDDIR}"/build-info/environment
- assert "__save_ebuild_env failed"
+ __pipestatus || die "__save_ebuild_env failed"
cd "${PORTAGE_BUILDDIR}"/build-info || die
${PORTAGE_BZIP2_COMMAND} -f9 environment
@@ -1072,7 +1072,7 @@ __ebuild_main() {
__filter_readonly_variables --filter-path \
--filter-sandbox --allow-extra-vars \
| ${PORTAGE_BZIP2_COMMAND} -c -f9 >
"${PORTAGE_UPDATE_ENV}"
- assert "__save_ebuild_env failed"
+ __pipestatus || die "__save_ebuild_env failed"
fi
;;
unpack|prepare|configure|compile|test|clean|install)
@@ -1166,7 +1166,7 @@ __ebuild_main() {
cd "${PORTAGE_PYM_PATH}"
__save_ebuild_env | __filter_readonly_variables \
--filter-features > "${T}/environment"
- assert "__save_ebuild_env failed"
+ __pipestatus || die "__save_ebuild_env failed"
chgrp "${PORTAGE_GRPNAME:-portage}" "${T}/environment"
chmod g+w "${T}/environment"