commit:     1bc16717ffb9819d1f5f03c1fe413be04d378246
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 30 05:54:07 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Sep 30 05:57:22 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1bc16717

toolchain.eclass: tweak Ada, D deps

Without this, we can end up with something like:
```
[ebuild  NS    ] sys-devel/gcc-11.5.0:11::gentoo [13.3.1_p20240614:13::gentoo] 
USE="(ada*) cet (cxx) (d*) [...]"
[ebuild   R    ]  sys-devel/gcc-13.3.1_p20240614:13::gentoo  USE="(ada*) cet 
(cxx) (d*) [...]"

Total: 2 packages (1 in new slot, 1 reinstall), Size of downloads: 0 KiB

 * Error: circular dependencies:

(sys-devel/gcc-13.3.1_p20240614:13/13::gentoo, ebuild scheduled for merge) 
depends on
 (sys-devel/gcc-11.5.0:11/11::gentoo, ebuild scheduled for merge) (buildtime)
  (sys-devel/gcc-13.3.1_p20240614:13/13::gentoo, ebuild scheduled for merge) 
(buildtime)
```

Portage sees sys-devel/gcc[ada] is queued and tries to use it to satisfy
the dep for 11, which pulls in 13, which pulls in 11 for D.

We can workaround this by depending on older GCC for whatever slot we're
in. This matches upstream documentation and also reality as you usually
need an older version anyway.

See also 370253f008a8922c9aebe8099ab9c34bd6947f66 in binhost.git.

Bug: https://bugs.gentoo.org/880825
Signed-off-by: Sam James <sam <AT> gentoo.org>

 eclass/toolchain.eclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index d29d07080582..939c68113188 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -402,7 +402,7 @@ if tc_has_feature valgrind ; then
 fi
 
 if [[ ${PN} != gnat-gpl ]] && tc_has_feature ada ; then
-       BDEPEND+=" ada? ( || ( sys-devel/gcc[ada] dev-lang/gnat-gpl[ada] ) )"
+       BDEPEND+=" ada? ( || ( sys-devel/gcc:${SLOT}[ada] 
<sys-devel/gcc-${SLOT}[ada] dev-lang/gnat-gpl[ada] ) )"
 fi
 
 # TODO: Add a pkg_setup & pkg_pretend check for whether the active compiler
@@ -411,7 +411,7 @@ if tc_has_feature d && tc_version_is_at_least 12.0 ; then
        # D in 12+ is self-hosting and needs D to bootstrap.
        # TODO: package some binary we can use, like for Ada
        # bug #840182
-       BDEPEND+=" d? ( || ( sys-devel/gcc[d(-)] <sys-devel/gcc-12[d(-)] ) )"
+       BDEPEND+=" d? ( || ( sys-devel/gcc:${SLOT}[d(-)] 
<sys-devel/gcc-${SLOT}[d(-)] <sys-devel/gcc-12[d(-)] ) )"
 fi
 
 if tc_has_feature rust && tc_version_is_at_least 14.0.0_pre20230421 ; then

Reply via email to