aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Trofimovich <slyfox@gentoo.org>2021-06-21 21:56:09 +0100
committerSergei Trofimovich <slyfox@gentoo.org>2021-06-21 21:56:09 +0100
commitc121a1faf88221af7246c45687578f5258c416af (patch)
tree07f9157bc3f8c73a409b9b1e0239554518d9206c /wrappers
parentcrossdev: fail eval when multilib.eclass sourcing fails (diff)
downloadcrossdev-c121a1faf88221af7246c45687578f5258c416af.tar.gz
crossdev-c121a1faf88221af7246c45687578f5258c416af.tar.bz2
crossdev-c121a1faf88221af7246c45687578f5258c416af.zip
wrappers/emerge-wrapper: fail crossdev setup when toolchain-funcs.eclass sourcing fails
Before the change toolchain-funcs.eclass import failure did not fail hard and generated suboptimal default ARCH. It's not as bad as crossdev's equivalent 'multilib.eclass' source failure, but still not perfect. The change exposes die() calls to be visible in crossdev run: ``` $ rm -rf '@GENTOO_PORTAGE_EPREFIX@/usr/foo/etc'; ./emerge-wrapper --target foo --init emerge-wrapper: ERROR: toolchain-funcs.eclass: EAPI 0 not supported emerge-wrapper: ERROR: Failed calling 'tc-arch' from toolchain-funcs.eclass. ``` Reported-by: Marco Scardovi (scardracs) Bug: https://bugs.gentoo.org/797367 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Diffstat (limited to 'wrappers')
-rwxr-xr-xwrappers/emerge-wrapper4
1 files changed, 3 insertions, 1 deletions
diff --git a/wrappers/emerge-wrapper b/wrappers/emerge-wrapper
index 381214e..d9ba08b 100755
--- a/wrappers/emerge-wrapper
+++ b/wrappers/emerge-wrapper
@@ -17,7 +17,7 @@ PREFIX="@PREFIX@"
# Enable this script to be manually installed while debugging
[[ ${PREFIX} == "@"PREFIX"@" ]] && PREFIX="/usr"
-err() { echo "emerge-wrapper: $*" 1>&2; exit 1; }
+err() { echo "emerge-wrapper: ERROR: $*" 1>&2; exit 1; }
emit_setup_warning()
{
@@ -47,9 +47,11 @@ cross_wrap_etc()
# Re-use existing CHOST->portage ARCH mapping code
ARCH=$(
inherit() { :; }
+ die() { err "toolchain-funcs.eclass$*"; }
. "${MAIN_REPO_PATH}"/eclass/toolchain-funcs.eclass
tc-arch
)
+ [[ $? -ne 0 ]] && err "Failed calling 'tc-arch' from toolchain-funcs.eclass."
[[ ${ARCH} == "unknown" ]] && emit_setup_warning "No ARCH is known for this target."
LIBC="__LIBC__"