public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH] toolchain.eclass: Drop eutils in >=EAPI-8, add some missing || die
@ 2021-04-06 22:16 Andreas Sturmlechner
  2021-04-07  6:55 ` Sergei Trofimovich
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Sturmlechner @ 2021-04-06 22:16 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 3507 bytes --]

Just some cheap fixes while flag-o-matic.eclass causes cache-regen anyway.
See also: https://github.com/gentoo/gentoo/pull/20207

- Add inherit guard.
- Fix eclassdoc a bit.

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

diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index f41ce22c591..e7fae3aad5a 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -1,14 +1,37 @@
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-# Maintainer: Toolchain Ninjas <toolchain@gentoo.org>
+# @ECLASS: toolchain.eclass
+# @MAINTAINER:
+# Toolchain Ninjas <toolchain@gentoo.org>
 # @SUPPORTED_EAPIS: 5 6 7
+# @BLURB: Functions to build sys-devel/gcc
+# @DESCRIPTION:
+# Comprehensive helper and phase functions to build sys-devel/gcc and
+# adjacent packages, support for release and live ebuilds.
+#
+# This eclass unconditionally inherits toolchain-funcs.eclass and all its public
+# variables and helper functions may be considered as part of this eclass's API.
+#
+# This eclass's phase functions are not intended to be mixed and matched, so if
+# any phase functions are overridden, the toolchain.eclass version should also
+# be called.
+
+case ${EAPI:-0} in
+	0|1|2|3|4*) die "Need to upgrade to at least EAPI=5" ;;
+	5*|6) inherit eapi7-ver eutils ;;
+	7) inherit eutils ;;
+	*) die "I don't speak EAPI ${EAPI}." ;;
+esac
+
+if [[ -z ${_TOOLCHAIN_ECLASS} ]]; then
+_TOOLCHAIN_ECLASS=1
+
+inherit flag-o-matic gnuconfig libtool multilib pax-utils toolchain-funcs prefix
 
 DESCRIPTION="The GNU Compiler Collection"
 HOMEPAGE="https://gcc.gnu.org/"
 
-inherit eutils flag-o-matic gnuconfig libtool multilib pax-utils toolchain-funcs prefix
-
 tc_is_live() {
 	[[ ${PV} == *9999* ]]
 }
@@ -27,13 +50,6 @@ fi
 
 FEATURES=${FEATURES/multilib-strict/}
 
-case ${EAPI:-0} in
-	0|1|2|3|4*) die "Need to upgrade to at least EAPI=5" ;;
-	5*|6) inherit eapi7-ver ;;
-	7) ;;
-	*) die "I don't speak EAPI ${EAPI}." ;;
-esac
-
 EXPORT_FUNCTIONS pkg_pretend pkg_setup src_unpack src_prepare src_configure \
 	src_compile src_test src_install pkg_postinst pkg_postrm
 
@@ -525,7 +541,7 @@ toolchain_src_prepare() {
 			|| eerror "Please file a bug about this"
 		eend $?
 	done
-	sed -i 's|A-Za-z0-9|[:alnum:]|g' "${S}"/gcc/*.awk #215828
+	sed -i 's|A-Za-z0-9|[:alnum:]|g' "${S}"/gcc/*.awk || die #215828
 
 	# Prevent new texinfo from breaking old versions (see #198182, #464008)
 	if tc_version_is_at_least 4.1; then
@@ -639,17 +655,16 @@ make_gcc_hard() {
 	# than ALL_CFLAGS...
 	sed -e '/^ALL_CFLAGS/iHARD_CFLAGS = ' \
 		-e 's|^ALL_CFLAGS = |ALL_CFLAGS = $(HARD_CFLAGS) |' \
-		-i "${S}"/gcc/Makefile.in
+		-i "${S}"/gcc/Makefile.in || die
 	# Need to add HARD_CFLAGS to ALL_CXXFLAGS on >= 4.7
 	if tc_version_is_at_least 4.7 ; then
 		sed -e '/^ALL_CXXFLAGS/iHARD_CFLAGS = ' \
 			-e 's|^ALL_CXXFLAGS = |ALL_CXXFLAGS = $(HARD_CFLAGS) |' \
-			-i "${S}"/gcc/Makefile.in
+			-i "${S}"/gcc/Makefile.in || die
 	fi
 
-	sed -i \
-		-e "/^HARD_CFLAGS = /s|=|= ${gcc_hard_flags} |" \
-		"${S}"/gcc/Makefile.in || die
+	sed -e "/^HARD_CFLAGS = /s|=|= ${gcc_hard_flags} |" \
+		-i "${S}"/gcc/Makefile.in || die
 
 }
 
@@ -2434,3 +2449,5 @@ toolchain_death_notice() {
 # Thus safer way to enable/disable the feature is to rely on implicit
 # enabled-by-default state:
 #    econf $(usex foo '' --disable-foo)
+
+fi
-- 
2.31.1

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 618 bytes --]

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-07  6:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-06 22:16 [gentoo-dev] [PATCH] toolchain.eclass: Drop eutils in >=EAPI-8, add some missing || die Andreas Sturmlechner
2021-04-07  6:55 ` Sergei Trofimovich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox