From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1674952-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id BC2CC15808B
	for <garchives@archives.gentoo.org>; Mon, 30 Sep 2024 05:57:44 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id DC850E2A2F;
	Mon, 30 Sep 2024 05:57:43 +0000 (UTC)
Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id C09BEE2A2F
	for <gentoo-commits@lists.gentoo.org>; Mon, 30 Sep 2024 05:57:43 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 012FE3431D7
	for <gentoo-commits@lists.gentoo.org>; Mon, 30 Sep 2024 05:57:42 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 2AF5214CA
	for <gentoo-commits@lists.gentoo.org>; Mon, 30 Sep 2024 05:57:41 +0000 (UTC)
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" <sam@gentoo.org>
Message-ID: <1727675842.1bc16717ffb9819d1f5f03c1fe413be04d378246.sam@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
X-VCS-Repository: repo/gentoo
X-VCS-Files: eclass/toolchain.eclass
X-VCS-Directories: eclass/
X-VCS-Committer: sam
X-VCS-Committer-Name: Sam James
X-VCS-Revision: 1bc16717ffb9819d1f5f03c1fe413be04d378246
X-VCS-Branch: master
Date: Mon, 30 Sep 2024 05:57:41 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: f20b1e4c-4da8-4cd3-8602-908ede9a6653
X-Archives-Hash: 9b833e0f54072b3d47dce21f45258a2a

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