Drop alternatives - there is no alternative

The previous package will cause warnings when upgrading to this package:
failed to link /usr/bin/hg -> /etc/alternatives/hg: /usr/bin/hg exists and it is not a symlink
failed to link /usr/bin/hg-ssh -> /etc/alternatives/hg-ssh: /usr/bin/hg-ssh exists and it is not a symlink
This commit is contained in:
Mads Kiilerich 2021-01-03 02:41:30 +01:00
parent 9d42a09086
commit 5b9b9bf00b

View File

@ -21,9 +21,6 @@ BuildRequires: pkgconfig
BuildRequires: python3-devel
BuildRequires: python3-docutils
# Priorities for the alternatives system
%global py3_priority 30
%description
Mercurial is a fast, lightweight source control management system designed
for efficient handling of very large distributed projects.
@ -42,8 +39,6 @@ Requires: python3
Requires: emacs-filesystem
Requires: %{name}-lang = %{version}-%{release}
Obsoletes: %{name}-py2 < %{version}-%{release}
Requires(post): %{_sbindir}/update-alternatives
Requires(preun): %{_sbindir}/update-alternatives
%description py3
Mercurial is a fast, lightweight source control management system designed
@ -120,7 +115,6 @@ grep 'hgk.py*' < %{name}.files > %{name}-hgk.files
install -D -m 755 contrib/hgk %{buildroot}%{_libexecdir}/mercurial/hgk
install -m 755 contrib/hg-ssh %{buildroot}%{_bindir}
mv %{buildroot}%{_bindir}/hg %{buildroot}%{_bindir}/hg3
bash_completion_dir=%{buildroot}$(pkg-config --variable=completionsdir bash-completion)
mkdir -p $bash_completion_dir
@ -174,32 +168,8 @@ rm -rf %{buildroot}%{python3_sitearch}/mercurial/locale
grep -v locale %{name}-base.files > %{name}-base-filtered.files
pathfix.py -pni "%{python3}" %{buildroot}%{_bindir}/hg-ssh
# Move hg-ssh aside
cp -p %{buildroot}%{_bindir}/hg-ssh %{buildroot}%{_bindir}/hg-ssh3
rm %{buildroot}%{_bindir}/hg-ssh
pathfix.py -pni "%{python3}" %{buildroot}%{_bindir}/hg-ssh3
# Touch the base executables for alternatives
touch %{buildroot}%{_bindir}/hg
touch %{buildroot}%{_bindir}/hg-ssh
%post py3
for fname in %{_bindir}/{hg,hg-ssh}; do
if [ ! -L "$fname" ]; then
rm -f "$fname"
fi
done
%{_sbindir}/update-alternatives --install %{_bindir}/hg \
hg %{_bindir}/hg3 %{py3_priority} \
--slave %{_bindir}/hg-ssh hg-ssh %{_bindir}/hg-ssh3 || :
%preun py3
if [ $1 -eq 0 ]; then
%{_sbindir}/update-alternatives --remove \
hg %{_bindir}/hg3 || :
fi
%files py3 -f %{name}-base-filtered.files
%doc CONTRIBUTORS COPYING doc/README doc/hg*.txt doc/hg*.html *.cgi contrib/*.fcgi contrib/*.wsgi
@ -217,10 +187,8 @@ fi
%{python3_sitearch}/hgdemandimport/
%{_emacs_sitelispdir}/mercurial
%{_emacs_sitestartdir}/*.el
%ghost %{_bindir}/hg
%ghost %{_bindir}/hg-ssh
%{_bindir}/hg3
%{_bindir}/hg-ssh3
%{_bindir}/hg
%{_bindir}/hg-ssh
%config(noreplace) %{_sysconfdir}/mercurial/hgrc.d/certs.rc