From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1705076-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 (4096 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id D768015812D
	for <garchives@archives.gentoo.org>; Thu, 02 Jan 2025 18:33:35 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 13943E0831;
	Thu, 02 Jan 2025 18:33:35 +0000 (UTC)
Received: from smtp.gentoo.org (woodpecker.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 D9D45E0831
	for <gentoo-commits@lists.gentoo.org>; Thu, 02 Jan 2025 18:33:34 +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 B82F733BEED
	for <gentoo-commits@lists.gentoo.org>; Thu, 02 Jan 2025 18:33:32 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 1BC2DAED
	for <gentoo-commits@lists.gentoo.org>; Thu, 02 Jan 2025 18:33:31 +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: <1735842491.8f9703447530c55709c3462035ecdb7562347185.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: 8f9703447530c55709c3462035ecdb7562347185
X-VCS-Branch: master
Date: Thu, 02 Jan 2025 18:33:31 +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: 6ee27f22-2e56-45fd-92e3-dbe003711b5d
X-Archives-Hash: 5ec04165264331af330f421cb4521d01

commit:     8f9703447530c55709c3462035ecdb7562347185
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Jan  2 18:28:11 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Jan  2 18:28:11 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8f970344

toolchain.eclass: cleanup /etc/clang/gentoo-gcc-install.cfg on removing last GCC

Otherwise, /etc/clang/gentoo-gcc-install.cfg is left with a broken non-existent
--gcc-install-dir value on LLVM-only profiles when the last installed GCC
gets removed.

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

 eclass/toolchain.eclass | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index c605c437f355..acc51ead74cc 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -2961,6 +2961,12 @@ toolchain_pkg_postrm() {
 			rm -f "${EROOT}"/usr/bin/${CTARGET}-{gcc,{g,c}++}{,32,64}
 		fi
 		return 0
+	else
+		# Removed the last GCC installed (bug #906040)
+		if ! has_version "sys-devel/gcc" && has_version "sys-devel/clang" ; then
+			einfo "Last GCC version removed. Cleaning up ${EROOT}/etc/clang/gentoo-gcc-install.cfg."
+			echo > "${EROOT}"/etc/clang/gentoo-gcc-install.cfg
+		fi
 	fi
 
 	# gcc stopped installing .la files fixer in June 2020.