Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 706588 - migrate dev-lang/gnat-gpl off GCC_CONFIG_VER use
Summary: migrate dev-lang/gnat-gpl off GCC_CONFIG_VER use
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Linux ADA team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-01-27 00:06 UTC by Sergei Trofimovich (RETIRED)
Modified: 2020-02-09 12:06 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
0001-dev-lang-gnat-gpl-migrate-2019-r1-from-GCC_CONFIG_VE.patch (0001-dev-lang-gnat-gpl-migrate-2019-r1-from-GCC_CONFIG_VE.patch,3.25 KB, patch)
2020-02-01 19:23 UTC, Sergei Trofimovich (RETIRED)
Details | Diff
0002-dev-lang-gnat-gpl-migrate-2018-r3-from-GCC_CONFIG_VE.patch (0002-dev-lang-gnat-gpl-migrate-2018-r3-from-GCC_CONFIG_VE.patch,2.92 KB, patch)
2020-02-01 19:23 UTC, Sergei Trofimovich (RETIRED)
Details | Diff
0003-dev-lang-gnat-gpl-migrate-2017-r1-from-GCC_CONFIG_VE.patch (0003-dev-lang-gnat-gpl-migrate-2017-r1-from-GCC_CONFIG_VE.patch,3.15 KB, patch)
2020-02-01 19:23 UTC, Sergei Trofimovich (RETIRED)
Details | Diff
0004-dev-lang-gnat-gpl-migrate-2016-r4-from-GCC_A_FAKEIT-.patch (0004-dev-lang-gnat-gpl-migrate-2016-r4-from-GCC_A_FAKEIT-.patch,2.25 KB, patch)
2020-02-01 19:24 UTC, Sergei Trofimovich (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sergei Trofimovich (RETIRED) gentoo-dev 2020-01-27 00:06:03 UTC
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?
Comment 1 Sergei Trofimovich (RETIRED) gentoo-dev 2020-01-27 00:17:00 UTC
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"
Comment 2 Tupone Alfredo gentoo-dev 2020-01-27 20:03:56 UTC
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.
Comment 3 Larry the Git Cow gentoo-dev 2020-02-01 11:28:31 UTC
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(+)
Comment 4 Sergei Trofimovich (RETIRED) gentoo-dev 2020-02-01 11:30:55 UTC
(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.
Comment 5 Larry the Git Cow gentoo-dev 2020-02-01 12:36:02 UTC
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(-)
Comment 6 Sergei Trofimovich (RETIRED) gentoo-dev 2020-02-01 14:04:38 UTC
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}"
Comment 7 Sergei Trofimovich (RETIRED) gentoo-dev 2020-02-01 19:23:05 UTC
Created attachment 610604 [details, diff]
0001-dev-lang-gnat-gpl-migrate-2019-r1-from-GCC_CONFIG_VE.patch
Comment 8 Sergei Trofimovich (RETIRED) gentoo-dev 2020-02-01 19:23:26 UTC
Created attachment 610606 [details, diff]
0002-dev-lang-gnat-gpl-migrate-2018-r3-from-GCC_CONFIG_VE.patch
Comment 9 Sergei Trofimovich (RETIRED) gentoo-dev 2020-02-01 19:23:46 UTC
Created attachment 610608 [details, diff]
0003-dev-lang-gnat-gpl-migrate-2017-r1-from-GCC_CONFIG_VE.patch
Comment 10 Sergei Trofimovich (RETIRED) gentoo-dev 2020-02-01 19:24:06 UTC
Created attachment 610610 [details, diff]
0004-dev-lang-gnat-gpl-migrate-2016-r4-from-GCC_A_FAKEIT-.patch
Comment 11 Sergei Trofimovich (RETIRED) gentoo-dev 2020-02-01 19:25:04 UTC
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.
Comment 12 Larry the Git Cow gentoo-dev 2020-02-03 20:07:44 UTC
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(-)
Comment 13 Larry the Git Cow gentoo-dev 2020-02-09 11:46:41 UTC
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(-)
Comment 14 Larry the Git Cow gentoo-dev 2020-02-09 12:06:43 UTC
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(-)