From 96269f907c87adc60dd997d94b1dfa0643a06562f90dec9626ba417e183b35d0 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Fri, 17 Sep 2021 20:45:22 +0000 Subject: [PATCH 1/5] Accepting request 919825 from home:schubi2 - Fixed mibcopy installation with alternatives. - Use libalternatives instead of update-alternatives. OBS-URL: https://build.opensuse.org/request/show/919825 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pysmi?expand=0&rev=19 --- python-pysmi.changes | 6 ++++++ python-pysmi.spec | 50 +++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 53 insertions(+), 3 deletions(-) diff --git a/python-pysmi.changes b/python-pysmi.changes index aced58e..d11a2b7 100644 --- a/python-pysmi.changes +++ b/python-pysmi.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Aug 24 11:59:57 UTC 2021 - schubi + +- Fixed mibcopy installation with alternatives. +- Use libalternatives instead of update-alternatives. + ------------------------------------------------------------------- Mon Oct 14 14:17:08 UTC 2019 - Matej Cepl diff --git a/python-pysmi.spec b/python-pysmi.spec index 1cf8cde..e5852f3 100644 --- a/python-pysmi.spec +++ b/python-pysmi.spec @@ -1,7 +1,7 @@ # # spec file for package python-pysmi # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# 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 + %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-pysmi Version: 0.3.4 @@ -28,8 +34,12 @@ BuildRequires: %{python_module ply} BuildRequires: fdupes BuildRequires: python-rpm-macros Requires: python-ply +%if %{with libalternatives} +Requires: alts +%else Requires(post): update-alternatives Requires(postun): update-alternatives +%endif BuildArch: noarch %python_subpackages @@ -49,15 +59,37 @@ Documentation: http://pysmi.sf.net %python_install mv %{buildroot}%{_bindir}/mibdump.py %{buildroot}%{_bindir}/mibdump mv %{buildroot}%{_bindir}/mibcopy.py %{buildroot}%{_bindir}/mibcopy -%python_clone -a %{buildroot}%{_bindir}/mibdump -%python_clone -a %{buildroot}%{_bindir}/mibcopy +%if ! %{with libalternatives} + %python_clone -a %{buildroot}%{_bindir}/mibdump + %python_clone -a %{buildroot}%{_bindir}/mibcopy +%else + %python_clone %{buildroot}%{_bindir}/mibdump + %python_clone %{buildroot}%{_bindir}/mibcopy + ln -sf %{_bindir}/alts %{buildroot}%{_bindir}/mibdump + mkdir -p %{buildroot}%{_datadir}/libalternatives/mibdump + %python_expand echo "binary=%{_bindir}/mibdump-%{$python_version}" > %{buildroot}%{_datadir}/libalternatives/mibdump/10%{$python_version_nodots}.conf + ln -sf %{_bindir}/alts %{buildroot}%{_bindir}/mibcopy + mkdir -p %{buildroot}%{_datadir}/libalternatives/mibcopy + %python_expand echo "binary=%{_bindir}/mibcopy-%{$python_version}" > %{buildroot}%{_datadir}/libalternatives/mibcopy/10%{$python_version_nodots}.conf +%endif %python_expand %fdupes %{buildroot}%{$python_sitelib} +%if %{with libalternatives} +%pre +# removing old update-alternatives entries +if [ "$1" -gt 0 ] && [ -f %{_sbindir}/update-alternatives ] ; then + %python_uninstall_alternative mibdump + %python_uninstall_alternative mibcopy +fi +%else %post %python_install_alternative mibdump +%python_install_alternative mibcopy %postun %python_uninstall_alternative mibdump +%python_uninstall_alternative mibcopy +%endif #%%check #nosetests # cannot be run without pysmnp which needs this package @@ -66,7 +98,19 @@ mv %{buildroot}%{_bindir}/mibcopy.py %{buildroot}%{_bindir}/mibcopy %license LICENSE.rst %doc README.md CHANGES.rst %{python_sitelib}/* +%if ! 0%{with libalternatives} %python_alternative %{_bindir}/mibdump %python_alternative %{_bindir}/mibcopy +%else +%dir %{_datadir}/libalternatives +%dir %{_datadir}/libalternatives/mibdump +%{_datadir}/libalternatives/mibdump/10%python_version_nodots.conf +%{_bindir}/mibdump +%{_bindir}/mibdump-%python_version +%dir %{_datadir}/libalternatives/mibcopy +%{_datadir}/libalternatives/mibcopy/10%python_version_nodots.conf +%{_bindir}/mibcopy +%{_bindir}/mibcopy-%python_version +%endif %changelog From b44a00205c494bc8ad10694f0b334de9afb3495126cd19d8e74d6c37941451c9 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Sun, 19 Sep 2021 17:25:22 +0000 Subject: [PATCH 2/5] Accepting request 920168 from devel:languages:python revert OBS-URL: https://build.opensuse.org/request/show/920168 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pysmi?expand=0&rev=20 --- python-pysmi.changes | 6 ------ python-pysmi.spec | 50 +++----------------------------------------- 2 files changed, 3 insertions(+), 53 deletions(-) diff --git a/python-pysmi.changes b/python-pysmi.changes index d11a2b7..aced58e 100644 --- a/python-pysmi.changes +++ b/python-pysmi.changes @@ -1,9 +1,3 @@ -------------------------------------------------------------------- -Tue Aug 24 11:59:57 UTC 2021 - schubi - -- Fixed mibcopy installation with alternatives. -- Use libalternatives instead of update-alternatives. - ------------------------------------------------------------------- Mon Oct 14 14:17:08 UTC 2019 - Matej Cepl diff --git a/python-pysmi.spec b/python-pysmi.spec index e5852f3..1cf8cde 100644 --- a/python-pysmi.spec +++ b/python-pysmi.spec @@ -1,7 +1,7 @@ # # spec file for package python-pysmi # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # 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 - %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-pysmi Version: 0.3.4 @@ -34,12 +28,8 @@ BuildRequires: %{python_module ply} BuildRequires: fdupes BuildRequires: python-rpm-macros Requires: python-ply -%if %{with libalternatives} -Requires: alts -%else Requires(post): update-alternatives Requires(postun): update-alternatives -%endif BuildArch: noarch %python_subpackages @@ -59,37 +49,15 @@ Documentation: http://pysmi.sf.net %python_install mv %{buildroot}%{_bindir}/mibdump.py %{buildroot}%{_bindir}/mibdump mv %{buildroot}%{_bindir}/mibcopy.py %{buildroot}%{_bindir}/mibcopy -%if ! %{with libalternatives} - %python_clone -a %{buildroot}%{_bindir}/mibdump - %python_clone -a %{buildroot}%{_bindir}/mibcopy -%else - %python_clone %{buildroot}%{_bindir}/mibdump - %python_clone %{buildroot}%{_bindir}/mibcopy - ln -sf %{_bindir}/alts %{buildroot}%{_bindir}/mibdump - mkdir -p %{buildroot}%{_datadir}/libalternatives/mibdump - %python_expand echo "binary=%{_bindir}/mibdump-%{$python_version}" > %{buildroot}%{_datadir}/libalternatives/mibdump/10%{$python_version_nodots}.conf - ln -sf %{_bindir}/alts %{buildroot}%{_bindir}/mibcopy - mkdir -p %{buildroot}%{_datadir}/libalternatives/mibcopy - %python_expand echo "binary=%{_bindir}/mibcopy-%{$python_version}" > %{buildroot}%{_datadir}/libalternatives/mibcopy/10%{$python_version_nodots}.conf -%endif +%python_clone -a %{buildroot}%{_bindir}/mibdump +%python_clone -a %{buildroot}%{_bindir}/mibcopy %python_expand %fdupes %{buildroot}%{$python_sitelib} -%if %{with libalternatives} -%pre -# removing old update-alternatives entries -if [ "$1" -gt 0 ] && [ -f %{_sbindir}/update-alternatives ] ; then - %python_uninstall_alternative mibdump - %python_uninstall_alternative mibcopy -fi -%else %post %python_install_alternative mibdump -%python_install_alternative mibcopy %postun %python_uninstall_alternative mibdump -%python_uninstall_alternative mibcopy -%endif #%%check #nosetests # cannot be run without pysmnp which needs this package @@ -98,19 +66,7 @@ fi %license LICENSE.rst %doc README.md CHANGES.rst %{python_sitelib}/* -%if ! 0%{with libalternatives} %python_alternative %{_bindir}/mibdump %python_alternative %{_bindir}/mibcopy -%else -%dir %{_datadir}/libalternatives -%dir %{_datadir}/libalternatives/mibdump -%{_datadir}/libalternatives/mibdump/10%python_version_nodots.conf -%{_bindir}/mibdump -%{_bindir}/mibdump-%python_version -%dir %{_datadir}/libalternatives/mibcopy -%{_datadir}/libalternatives/mibcopy/10%python_version_nodots.conf -%{_bindir}/mibcopy -%{_bindir}/mibcopy-%python_version -%endif %changelog From 8c4dea129f5d925fc715d7081d7cff8b2c6582d44e9e1b9914ada1de97721e5a Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Sun, 3 Oct 2021 14:53:56 +0000 Subject: [PATCH 3/5] Accepting request 922618 from home:schubi2 - Use libalternatives instead of update-alternatives. OBS-URL: https://build.opensuse.org/request/show/922618 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pysmi?expand=0&rev=21 --- python-pysmi.changes | 5 +++++ python-pysmi.spec | 18 ++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/python-pysmi.changes b/python-pysmi.changes index aced58e..c93a426 100644 --- a/python-pysmi.changes +++ b/python-pysmi.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Thu Sep 30 20:13:20 UTC 2021 - Stefan Schubert + +- Use libalternatives instead of update-alternatives. + ------------------------------------------------------------------- Mon Oct 14 14:17:08 UTC 2019 - Matej Cepl diff --git a/python-pysmi.spec b/python-pysmi.spec index 1cf8cde..15d1c5e 100644 --- a/python-pysmi.spec +++ b/python-pysmi.spec @@ -1,7 +1,7 @@ # # spec file for package python-pysmi # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# 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 + %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-pysmi Version: 0.3.4 @@ -26,10 +32,14 @@ URL: http://pysmi.sourceforge.net/ Source: https://files.pythonhosted.org/packages/source/p/pysmi/pysmi-%{version}.tar.gz BuildRequires: %{python_module ply} BuildRequires: fdupes -BuildRequires: python-rpm-macros +BuildRequires: python-rpm-macros >= 20210929 Requires: python-ply +%if %{with libalternatives} +Requires: alts +%else Requires(post): update-alternatives Requires(postun): update-alternatives +%endif BuildArch: noarch %python_subpackages @@ -53,6 +63,10 @@ mv %{buildroot}%{_bindir}/mibcopy.py %{buildroot}%{_bindir}/mibcopy %python_clone -a %{buildroot}%{_bindir}/mibcopy %python_expand %fdupes %{buildroot}%{$python_sitelib} +%pre +# If libalternatives is used: Removing old update-alternatives entries. +%python_libalternatives_reset_alternative mibdump + %post %python_install_alternative mibdump From f0489d54561aa1ae4c7950a2dae6bedb7baae3cbea94840c447182586ec97a27 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Wed, 6 Oct 2021 07:36:49 +0000 Subject: [PATCH 4/5] Accepting request 923301 from home:schubi2 - Added BuildRequires: alts OBS-URL: https://build.opensuse.org/request/show/923301 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pysmi?expand=0&rev=22 --- python-pysmi.changes | 5 +++++ python-pysmi.spec | 1 + 2 files changed, 6 insertions(+) diff --git a/python-pysmi.changes b/python-pysmi.changes index c93a426..fca2547 100644 --- a/python-pysmi.changes +++ b/python-pysmi.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Tue Oct 5 15:33:49 UTC 2021 - Stefan Schubert + +- Added BuildRequires: alts + ------------------------------------------------------------------- Thu Sep 30 20:13:20 UTC 2021 - Stefan Schubert diff --git a/python-pysmi.spec b/python-pysmi.spec index 15d1c5e..85c0157 100644 --- a/python-pysmi.spec +++ b/python-pysmi.spec @@ -35,6 +35,7 @@ BuildRequires: fdupes BuildRequires: python-rpm-macros >= 20210929 Requires: python-ply %if %{with libalternatives} +BuildRequires: alts Requires: alts %else Requires(post): update-alternatives From ee9800c4fa880995a377f4748178670e60270590311f852477dcff00b3fe2b1d Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Wed, 6 Oct 2021 07:51:06 +0000 Subject: [PATCH 5/5] - Add multibuild to separate test phase from the build one. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pysmi?expand=0&rev=23 --- _multibuild | 3 +++ python-pysmi.changes | 5 +++++ python-pysmi.spec | 29 +++++++++++++++++++++++------ 3 files changed, 31 insertions(+), 6 deletions(-) create mode 100644 _multibuild diff --git a/_multibuild b/_multibuild new file mode 100644 index 0000000..fcc7b97 --- /dev/null +++ b/_multibuild @@ -0,0 +1,3 @@ + + test + diff --git a/python-pysmi.changes b/python-pysmi.changes index fca2547..089527b 100644 --- a/python-pysmi.changes +++ b/python-pysmi.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Wed Oct 6 07:40:43 UTC 2021 - Matej Cepl + +- Add multibuild to separate test phase from the build one. + ------------------------------------------------------------------- Tue Oct 5 15:33:49 UTC 2021 - Stefan Schubert diff --git a/python-pysmi.spec b/python-pysmi.spec index 85c0157..64473cd 100644 --- a/python-pysmi.spec +++ b/python-pysmi.spec @@ -1,5 +1,5 @@ # -# spec file for package python-pysmi +# spec file # # Copyright (c) 2021 SUSE LLC # @@ -23,7 +23,15 @@ %endif %{?!python_module:%define python_module() python-%{**} python3-%{**}} -Name: python-pysmi +%global flavor @BUILD_FLAVOR@%{nil} +%if "%{flavor}" == "test" +%define psuffix -test +%bcond_without test +%else +%define psuffix %{nil} +%bcond_with test +%endif +Name: python-pysmi%{psuffix} Version: 0.3.4 Release: 0 Summary: SNMP SMI/MIB Parser @@ -33,13 +41,16 @@ Source: https://files.pythonhosted.org/packages/source/p/pysmi/pysmi-%{v BuildRequires: %{python_module ply} BuildRequires: fdupes BuildRequires: python-rpm-macros >= 20210929 +%if %{with test} +BuildRequires: %{python_module pysnmp} +%endif Requires: python-ply %if %{with libalternatives} BuildRequires: alts Requires: alts %else Requires(post): update-alternatives -Requires(postun): update-alternatives +Requires(postun):update-alternatives %endif BuildArch: noarch %python_subpackages @@ -57,13 +68,21 @@ Documentation: http://pysmi.sf.net %python_build %install +%if !%{with test} %python_install mv %{buildroot}%{_bindir}/mibdump.py %{buildroot}%{_bindir}/mibdump mv %{buildroot}%{_bindir}/mibcopy.py %{buildroot}%{_bindir}/mibcopy %python_clone -a %{buildroot}%{_bindir}/mibdump %python_clone -a %{buildroot}%{_bindir}/mibcopy %python_expand %fdupes %{buildroot}%{$python_sitelib} +%endif +%check +%if %{with test} +%pyunittest -v tests +%endif + +%if !%{with test} %pre # If libalternatives is used: Removing old update-alternatives entries. %python_libalternatives_reset_alternative mibdump @@ -74,14 +93,12 @@ mv %{buildroot}%{_bindir}/mibcopy.py %{buildroot}%{_bindir}/mibcopy %postun %python_uninstall_alternative mibdump -#%%check -#nosetests # cannot be run without pysmnp which needs this package - %files %{python_files} %license LICENSE.rst %doc README.md CHANGES.rst %{python_sitelib}/* %python_alternative %{_bindir}/mibdump %python_alternative %{_bindir}/mibcopy +%endif %changelog