From cc7b71dbe0f1be617ccf5b0618db1e01507731ca69af7f500e8923c99405236d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= Date: Fri, 5 Nov 2021 09:57:19 +0000 Subject: [PATCH] Accepting request 923240 from home:schubi2 - Use libalternatives instead of update-alternatives. OBS-URL: https://build.opensuse.org/request/show/923240 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-evtx?expand=0&rev=23 --- python-evtx.changes | 5 +++++ python-evtx.spec | 21 +++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/python-evtx.changes b/python-evtx.changes index bddfd95..86c6776 100644 --- a/python-evtx.changes +++ b/python-evtx.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Tue Oct 5 12:35:19 UTC 2021 - Stefan Schubert + +- Use libalternatives instead of update-alternatives. + ------------------------------------------------------------------- Mon Oct 4 08:29:55 UTC 2021 - Ben Greiner diff --git a/python-evtx.spec b/python-evtx.spec index 01bdee1..bf6a7c2 100644 --- a/python-evtx.spec +++ b/python-evtx.spec @@ -16,6 +16,12 @@ # +%if 0%{?suse_version} > 1500 +%bcond_without libalternatives +%else +%bcond_with libalternatives +%endif + %{?!python_module:%define python_module() python-%{**} python3-%{**}} %define commands dump dump_chunk_slack eid_record_numbers extract_record filter_records info record_structure structure templates %bcond_without python2 @@ -35,14 +41,19 @@ BuildRequires: python2-xml %endif BuildRequires: dos2unix BuildRequires: fdupes -BuildRequires: python-rpm-macros +BuildRequires: python-rpm-macros >= 20210929 Requires: python-hexdump Requires: python-lxml %ifpython2 Requires: python-xml %endif +%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 @@ -74,6 +85,12 @@ done %check %pytest +%pre +# If libalternatives is used: Removing old update-alternatives entries. +%{lua:for c in rpm.expand("%{commands}"):gmatch("%S+") do + print(rpm.expand("%python_libalternatives_reset_alternative evtx_" .. c .. ".py")) +end} + %post %{lua:for c in rpm.expand("%{commands}"):gmatch("%S+") do print(rpm.expand("%python_install_alternative evtx_" .. c .. ".py"))