Also clean up dangling symlinks from previous alternatives scriptlet

This commit is contained in:
Michel Alexandre Salim 2012-04-06 01:16:42 +07:00
parent 9c9fa050d0
commit f80c6514c3

View File

@ -36,8 +36,8 @@ BuildRequires: emacs emacs-el
%global vala_manpages valac
%global vala_tools_binaries vala-gen-introspect vapicheck vapigen
%global vala_tools_manpages vala-gen-introspect vapigen
Requires(posttrans): %{_sbindir}/update-alternatives
Requires(preun): %{_sbindir}/update-alternatives
Requires(posttrans): %{_sbindir}/alternatives
Requires(preun): %{_sbindir}/alternatives
%description
@ -198,24 +198,41 @@ rm -rf $RPM_BUILD_ROOT
/sbin/ldconfig
for f in %{vala_binaries};
do
%{_sbindir}/update-alternatives --install %{_bindir}/$f \
if find -L /etc/alternatives/$f -type l | grep $f;
then
# older vala packages fail to remove alternatives on upgrade
%{_sbindir}/alternatives --remove $f $(readlink /etc/alternatives/$f)
fi
%{_sbindir}/alternatives --install %{_bindir}/$f \
$f %{_bindir}/$f-%{api_ver} 90
done
for f in %{vala_manpages};
do
%{_sbindir}/update-alternatives --install %{_mandir}/man1/$f.1.gz \
if find -L /etc/alternatives/$f -type l | grep $f;
then
%{_sbindir}/alternatives --remove $f $(readlink /etc/alternatives/$f)
fi
%{_sbindir}/alternatives --install %{_mandir}/man1/$f.1.gz \
$f.1.gz %{_mandir}/man1/$f-%{api_ver}.1.gz 90
done
%posttrans tools
for f in %{vala_tools_binaries};
do
%{_sbindir}/update-alternatives --install %{_bindir}/$f \
if find -L /etc/alternatives/$f -type l | grep $f;
then
%{_sbindir}/alternatives --remove $f $(readlink /etc/alternatives/$f)
fi
%{_sbindir}/alternatives --install %{_bindir}/$f \
$f %{_bindir}/$f-%{api_ver} 90
done
for f in %{vala_tools_manpages};
do
%{_sbindir}/update-alternatives --install %{_mandir}/man1/$f.1.gz \
if find -L /etc/alternatives/$f -type l | grep $f;
then
%{_sbindir}/alternatives --remove $f $(readlink /etc/alternatives/$f)
fi
%{_sbindir}/alternatives --install %{_mandir}/man1/$f.1.gz \
$f.1.gz %{_mandir}/man1/$f-%{api_ver}.1.gz 90
done
@ -223,24 +240,24 @@ done
/sbin/ldconfig
for f in %{vala_binaries};
do
%{_sbindir}/update-alternatives --remove $f \
%{_sbindir}/alternatives --remove $f \
%{_bindir}/$f-%{api_ver}
done
for f in %{vala_manpages};
do
%{_sbindir}/update-alternatives --remove $f.1.gz \
%{_sbindir}/alternatives --remove $f.1.gz \
%{_mandir}/man1/$f-%{api_ver}.1.gz
done
%preun tools
for f in %{vala_tools_binaries};
do
%{_sbindir}/update-alternatives --remove $f \
%{_sbindir}/alternatives --remove $f \
%{_bindir}/$f-%{api_ver}
done
for f in %{vala_tools_manpages};
do
%{_sbindir}/update-alternatives --remove $f.1.gz \
%{_sbindir}/alternatives --remove $f.1.gz \
%{_mandir}/man1/$f-%{api_ver}.1.gz
done