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_manpages valac
%global vala_tools_binaries vala-gen-introspect vapicheck vapigen %global vala_tools_binaries vala-gen-introspect vapicheck vapigen
%global vala_tools_manpages vala-gen-introspect vapigen %global vala_tools_manpages vala-gen-introspect vapigen
Requires(posttrans): %{_sbindir}/update-alternatives Requires(posttrans): %{_sbindir}/alternatives
Requires(preun): %{_sbindir}/update-alternatives Requires(preun): %{_sbindir}/alternatives
%description %description
@ -198,24 +198,41 @@ rm -rf $RPM_BUILD_ROOT
/sbin/ldconfig /sbin/ldconfig
for f in %{vala_binaries}; for f in %{vala_binaries};
do 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 $f %{_bindir}/$f-%{api_ver} 90
done done
for f in %{vala_manpages}; for f in %{vala_manpages};
do 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 $f.1.gz %{_mandir}/man1/$f-%{api_ver}.1.gz 90
done done
%posttrans tools %posttrans tools
for f in %{vala_tools_binaries}; for f in %{vala_tools_binaries};
do 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 $f %{_bindir}/$f-%{api_ver} 90
done done
for f in %{vala_tools_manpages}; for f in %{vala_tools_manpages};
do 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 $f.1.gz %{_mandir}/man1/$f-%{api_ver}.1.gz 90
done done
@ -223,24 +240,24 @@ done
/sbin/ldconfig /sbin/ldconfig
for f in %{vala_binaries}; for f in %{vala_binaries};
do do
%{_sbindir}/update-alternatives --remove $f \ %{_sbindir}/alternatives --remove $f \
%{_bindir}/$f-%{api_ver} %{_bindir}/$f-%{api_ver}
done done
for f in %{vala_manpages}; for f in %{vala_manpages};
do do
%{_sbindir}/update-alternatives --remove $f.1.gz \ %{_sbindir}/alternatives --remove $f.1.gz \
%{_mandir}/man1/$f-%{api_ver}.1.gz %{_mandir}/man1/$f-%{api_ver}.1.gz
done done
%preun tools %preun tools
for f in %{vala_tools_binaries}; for f in %{vala_tools_binaries};
do do
%{_sbindir}/update-alternatives --remove $f \ %{_sbindir}/alternatives --remove $f \
%{_bindir}/$f-%{api_ver} %{_bindir}/$f-%{api_ver}
done done
for f in %{vala_tools_manpages}; for f in %{vala_tools_manpages};
do do
%{_sbindir}/update-alternatives --remove $f.1.gz \ %{_sbindir}/alternatives --remove $f.1.gz \
%{_mandir}/man1/$f-%{api_ver}.1.gz %{_mandir}/man1/$f-%{api_ver}.1.gz
done done