From f82845f89725ab27b9bae8c106030cfadd43aac7138c20b69563135bffbd51ee Mon Sep 17 00:00:00 2001 From: Lee Duncan Date: Fri, 17 Sep 2021 21:13:12 +0000 Subject: [PATCH 1/3] Accepting request 919821 from home:schubi2 - Use libalternatives instead of update-alternatives. OBS-URL: https://build.opensuse.org/request/show/919821 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-rtslib-fb?expand=0&rev=60 --- python-rtslib-fb.changes | 5 +++++ python-rtslib-fb.spec | 39 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/python-rtslib-fb.changes b/python-rtslib-fb.changes index 99895f0..25afc5e 100644 --- a/python-rtslib-fb.changes +++ b/python-rtslib-fb.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Tue Aug 24 07:35:46 UTC 2021 - Stefan Schubert + +- Use libalternatives instead of update-alternatives. + ------------------------------------------------------------------- Sat Nov 7 18:05:32 UTC 2020 - Lee Duncan diff --git a/python-rtslib-fb.spec b/python-rtslib-fb.spec index 50ecdce..bbd0539 100644 --- a/python-rtslib-fb.spec +++ b/python-rtslib-fb.spec @@ -1,7 +1,7 @@ # # spec file for package python-rtslib-fb # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,6 +16,12 @@ # +%if 0%{?suse_version} > 1500 +%bcond_without libalternatives +%else +%bcond_with libalternatives +%endif + %define dbdir %{_sysconfdir}/target %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-rtslib-fb @@ -38,8 +44,12 @@ Requires: python-pyudev %define oldpython python %define cpkg %{oldpython}-rtslib-fb-common Requires: %{cpkg} +%if %{with libalternatives} +Requires: alts +%else Requires(post): update-alternatives Requires(postun): update-alternatives +%endif Provides: python-rtslib = %{version}-%{release} Obsoletes: python-rtslib < %{version} %if 0%{?sle_version} >= 150000 @@ -79,7 +89,14 @@ python2-rtslib-fb and python3-rtslib-fb. %install %python_install -%python_clone -a %{buildroot}/%{_bindir}/targetctl +%if ! %{with libalternatives} + %python_clone -a %{buildroot}/%{_bindir}/targetctl +%else + %python_clone %{buildroot}%{_bindir}/targetctl + ln -sf %{_bindir}/alts %{buildroot}%{_bindir}/targetctl + mkdir -p %{buildroot}%{_datadir}/libalternatives/targetctl + %python_expand echo "binary=%{_bindir}/targetctl-%{$python_version}" > %{buildroot}%{_datadir}/libalternatives/targetctl/10%{$python_version_nodots}.conf +%endif %fdupes %{buildroot} install -d -m755 %{buildroot}%{_mandir}/man5 install -m644 doc/saveconfig.json.5 %{buildroot}%{_mandir}/man5 @@ -94,15 +111,25 @@ install -d -m755 %{buildroot}%{_sbindir} ln -s %{_sbindir}/service %{buildroot}/%{_sbindir}/rctarget %post +%if ! %{with libalternatives} %python_install_alternative targetctl +%endif %{service_add_post target.service} %postun +%if ! %{with libalternatives} %python_uninstall_alternative targetctl +%endif %{service_del_postun target.service} %pre %{service_add_pre target.service} +%if %{with libalternatives} +# removing old update-alternatives entries +if [ "$1" -gt 0 ] && [ -f %{_sbindir}/update-alternatives ] ; then + %python_uninstall_alternative targetctl +fi +%endif %preun %{stop_on_removal target} @@ -121,7 +148,15 @@ ln -s %{_sbindir}/service %{buildroot}/%{_sbindir}/rctarget %{service_del_preun target.service} %files %{python_files} +%if ! 0%{with libalternatives} %python_alternative %{_bindir}/targetctl +%else +%dir %{_datadir}/libalternatives +%dir %{_datadir}/libalternatives/targetctl +%{_datadir}/libalternatives/targetctl/10%python_version_nodots.conf +%{_bindir}/targetctl +%{_bindir}/targetctl-%python_version +%endif %{python_sitelib}/* %files -n %{cpkg} From 99db4473575f215c53a8f50934324125b4bd9f9f354c76ec61e676dc0c8bd0da Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Sun, 19 Sep 2021 17:24:03 +0000 Subject: [PATCH 2/3] Accepting request 920167 from devel:languages:python revert OBS-URL: https://build.opensuse.org/request/show/920167 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-rtslib-fb?expand=0&rev=61 --- python-rtslib-fb.changes | 5 ----- python-rtslib-fb.spec | 39 ++------------------------------------- 2 files changed, 2 insertions(+), 42 deletions(-) diff --git a/python-rtslib-fb.changes b/python-rtslib-fb.changes index 25afc5e..99895f0 100644 --- a/python-rtslib-fb.changes +++ b/python-rtslib-fb.changes @@ -1,8 +1,3 @@ -------------------------------------------------------------------- -Tue Aug 24 07:35:46 UTC 2021 - Stefan Schubert - -- Use libalternatives instead of update-alternatives. - ------------------------------------------------------------------- Sat Nov 7 18:05:32 UTC 2020 - Lee Duncan diff --git a/python-rtslib-fb.spec b/python-rtslib-fb.spec index bbd0539..50ecdce 100644 --- a/python-rtslib-fb.spec +++ b/python-rtslib-fb.spec @@ -1,7 +1,7 @@ # # spec file for package python-rtslib-fb # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,12 +16,6 @@ # -%if 0%{?suse_version} > 1500 -%bcond_without libalternatives -%else -%bcond_with libalternatives -%endif - %define dbdir %{_sysconfdir}/target %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-rtslib-fb @@ -44,12 +38,8 @@ Requires: python-pyudev %define oldpython python %define cpkg %{oldpython}-rtslib-fb-common Requires: %{cpkg} -%if %{with libalternatives} -Requires: alts -%else Requires(post): update-alternatives Requires(postun): update-alternatives -%endif Provides: python-rtslib = %{version}-%{release} Obsoletes: python-rtslib < %{version} %if 0%{?sle_version} >= 150000 @@ -89,14 +79,7 @@ python2-rtslib-fb and python3-rtslib-fb. %install %python_install -%if ! %{with libalternatives} - %python_clone -a %{buildroot}/%{_bindir}/targetctl -%else - %python_clone %{buildroot}%{_bindir}/targetctl - ln -sf %{_bindir}/alts %{buildroot}%{_bindir}/targetctl - mkdir -p %{buildroot}%{_datadir}/libalternatives/targetctl - %python_expand echo "binary=%{_bindir}/targetctl-%{$python_version}" > %{buildroot}%{_datadir}/libalternatives/targetctl/10%{$python_version_nodots}.conf -%endif +%python_clone -a %{buildroot}/%{_bindir}/targetctl %fdupes %{buildroot} install -d -m755 %{buildroot}%{_mandir}/man5 install -m644 doc/saveconfig.json.5 %{buildroot}%{_mandir}/man5 @@ -111,25 +94,15 @@ install -d -m755 %{buildroot}%{_sbindir} ln -s %{_sbindir}/service %{buildroot}/%{_sbindir}/rctarget %post -%if ! %{with libalternatives} %python_install_alternative targetctl -%endif %{service_add_post target.service} %postun -%if ! %{with libalternatives} %python_uninstall_alternative targetctl -%endif %{service_del_postun target.service} %pre %{service_add_pre target.service} -%if %{with libalternatives} -# removing old update-alternatives entries -if [ "$1" -gt 0 ] && [ -f %{_sbindir}/update-alternatives ] ; then - %python_uninstall_alternative targetctl -fi -%endif %preun %{stop_on_removal target} @@ -148,15 +121,7 @@ fi %{service_del_preun target.service} %files %{python_files} -%if ! 0%{with libalternatives} %python_alternative %{_bindir}/targetctl -%else -%dir %{_datadir}/libalternatives -%dir %{_datadir}/libalternatives/targetctl -%{_datadir}/libalternatives/targetctl/10%python_version_nodots.conf -%{_bindir}/targetctl -%{_bindir}/targetctl-%python_version -%endif %{python_sitelib}/* %files -n %{cpkg} From 96b38c3b660a5a8c079b238a945f613e4ea3c5c5d8a4b9db7e472a199b08a623 Mon Sep 17 00:00:00 2001 From: Lee Duncan Date: Tue, 5 Oct 2021 17:59:16 +0000 Subject: [PATCH 3/3] Accepting request 923283 from home:schubi2 - Use libalternatives instead of update-alternatives. OBS-URL: https://build.opensuse.org/request/show/923283 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-rtslib-fb?expand=0&rev=62 --- python-rtslib-fb.changes | 5 +++++ python-rtslib-fb.spec | 17 +++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/python-rtslib-fb.changes b/python-rtslib-fb.changes index 99895f0..a9b2736 100644 --- a/python-rtslib-fb.changes +++ b/python-rtslib-fb.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Thu Sep 30 19:14:14 UTC 2021 - Stefan Schubert + +- Use libalternatives instead of update-alternatives. + ------------------------------------------------------------------- Sat Nov 7 18:05:32 UTC 2020 - Lee Duncan diff --git a/python-rtslib-fb.spec b/python-rtslib-fb.spec index 50ecdce..16ecfad 100644 --- a/python-rtslib-fb.spec +++ b/python-rtslib-fb.spec @@ -1,7 +1,7 @@ # # spec file for package python-rtslib-fb # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,6 +16,12 @@ # +%if 0%{?suse_version} > 1500 +%bcond_without libalternatives +%else +%bcond_with libalternatives +%endif + %define dbdir %{_sysconfdir}/target %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-rtslib-fb @@ -33,13 +39,18 @@ BuildRequires: %{python_module pyudev} BuildRequires: %{python_module setuptools} BuildRequires: %{python_module six} BuildRequires: fdupes -BuildRequires: python-rpm-macros +BuildRequires: python-rpm-macros >= 20210929 Requires: python-pyudev %define oldpython python %define cpkg %{oldpython}-rtslib-fb-common Requires: %{cpkg} +%if %{with libalternatives} +Requires: alts +BuildRequires: alts +%else Requires(post): update-alternatives Requires(postun): update-alternatives +%endif Provides: python-rtslib = %{version}-%{release} Obsoletes: python-rtslib < %{version} %if 0%{?sle_version} >= 150000 @@ -103,6 +114,8 @@ ln -s %{_sbindir}/service %{buildroot}/%{_sbindir}/rctarget %pre %{service_add_pre target.service} +# If libalternatives is used: Removing old update-alternatives entries. +%python_libalternatives_reset_alternative targetctl %preun %{stop_on_removal target}