I messed with toolchain.eclass today and broke gnat-gpl a few times. I had to plug back a few workarounds: - allow GCC_CONFIG_VER not to match GCC_RELEASE_VER: https://gitweb.gentoo.org/repo/gentoo.git/commit/eclass/toolchain.eclass?id=7a39a55b4db6682b7f99a7f9991eed3ca5bf7c5e - allow GCC_CONFIG_VER not to match gcc/BASE-VER: https://gitweb.gentoo.org/repo/gentoo.git/commit/eclass/toolchain.eclass?id=3dd25eef1c1ab86a142864cbce3bd46f2db006ce I'd like to migrate dev-lang/gnat-gpl ebuilds off GCC_CONFIG_VER variable and drop these workarounds. Here is an example of gnat-gpl-2019-r1.ebuild: PATCH_VER="3" TOOLCHAIN_GCC_PV=8.3.0 GCC_CONFIG_VER=8.3.1 inherit toolchain-funcs toolchain RDEPEND="!sys-devel/gcc:${GCC_CONFIG_VER}" ... pkg_postinst () { einfo "This provide the GNAT compiler with gcc for ada/c/c++ and more" einfo "The compiler binary is ${CTARGET}-gcc-${GCC_CONFIG_VER}" This 8.3.0/8.3.1 mismatch is very hard to reason about. I guess you only need 8.3.0 patches and pretend the build deals with 8.3.1 package, right? With small amount of toolchain.eclass tweaking I suggest to change ebuild to: PATCH_GCC_VER=8.3.0 PATCH_VER="3" TOOLCHAIN_GCC_PV=8.3.1 inherit toolchain-funcs toolchain RDEPEND="!sys-devel/gcc:${TOOLCHAIN_GCC_PV}" ... pkg_postinst () { einfo "This provide the GNAT compiler with gcc for ada/c/c++ and more" einfo "The compiler binary is ${CTARGET}-gcc-${TOOLCHAIN_GCC_PV}" WDYT?
Example change of toolchain.eclass: --- a/eclass/toolchain.eclass +++ b/eclass/toolchain.eclass @@ -286,6 +286,10 @@ gentoo_urls() { # Other than the variables normally set by portage, this function's behavior # can be altered by setting the following: # +# GCC_TARBALL +# Override link to main tarball into SRC_URI. Used by dev-lang/gnt-gpl +# to provide gcc tarball snapshots. Patches are usually reused as-is. +# # SNAPSHOT # If set, this variable signals that we should be using a snapshot of # gcc. It is expected to be in the format "YYYY-MM-DD". Note that if @@ -347,6 +351,8 @@ get_gcc_src_uri() { # live git tree, snapshot, or release tarball. if tc_is_live ; then : # Nothing to do w/git snapshots. + elif [[ -n ${GCC_TARBALL} ]] ; then + GCC_SRC_URI="${GCC_TARBALL}" elif [[ -n ${SNAPSHOT} ]] ; then GCC_SRC_URI="ftp://gcc.gnu.org/pub/gcc/snapshots/${SNAPSHOT}/gcc-${SNAPSHOT}.tar.xz" else Example change of gnat-gpl-2019-r1.ebuild: --- a/dev-lang/gnat-gpl/gnat-gpl-2019-r1.ebuild +++ b/dev-lang/gnat-gpl/gnat-gpl-2019-r1.ebuild @@ -3,10 +3,12 @@ EAPI="6" +PATCH_GCC_VER=8.3.0 PATCH_VER="3" -TOOLCHAIN_GCC_PV=8.3.0 -GCC_CONFIG_VER=8.3.1 +TOOLCHAIN_GCC_PV=8.3.1 +# we provide own tarball below +GCC_TARBALL=" " inherit toolchain-funcs toolchain @@ -42,7 +44,7 @@ KEYWORDS="amd64 x86" IUSE="+bootstrap" RESTRICT="!test? ( test )" -RDEPEND="!sys-devel/gcc:${GCC_CONFIG_VER}" +RDEPEND="!sys-devel/gcc:${TOOLCHAIN_GCC_PV}" DEPEND="${RDEPEND} elibc_glibc? ( >=sys-libs/glibc-2.13 ) >=sys-devel/binutils-2.20" @@ -152,7 +154,7 @@ src_compile() { pkg_postinst () { einfo "This provide the GNAT compiler with gcc for ada/c/c++ and more" - einfo "The compiler binary is ${CTARGET}-gcc-${GCC_CONFIG_VER}" + einfo "The compiler binary is ${CTARGET}-gcc-${TOOLCHAIN_GCC_PV}" einfo "Even if the c/c++ compilers are using almost the same patched" einfo "source as the sys-devel/gcc package its use is not extensively" einfo "tested, and not supported for updating your system, except for ada"
It is good. I only do not know what GCC_TARBALL is for. I thought it was for the URL of my gcc but renaming is not working, so I put " " on that, just to avoid downloading a gcc tar ball that does not exist.
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=940dd501903b08b8dfb5a186207b04e49d2b0bd2 commit 940dd501903b08b8dfb5a186207b04e49d2b0bd2 Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2020-02-01 11:09:02 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2020-02-01 11:28:24 +0000 toolchain.eclass: provide a way to override gcc tarball path To ease gnal-gpl packaging allow external user to override SRC_URI for main gcc tarball. gnal-gpl uses gcc small fork, but otherwise looks like a gcc tarball. Bug: https://bugs.gentoo.org/706588 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> eclass/toolchain.eclass | 7 +++++++ 1 file changed, 7 insertions(+)
(In reply to Tupone Alfredo from comment #2) > It is good. I only do not know what GCC_TARBALL is for. > I thought it was for the URL of my gcc but renaming is not working, so I put > " " on that, just to avoid downloading a gcc tar ball that does not exist. I've renamed it slightly to GCC_TARBALL_SRC_URI. It should be usable as a custom tarball as-is: GCC_TARBALL_SRC_URI="patho/to/patched-gcc I'll clean up toolchain_src_unpack() first and post proposed change to gnat-gpl for you to review that uses GCC_TARBALL_SRC_URI with non-empty value.
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1488b03bb6af0289f69ef4244ef79ed3225a10db commit 1488b03bb6af0289f69ef4244ef79ed3225a10db Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2020-02-01 12:31:21 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2020-02-01 12:35:46 +0000 toolchain.eclass: make toolchain_src_unpack() a default_src_unpack() Before tha change toolchain_src_unpack() did not unpack every SRC_URI entry and instead relied on toolchain_src_unpack() to unpack only needed tarballs. Any special handling was only needed for old USE=d versions of gcc. This change moves all source code mangling to src_prepare() and makes toolchain_src_unpack() a default_src_unpack(). The only exception is ebuild users of 'GCC_A_FAKEIT' (dev-lang/gnat-gpl) who have to use it to workaround non-standard behaviour of toolchain_src_unpack() The change will allow dev-lang/gnat-gpl to migrate to default_src_unpack(). Bug: https://bugs.gentoo.org/706588 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> eclass/toolchain.eclass | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-)
Here is what I've got (about to attack patches against all gnat-gpl ebuilds): --- a/dev-lang/gnat-gpl/gnat-gpl-2019-r1.ebuild +++ b/dev-lang/gnat-gpl/gnat-gpl-2019-r1.ebuild @@ -5,0 +6 @@ EAPI="6" +PATCH_GCC_VER=8.3.0 @@ -8,4 +9 @@ PATCH_VER="3" -TOOLCHAIN_GCC_PV=8.3.0 -GCC_CONFIG_VER=8.3.1 - -inherit toolchain-funcs toolchain +TOOLCHAIN_GCC_PV=8.3.1 @@ -20,3 +18,2 @@ BTSTRP_AMD64=gnat-gpl-2014-x86_64-linux-bin -DESCRIPTION="GNAT Ada Compiler - GPL version" -HOMEPAGE="http://libre.adacore.com/" -SRC_URI+=" +# we provide own tarball below +GCC_TARBALL_SRC_URI=" @@ -39,0 +37,5 @@ SRC_URI+=" +inherit toolchain-funcs toolchain + +DESCRIPTION="GNAT Ada Compiler - GPL version" +HOMEPAGE="http://libre.adacore.com/" + @@ -45 +47 @@ RESTRICT="!test? ( test )" -RDEPEND="!sys-devel/gcc:${GCC_CONFIG_VER}" +RDEPEND="!sys-devel/gcc:${TOOLCHAIN_GCC_PV}" @@ -85,8 +86,0 @@ src_unpack() { - GCC_A_FAKEIT=" - ${MYP}.tar.gz - ${GNATDIR}.tar.gz - ${INTFDIR}.tar.gz" - if use bootstrap; then - GCC_A_FAKEIT="${GCC_A_FAKEIT} ${BTSTRP}.tar.gz" - fi - @@ -123,2 +117,2 @@ src_prepare() { - rm patch/27*.patch || die - rm patch/28*.patch || die + rm patch/27*.patch || die # already applied + rm patch/28*.patch || die # already applied @@ -135,4 +129,3 @@ src_configure() { - local trueGCC_BRANCH_VER=${GCC_BRANCH_VER} - GCC_BRANCH_VER=$(gcc-version) - downgrade_arch_flags - GCC_BRANCH_VER=${trueGCC_BRANCH_VER} + + downgrade_arch_flags "$(gcc-version)" + @@ -155 +148 @@ pkg_postinst () { - einfo "The compiler binary is ${CTARGET}-gcc-${GCC_CONFIG_VER}" + einfo "The compiler binary is ${CTARGET}-gcc-${TOOLCHAIN_GCC_PV}"
Created attachment 610604 [details, diff] 0001-dev-lang-gnat-gpl-migrate-2019-r1-from-GCC_CONFIG_VE.patch
Created attachment 610606 [details, diff] 0002-dev-lang-gnat-gpl-migrate-2018-r3-from-GCC_CONFIG_VE.patch
Created attachment 610608 [details, diff] 0003-dev-lang-gnat-gpl-migrate-2017-r1-from-GCC_CONFIG_VE.patch
Created attachment 610610 [details, diff] 0004-dev-lang-gnat-gpl-migrate-2016-r4-from-GCC_A_FAKEIT-.patch
The following patches should simplify both toolchain.eclass and gnat-gpl ebuilds: - 0001-dev-lang-gnat-gpl-migrate-2019-r1-from-GCC_CONFIG_VE.patch - 0002-dev-lang-gnat-gpl-migrate-2018-r3-from-GCC_CONFIG_VE.patch - 0003-dev-lang-gnat-gpl-migrate-2017-r1-from-GCC_CONFIG_VE.patch - 0004-dev-lang-gnat-gpl-migrate-2016-r4-from-GCC_A_FAKEIT-.patch Please review.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e23bc40bf699767408d9e8356573f73ff959194d commit e23bc40bf699767408d9e8356573f73ff959194d Author: Tupone Alfredo <tupone@gentoo.org> AuthorDate: 2020-02-03 20:07:26 +0000 Commit: Tupone Alfredo <tupone@gentoo.org> CommitDate: 2020-02-03 20:07:26 +0000 dev-lang/gnat-gpl: use the new toolchain.eclass Closes: https://bugs.gentoo.org/706588 Package-Manager: Portage-2.3.79, Repoman-2.3.16 Signed-off-by: Alfredo Tupone <tupone@gentoo.org> dev-lang/gnat-gpl/Manifest | 3 --- dev-lang/gnat-gpl/gnat-gpl-2016-r4.ebuild | 22 ++++++------------ dev-lang/gnat-gpl/gnat-gpl-2017-r1.ebuild | 33 +++++++++++---------------- dev-lang/gnat-gpl/gnat-gpl-2018-r3.ebuild | 35 +++++++++++----------------- dev-lang/gnat-gpl/gnat-gpl-2019-r1.ebuild | 38 ++++++++++++------------------- 5 files changed, 48 insertions(+), 83 deletions(-)
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3293bae77263dd73adf3cf651863033ca3698055 commit 3293bae77263dd73adf3cf651863033ca3698055 Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2020-02-09 11:43:12 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2020-02-09 11:46:31 +0000 toolchain.eclass: don't allow overriding GCC_CONFIG_VER dev-lang/gnat-gpl migrated from GCC_CONFIG_VER to TOOLCHAIN_GCC_PV. Bug: https://bugs.gentoo.org/706588 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> eclass/toolchain.eclass | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=66666c48e0856461169819b1f23a551077bb5a15 commit 66666c48e0856461169819b1f23a551077bb5a15 Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2020-02-09 12:02:18 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2020-02-09 12:06:35 +0000 toolchain.eclass: assert GCC_RELEASE_VER to match gcc/BASE-VER Bug: https://bugs.gentoo.org/706588 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> eclass/toolchain.eclass | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=722c36ec62b4db40c5fa0567d34dd1ec8dd089d2 commit 722c36ec62b4db40c5fa0567d34dd1ec8dd089d2 Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2020-02-09 11:54:40 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2020-02-09 12:06:31 +0000 toolchain.eclass: drop GCC_A_FAKEIT and gcc_quick_unpack() gnal-gpl was the only user of GCC_A_FAKEIT as it provided modified gcc tarballs. It was migrated to GCC_TARBALL_SRC_URI to override default tarball. Bug: https://bugs.gentoo.org/706588 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> eclass/toolchain.eclass | 55 +------------------------------------------------ 1 file changed, 1 insertion(+), 54 deletions(-)