From 1846c73b59ce2701a0711e93cffbb6fca1c6b1ba Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Thu, 16 May 2024 13:43:43 -0300 Subject: [PATCH] Fix rhbz #2248872 Ensure the versioned llvm-config alternative gets removed during major upgrades of the non-compat package. Also add code that removes the versioned llvm-config alternatives of the previous 3 LLVM versions. These versions didn't remove their own versioned llvm-config alternative, leading to broken output, e.g. llvm-config-16 points to llvm-config-64 from LLVM 17. --- llvm.spec | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/llvm.spec b/llvm.spec index 23f251a..212f8b9 100644 --- a/llvm.spec +++ b/llvm.spec @@ -493,6 +493,16 @@ done %{_sbindir}/update-alternatives --install %{_bindir}/llvm-config%{exec_suffix} llvm-config%{exec_suffix} %{install_bindir}/llvm-config%{exec_suffix}-%{__isa_bits} %{__isa_bits} %if %{without compat_build} %{_sbindir}/update-alternatives --install %{_bindir}/llvm-config-%{maj_ver} llvm-config-%{maj_ver} %{install_bindir}/llvm-config%{exec_suffix}-%{__isa_bits} %{__isa_bits} + +# During the upgrade from LLVM 16 (F38) to LLVM 17 (F39), we found out the +# main llvm-devel package was leaving entries in the alternatives system. +# Try to remove them now. +for v in 14 15 16; do + if [[ -e %{_bindir}/llvm-config-$v + && "x$(%{_bindir}/llvm-config-$v --version | awk -F . '{ print $1 }')" != "x$v" ]]; then + %{_sbindir}/update-alternatives --remove llvm-config-$v %{install_bindir}/llvm-config%{exec_suffix}-%{__isa_bits} + fi +done %endif