diff --git a/python-jsonpatch.changes b/python-jsonpatch.changes index 4202964..0e4f67f 100644 --- a/python-jsonpatch.changes +++ b/python-jsonpatch.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Aug 15 14:51:56 UTC 2016 - toddrme2178@gmail.com + +- Fix update-alternatives implementation. + ------------------------------------------------------------------- Mon Jun 22 14:36:43 UTC 2015 - tbechtold@suse.com diff --git a/python-jsonpatch.spec b/python-jsonpatch.spec index 4f9872b..57a0104 100644 --- a/python-jsonpatch.spec +++ b/python-jsonpatch.spec @@ -27,9 +27,8 @@ Source: http://pypi.python.org/packages/source/j/jsonpatch/jsonpatch-%{v BuildRequires: python-devel BuildRequires: python-jsonpointer Requires: python-jsonpointer >= 1.9 -Requires(post): update-alternatives -Requires(postun): update-alternatives -Requires(pre): coreutils +Requires(post): update-alternatives +Requires(preun): update-alternatives BuildRoot: %{_tmppath}/%{name}-%{version}-build %if 0%{?suse_version} && 0%{?suse_version} <= 1110 %{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} @@ -49,31 +48,32 @@ python setup.py build %install python setup.py install --prefix=%{_prefix} --root=%{buildroot} -for i in patch diff; do - mv %{buildroot}%{_bindir}/json$i %{buildroot}%{_bindir}/json$i-%{py_ver} - ln -s %{_bindir}/json$i-%{py_ver} %{buildroot}%{_bindir}/json$i + +# Prepare for update-alternatives usage +mkdir -p %{buildroot}%{_sysconfdir}/alternatives +for p in jsonpatch jsondiff ; do + mv %{buildroot}%{_bindir}/$p %{buildroot}%{_bindir}/$p-%{py_ver} + ln -s -f %{_sysconfdir}/alternatives/$p %{buildroot}%{_bindir}/$p done -%pre -[ -h %{_bindir}/jsonpatch ] || rm -f %{_bindir}/jsonpatch -[ -h %{_bindir}/jsondiff ] || rm -f %{_bindir}/jsondiff - %post -update-alternatives --install \ - %{_bindir}/jsonpatch jsonpatch %{_bindir}/jsonpatch-%{py_ver} 20 \ +%_sbindir/update-alternatives \ + --install %{_bindir}/jsonpatch jsonpatch %{_bindir}/jsonpatch-%{py_ver} 20 \ --slave %{_bindir}/jsondiff jsondiff %{_bindir}/jsondiff-%{py_ver} %preun if [ $1 -eq 0 ] ; then - update-alternatives --remove jsonpatch %{_bindir}/jsonpatch-%{py_ver} + %_sbindir/update-alternatives --remove jsonpatch %{_bindir}/jsonpatch-%{py_ver} fi %files %defattr(-,root,root,-) -%ghost %{_bindir}/jsonpatch -%{_bindir}/jsonpatch-%{py_ver} -%ghost %{_bindir}/jsondiff +%{_bindir}/jsondiff +%{_bindir}/jsonpatch %{_bindir}/jsondiff-%{py_ver} +%{_bindir}/jsonpatch-%{py_ver} +%ghost %{_sysconfdir}/alternatives/jsondiff +%ghost %{_sysconfdir}/alternatives/jsonpatch %{python_sitelib}/jsonpatch* %changelog