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.

Reply via email to