Gentoo Archives: gentoo-dev

From: Sergei Trofimovich <slyfox@g.o>
To: Andreas Sturmlechner <asturm@g.o>
Cc: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [PATCH] toolchain.eclass: Drop eutils in >=EAPI-8, add some missing || die
Date: Wed, 07 Apr 2021 06:55:46
Message-Id: 20210407075522.46b77e53@sf
In Reply to: [gentoo-dev] [PATCH] toolchain.eclass: Drop eutils in >=EAPI-8, add some missing || die by Andreas Sturmlechner
1 On Wed, 07 Apr 2021 00:16:46 +0200
2 Andreas Sturmlechner <asturm@g.o> wrote:
3
4 > Just some cheap fixes while flag-o-matic.eclass causes cache-regen anyway.
5
6 This eclass is used by 4 packages. Cache hit is not an issue.
7
8 > See also: https://github.com/gentoo/gentoo/pull/20207
9 >
10 > - Add inherit guard.
11 > - Fix eclassdoc a bit.
12 >
13 > ---
14 > eclass/toolchain.eclass | 51 +++++++++++++++++++++++++++--------------
15 > 1 file changed, 34 insertions(+), 17 deletions(-)
16 >
17 > diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
18 > index f41ce22c591..e7fae3aad5a 100644
19 > --- a/eclass/toolchain.eclass
20 > +++ b/eclass/toolchain.eclass
21 > @@ -1,14 +1,37 @@
22 > -# Copyright 1999-2020 Gentoo Authors
23 > +# Copyright 1999-2021 Gentoo Authors
24 > # Distributed under the terms of the GNU General Public License v2
25 >
26 > -# Maintainer: Toolchain Ninjas <toolchain@g.o>
27 > +# @ECLASS: toolchain.eclass
28 > +# @MAINTAINER:
29 > +# Toolchain Ninjas <toolchain@g.o>
30 > # @SUPPORTED_EAPIS: 5 6 7
31 > +# @BLURB: Functions to build sys-devel/gcc
32 > +# @DESCRIPTION:
33 > +# Comprehensive helper and phase functions to build sys-devel/gcc and
34 > +# adjacent packages, support for release and live ebuilds.
35
36 It's worth to explicitly list all packages supported by the eclass.
37 Which is:
38 dev-lang/gnat-gpl
39 sys-devel/kgcc64
40 sys-devel/gcc
41 sys-devel/gcc-apple
42 and their cross-*/ variants.
43
44 > +# This eclass unconditionally inherits toolchain-funcs.eclass and all its public
45 > +# variables and helper functions may be considered as part of this eclass's API.
46
47 It inherits many other eclasses. None of them should be considered
48 toolchain.eclass's API. I don't think any ebuilds rely on it. If they do it's a bug.
49
50 > +# This eclass's phase functions are not intended to be mixed and matched, so if
51 > +# any phase functions are overridden, the toolchain.eclass version should also
52 > +# be called.
53 > +
54 > +case ${EAPI:-0} in
55 > + 0|1|2|3|4*) die "Need to upgrade to at least EAPI=5" ;;
56 > + 5*|6) inherit eapi7-ver eutils ;;
57 > + 7) inherit eutils ;;
58 > + *) die "I don't speak EAPI ${EAPI}." ;;
59 > +esac
60
61 Why these inherits go before the guard?
62
63 > +if [[ -z ${_TOOLCHAIN_ECLASS} ]]; then
64 > +_TOOLCHAIN_ECLASS=1
65
66 Why does this eclass need a guard? 'toolchain.eclass' is not something
67 you include lightly.
68
69 > +inherit flag-o-matic gnuconfig libtool multilib pax-utils toolchain-funcs prefix
70 >
71 > DESCRIPTION="The GNU Compiler Collection"
72 > HOMEPAGE="https://gcc.gnu.org/"
73 >
74 > -inherit eutils flag-o-matic gnuconfig libtool multilib pax-utils toolchain-funcs prefix
75 > -
76 > tc_is_live() {
77 > [[ ${PV} == *9999* ]]
78 > }
79 > @@ -27,13 +50,6 @@ fi
80 >
81 > FEATURES=${FEATURES/multilib-strict/}
82 >
83 > -case ${EAPI:-0} in
84 > - 0|1|2|3|4*) die "Need to upgrade to at least EAPI=5" ;;
85 > - 5*|6) inherit eapi7-ver ;;
86 > - 7) ;;
87 > - *) die "I don't speak EAPI ${EAPI}." ;;
88 > -esac
89 > -
90 > EXPORT_FUNCTIONS pkg_pretend pkg_setup src_unpack src_prepare src_configure \
91 > src_compile src_test src_install pkg_postinst pkg_postrm
92 >
93 > @@ -525,7 +541,7 @@ toolchain_src_prepare() {
94 > || eerror "Please file a bug about this"
95 > eend $?
96 > done
97 > - sed -i 's|A-Za-z0-9|[:alnum:]|g' "${S}"/gcc/*.awk #215828
98 > + sed -i 's|A-Za-z0-9|[:alnum:]|g' "${S}"/gcc/*.awk || die #215828
99
100 All '|| die' should be a separate commit. Feel free to push that now.
101
102 > # Prevent new texinfo from breaking old versions (see #198182, #464008)
103 > if tc_version_is_at_least 4.1; then
104 > @@ -639,17 +655,16 @@ make_gcc_hard() {
105 > # than ALL_CFLAGS...
106 > sed -e '/^ALL_CFLAGS/iHARD_CFLAGS = ' \
107 > -e 's|^ALL_CFLAGS = |ALL_CFLAGS = $(HARD_CFLAGS) |' \
108 > - -i "${S}"/gcc/Makefile.in
109 > + -i "${S}"/gcc/Makefile.in || die
110 > # Need to add HARD_CFLAGS to ALL_CXXFLAGS on >= 4.7
111 > if tc_version_is_at_least 4.7 ; then
112 > sed -e '/^ALL_CXXFLAGS/iHARD_CFLAGS = ' \
113 > -e 's|^ALL_CXXFLAGS = |ALL_CXXFLAGS = $(HARD_CFLAGS) |' \
114 > - -i "${S}"/gcc/Makefile.in
115 > + -i "${S}"/gcc/Makefile.in || die
116 > fi
117
118 > - sed -i \
119 > - -e "/^HARD_CFLAGS = /s|=|= ${gcc_hard_flags} |" \
120 > - "${S}"/gcc/Makefile.in || die
121 > + sed -e "/^HARD_CFLAGS = /s|=|= ${gcc_hard_flags} |" \
122 > + -i "${S}"/gcc/Makefile.in || die
123
124 This should be a separate commit. Feel free to push that now.
125
126 > }
127 >
128 > @@ -2434,3 +2449,5 @@ toolchain_death_notice() {
129 > # Thus safer way to enable/disable the feature is to rely on implicit
130 > # enabled-by-default state:
131 > # econf $(usex foo '' --disable-foo)
132 > +
133 > +fi
134 > --
135 > 2.31.1
136
137
138 --
139
140 Sergei