Spec File: Use the correct alternatives (fixed version).

Resolves: #2209151
This commit is contained in:
Nick Clifton 2023-06-12 14:24:58 +01:00
parent 34a7a95ddb
commit ef4c92fca4

View File

@ -9,7 +9,7 @@ BuildRequires: scl-utils-build
Summary: A GNU collection of binary utilities Summary: A GNU collection of binary utilities
Name: %{?scl_prefix}binutils Name: %{?scl_prefix}binutils
Version: 2.40 Version: 2.40
Release: 9%{?dist} Release: 11%{?dist}
License: GPLv3+ License: GPLv3+
URL: https://sourceware.org/binutils URL: https://sourceware.org/binutils
@ -344,8 +344,14 @@ BuildRequires: dejagnu, zlib-static, glibc-static, sharutils, bc, libstdc++
BuildRequires: elfutils-debuginfod-client-devel BuildRequires: elfutils-debuginfod-client-devel
%endif %endif
Requires(post): alternatives %{?scl:Requires:%scl_runtime}
Requires(preun): alternatives
%define alternatives_cmd %{!?scl:%{_sbindir}}%{?scl:%{_root_sbindir}}/alternatives
%define alternatives_cmdline %{alternatives_cmd}%{?scl: --altdir %{_sysconfdir}/alternatives --admindir %{_scl_root}/var/lib/alternatives}
Requires(post): %{alternatives_cmd}
Requires(preun): %{alternatives_cmd}
# We also need rm. # We also need rm.
Requires(post): coreutils Requires(post): coreutils
@ -1101,17 +1107,21 @@ export QA_RPATHS=0x0003
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
%if %{with gold}
%post gold
%{alternatives_cmdline} --install %{_bindir}/ld ld \
%{_bindir}/ld.gold %{ld_gold_priority}
exit 0
%endif
%post %post
%__rm -f %{_bindir}/ld %__rm -f %{_bindir}/ld
%{_root_sbindir}/alternatives --install %{_bindir}/ld ld \ %{alternatives_cmdline} --install %{_bindir}/ld ld \
%{_bindir}/ld.bfd %{ld_bfd_priority} %{_bindir}/ld.bfd %{ld_bfd_priority}
%if %{with gold}
%{_root_sbindir}/alternatives --install %{_bindir}/ld ld \
%{_bindir}/ld.gold %{ld_gold_priority}
%endif
# Do not run "alternatives --auto ld" here. Leave the setting to # Do not run "alternatives --auto ld" here. Leave the setting to
# however the user previously had it set. See BZ 1592069 for more details. # however the user previously had it set. See BZ 1592069 for more details.
@ -1121,16 +1131,22 @@ exit 0
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
%preun # Note: $1 == 0 means that there is an uninstall in progress.
if [ $1 = 0 ]; then # $1 == 1 means that there is an upgrade in progress.
%{_root_sbindir}/alternatives --remove ld %{_bindir}/ld.bfd
fi
%if %{with gold} %if %{with gold}
%preun gold
if [ $1 = 0 ]; then if [ $1 = 0 ]; then
%{_root_sbindir}/alternatives --remove ld %{_bindir}/ld.gold %{alternatives_cmdline} --remove ld %{_bindir}/ld.gold
fi fi
exit 0
%endif %endif
%preun
if [ $1 = 0 ]; then
%{alternatives_cmdline} --remove ld %{_bindir}/ld.bfd
fi
touch %{_bindir}/ld
exit 0 exit 0
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
@ -1262,6 +1278,9 @@ exit 0
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
%changelog %changelog
* Mon Jun 12 2023 Nick Clifton <nickc@redhat.com> - 2.40-11
- Spec File: Use the correct alternatives. (#2209151 and #2213913)
* Mon May 22 2023 Marek Polacek <polacek@redhat.com> - 2.40-9 * Mon May 22 2023 Marek Polacek <polacek@redhat.com> - 2.40-9
- Spec File: Use the correct alternatives. (#2209151) - Spec File: Use the correct alternatives. (#2209151)