From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1613975-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 44654158041
	for <garchives@archives.gentoo.org>; Sat, 23 Mar 2024 15:43:05 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id F04C6E2A3E;
	Sat, 23 Mar 2024 15:43:03 +0000 (UTC)
Received: from smtp.gentoo.org (woodpecker.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 pigeon.gentoo.org (Postfix) with ESMTPS id D3A0EE2A40
	for <gentoo-commits@lists.gentoo.org>; Sat, 23 Mar 2024 15:43:03 +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 1F98534300E
	for <gentoo-commits@lists.gentoo.org>; Sat, 23 Mar 2024 15:43:03 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 3690A15D6
	for <gentoo-commits@lists.gentoo.org>; Sat, 23 Mar 2024 15:43:00 +0000 (UTC)
From: "Sam James" <sam@gentoo.org>
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" <sam@gentoo.org>
Message-ID: <1711208454.f81ec884754b3f3d3720d40b212e12ef364821c5.sam@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
X-VCS-Repository: repo/gentoo
X-VCS-Files: eclass/toolchain.eclass
X-VCS-Directories: eclass/
X-VCS-Committer: sam
X-VCS-Committer-Name: Sam James
X-VCS-Revision: f81ec884754b3f3d3720d40b212e12ef364821c5
X-VCS-Branch: master
Date: Sat, 23 Mar 2024 15:43:00 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: f930cce2-8dfb-4869-8923-b2e08c8b3910
X-Archives-Hash: ba8df2e3dc7246c7aad9c7fca27ae937

commit:     f81ec884754b3f3d3720d40b212e12ef364821c5
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 23 08:44:55 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Mar 23 15:40:54 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f81ec884

toolchain.eclass: add various missing error handling

Prompted by Ionen.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 eclass/toolchain.eclass | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index d996d2d02770..5f350db0fe13 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -646,7 +646,7 @@ toolchain_src_prepare() {
 	# Update configure files
 	local f
 	einfo "Fixing misc issues in configure files"
-	for f in $(grep -l 'autoconf version 2.13' $(find "${S}" -name configure)) ; do
+	for f in $(grep -l 'autoconf version 2.13' $(find "${S}" -name configure || die) || die) ; do
 		ebegin "  Updating ${f/${S}\/} [LANG]"
 		patch "${f}" "${FILESDIR}"/gcc-configure-LANG.patch >& "${T}"/configure-patch.log \
 			|| eerror "Please file a bug about this"
@@ -1865,7 +1865,7 @@ gcc_do_make() {
 			emake doc-man-doxygen
 
 			# Clean bogus manpages. bug #113902
-			find -name '*_build_*' -delete
+			find -name '*_build_*' -delete || die
 
 			# Blow away generated directory references. Newer versions of gcc
 			# have gotten better at this, but not perfect. This is easier than
@@ -1982,9 +1982,9 @@ toolchain_src_install() {
 		S="${WORKDIR}"/build-jit emake DESTDIR="${D}" -j1 install
 
 		# Punt some tools which are really only useful while building gcc
-		find "${ED}" -name install-tools -prune -type d -exec rm -rf "{}" \;
+		find "${ED}" -name install-tools -prune -type d -exec rm -rf "{}" \; || die
 		# This one comes with binutils
-		find "${ED}" -name libiberty.a -delete
+		find "${ED}" -name libiberty.a -delete || die
 
 		# Move the libraries to the proper location
 		gcc_movelibs
@@ -2006,9 +2006,9 @@ toolchain_src_install() {
 	S="${WORKDIR}"/build emake DESTDIR="${D}" -j1 install
 
 	# Punt some tools which are really only useful while building gcc
-	find "${ED}" -name install-tools -prune -type d -exec rm -rf "{}" \;
+	find "${ED}" -name install-tools -prune -type d -exec rm -rf "{}" \; || die
 	# This one comes with binutils
-	find "${ED}" -name libiberty.a -delete
+	find "${ED}" -name libiberty.a -delete || die
 
 	# Move the libraries to the proper location
 	gcc_movelibs
@@ -2084,9 +2084,9 @@ toolchain_src_install() {
 		rm -rf "${ED}"/usr/share/{man,info}
 		rm -rf "${D}"${DATAPATH}/{man,info}
 	else
-		local cxx_mandir=$(find "${WORKDIR}/build/${CTARGET}/libstdc++-v3" -name man)
+		local cxx_mandir=$(find "${WORKDIR}/build/${CTARGET}/libstdc++-v3" -name man || die)
 		if [[ -d ${cxx_mandir} ]] ; then
-			cp -r "${cxx_mandir}"/man? "${D}${DATAPATH}"/man/
+			cp -r "${cxx_mandir}"/man? "${D}${DATAPATH}"/man/ || die
 		fi
 	fi
 
@@ -2100,7 +2100,7 @@ toolchain_src_install() {
 	docompress "${DATAPATH}"/{info,man}
 
 	# Prune empty dirs left behind
-	find "${ED}" -depth -type d -delete 2>/dev/null
+	find "${ED}" -depth -type d -delete 2>/dev/null || die
 
 	# libstdc++.la: Delete as it doesn't add anything useful: g++ itself
 	# handles linkage correctly in the dynamic & static case.  It also just
@@ -2137,17 +2137,17 @@ toolchain_src_install() {
 			-name libitm.la -o \
 			-name libvtv.la -o \
 			-name 'lib*san.la' \
-		')' -type f -delete
+		')' -type f -delete || die
 
 	# Use gid of 0 because some stupid ports don't have
 	# the group 'root' set to gid 0.  Send to /dev/null
 	# for people who are testing as non-root.
-	chown -R 0:0 "${D}${LIBPATH}" 2>/dev/null
+	chown -R 0:0 "${D}${LIBPATH}" 2>/dev/null || die
 
 	# Installing gdb pretty-printers into gdb-specific location.
 	local py gdbdir=/usr/share/gdb/auto-load${LIBPATH}
-	pushd "${D}${LIBPATH}" >/dev/null
-	for py in $(find . -name '*-gdb.py') ; do
+	pushd "${D}${LIBPATH}" >/dev/null || die
+	for py in $(find . -name '*-gdb.py' || die) ; do
 		local multidir=${py%/*}
 
 		insinto "${gdbdir}/${multidir}"
@@ -2157,7 +2157,7 @@ toolchain_src_install() {
 
 		rm "${py}" || die
 	done
-	popd >/dev/null
+	popd >/dev/null || die
 
 	# Don't scan .gox files for executable stacks - false positives
 	export QA_EXECSTACK="usr/lib*/go/*/*.gox"
@@ -2170,7 +2170,7 @@ toolchain_src_install() {
 	if use test ; then
 		mkdir "${T}"/test-results || die
 		cd "${WORKDIR}"/build || die
-		find . -name \*.sum -exec cp --parents -v {} "${T}"/test-results \;
+		find . -name \*.sum -exec cp --parents -v {} "${T}"/test-results \; || die
 	fi
 }
 
@@ -2217,7 +2217,7 @@ gcc_movelibs() {
 			removedirs="${removedirs} ${FROMDIR}"
 			FROMDIR=${D}${FROMDIR}
 			if [[ ${FROMDIR} != "${TODIR}" && -d ${FROMDIR} ]] ; then
-				local files=$(find "${FROMDIR}" -maxdepth 1 ! -type d 2>/dev/null)
+				local files=$(find "${FROMDIR}" -maxdepth 1 ! -type d 2>/dev/null || die)
 				if [[ -n ${files} ]] ; then
 					mv ${files} "${TODIR}" || die
 				fi
@@ -2234,7 +2234,7 @@ gcc_movelibs() {
 		rmdir "${D}"${FROMDIR} >& /dev/null
 	done
 
-	find -depth "${ED}" -type d -exec rmdir {} + >& /dev/null
+	find -depth "${ED}" -type d -exec rmdir {} + >& /dev/null || die
 }
 
 # Make sure the libtool archives have libdir set to where they actually