public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Sergei Trofimovich <slyfox@gentoo.org>
To: Andreas Sturmlechner <asturm@gentoo.org>
Cc: gentoo-dev@lists.gentoo.org
Subject: Re: [gentoo-dev] [PATCH] toolchain.eclass: Drop eutils in >=EAPI-8, add some missing || die
Date: Wed, 7 Apr 2021 07:55:22 +0100	[thread overview]
Message-ID: <20210407075522.46b77e53@sf> (raw)
In-Reply-To: <3261942.LZWGnKmheA@tuxbrain>

On Wed, 07 Apr 2021 00:16:46 +0200
Andreas Sturmlechner <asturm@gentoo.org> wrote:

> Just some cheap fixes while flag-o-matic.eclass causes cache-regen anyway.

This eclass is used by 4 packages. Cache hit is not an issue.

> 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.

It's worth to explicitly list all packages supported by the eclass.
Which is:
  dev-lang/gnat-gpl
  sys-devel/kgcc64
  sys-devel/gcc
  sys-devel/gcc-apple
and their cross-*/ variants.

> +# 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.

It inherits many other eclasses. None of them should be considered
toolchain.eclass's API. I don't think any ebuilds rely on it. If they do it's a bug.

> +# 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

Why these inherits go before the guard?

> +if [[ -z ${_TOOLCHAIN_ECLASS} ]]; then
> +_TOOLCHAIN_ECLASS=1

Why does this eclass need a guard?  'toolchain.eclass' is not something
you include lightly.

> +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

All '|| die' should be a separate commit. Feel free to push that now.

>  	# 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

This should be a separate commit. Feel free to push that now.

>  }
>  
> @@ -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


-- 

  Sergei


      reply	other threads:[~2021-04-07  6:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210407075522.46b77e53@sf \
    --to=slyfox@gentoo.org \
    --cc=asturm@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox