Accepting request 175850 from devel:languages:python

- Fix update-alternatives and support upgrade from previous versions

- Fix update-alternatives and support upgrade from previous versions

OBS-URL: https://build.opensuse.org/request/show/175850
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-coverage?expand=0&rev=14
This commit is contained in:
Stephan Kulow 2013-05-16 14:15:40 +00:00 committed by Git OBS Bridge
commit 576b75a262
4 changed files with 34 additions and 8 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed May 15 14:50:46 UTC 2013 - speilicke@suse.com
- Fix update-alternatives and support upgrade from previous versions
------------------------------------------------------------------- -------------------------------------------------------------------
Fri May 3 09:15:27 UTC 2013 - speilicke@suse.com Fri May 3 09:15:27 UTC 2013 - speilicke@suse.com

View File

@ -51,6 +51,8 @@ python setup.py build
%install %install
python setup.py install --prefix=%{_prefix} --root=%{buildroot} python setup.py install --prefix=%{_prefix} --root=%{buildroot}
rm %{buildroot}%{_bindir}/coverage
ln -s %{_bindir}/coverage-%{py_ver} %{buildroot}/%{_bindir}/coverage
#NOTE(saschpe): The following seems to mess with the install dir, which is odd: #NOTE(saschpe): The following seems to mess with the install dir, which is odd:
#%%check #%%check
@ -61,11 +63,17 @@ python setup.py install --prefix=%{_prefix} --root=%{buildroot}
#python setup.py --quiet build_ext --inplace #python setup.py --quiet build_ext --inplace
#python igor.py test_with_tracer c #python igor.py test_with_tracer c
%pre
# Since /usr/bin/coverage became ghosted to be used with update-alternatives, we have
# to get rid of the old binary resulting from the non-update-alternativies-ified package:
[[ ! -L %{_bindir}/coverage ]] && rm -f %{_bindir}/coverage
exit 0
%post %post
update-alternatives \ update-alternatives \
--install %{_bindir}/coverage coverage %{_bindir}/coverage-%{py_ver} 10 --install %{_bindir}/coverage coverage %{_bindir}/coverage-%{py_ver} 20
%postun %preun
if [ $1 -eq 0 ] ; then if [ $1 -eq 0 ] ; then
update-alternatives --remove coverage %{_bindir}/coverage-%{py_ver} update-alternatives --remove coverage %{_bindir}/coverage-%{py_ver}
fi fi
@ -73,7 +81,7 @@ fi
%files %files
%defattr(-,root,root,-) %defattr(-,root,root,-)
%doc AUTHORS.txt CHANGES.txt README.txt %doc AUTHORS.txt CHANGES.txt README.txt
%ghost %attr(0755,root,root) %{_bindir}/coverage %ghost %{_bindir}/coverage
%{_bindir}/coverage2 %{_bindir}/coverage2
%{_bindir}/coverage-%{py_ver} %{_bindir}/coverage-%{py_ver}
%{python_sitearch}/coverage/ %{python_sitearch}/coverage/

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed May 15 14:51:01 UTC 2013 - speilicke@suse.com
- Fix update-alternatives and support upgrade from previous versions
------------------------------------------------------------------- -------------------------------------------------------------------
Fri May 3 10:05:07 UTC 2013 - speilicke@suse.com Fri May 3 10:05:07 UTC 2013 - speilicke@suse.com

View File

@ -45,12 +45,20 @@ python3 setup.py build
%install %install
python3 setup.py install --prefix=%{_prefix} --root=%{buildroot} python3 setup.py install --prefix=%{_prefix} --root=%{buildroot}
rm %{buildroot}%{_bindir}/coverage
ln -s %{_bindir}/coverage-%{py3_ver} %{buildroot}/%{_bindir}/coverage
%pre
# Since /usr/bin/coverage became ghosted to be used with update-alternatives, we have
# to get rid of the old binary resulting from the non-update-alternativies-ified package:
[[ ! -L %{_bindir}/coverage ]] && rm -f %{_bindir}/coverage
exit 0
%post %post
update-alternatives \ update-alternatives \
--install %{_bindir}/coverage coverage %{_bindir}/coverage-%{py3_ver} 10 --install %{_bindir}/coverage coverage %{_bindir}/coverage-%{py3_ver} 30
%postun %preun
if [ $1 -eq 0 ] ; then if [ $1 -eq 0 ] ; then
update-alternatives --remove coverage %{_bindir}/coverage-%{py3_ver} update-alternatives --remove coverage %{_bindir}/coverage-%{py3_ver}
fi fi
@ -58,7 +66,7 @@ fi
%files %files
%defattr(-,root,root,-) %defattr(-,root,root,-)
%doc AUTHORS.txt CHANGES.txt README.txt %doc AUTHORS.txt CHANGES.txt README.txt
%ghost %attr(0755,root,root) %{_bindir}/coverage %ghost %{_bindir}/coverage
%{_bindir}/coverage3 %{_bindir}/coverage3
%{_bindir}/coverage-%{py3_ver} %{_bindir}/coverage-%{py3_ver}
%{python3_sitearch}/coverage %{python3_sitearch}/coverage