From 8af179d5d84d3d2c4186f7542ead80ff813a93477fa2a039eaeea2b755d7dbae Mon Sep 17 00:00:00 2001 From: Johannes Segitz Date: Fri, 6 Nov 2020 10:40:07 +0000 Subject: [PATCH] Accepting request 845832 from home:mcepl:branches:security:SELinux OBS-URL: https://build.opensuse.org/request/show/845832 OBS-URL: https://build.opensuse.org/package/show/security:SELinux/setools?expand=0&rev=77 --- setools.changes | 6 ++++++ setools.spec | 37 +++++++++++++++++++++++-------------- 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/setools.changes b/setools.changes index a45651f..1ad0794 100644 --- a/setools.changes +++ b/setools.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Nov 3 17:56:44 UTC 2020 - Benjamin Greiner + +- Stay on a single python3 flavor even if there are more than one + gh#openSUSE/python-rpm-macros#73 + ------------------------------------------------------------------- Wed Oct 21 07:29:51 UTC 2020 - Thorsten Kukuk diff --git a/setools.spec b/setools.spec index 262a16e..892d9e4 100644 --- a/setools.spec +++ b/setools.spec @@ -17,6 +17,12 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} +# As soon as python38 is introduced as flavor, we need this: +%{?!python3_primary_provider:%define python3_primary_provider %{lua: \ +l,c = posix.readlink("/usr/bin/python3") \ +flavor = l:gsub("%.", ""):sub(0,-1) \ +print(rpm.expand("%{?" .. flavor .. "_prefix}%{!?" .. flavor .. "_prefix:python3}")) \ +}} # doesn't work for python 2 %define skip_python2 1 @@ -29,13 +35,13 @@ Summary: Policy analysis tools for SELinux License: GPL-2.0-only Group: System/Management Source: https://github.com/SELinuxProject/setools/releases/download/%{version}/setools-%{version}.tar.bz2 -BuildRequires: %{python_module Cython} -BuildRequires: %{python_module devel} -BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: libselinux-devel BuildRequires: libsepol-devel BuildRequires: python-rpm-macros +BuildRequires: python3-Cython +BuildRequires: python3-devel +BuildRequires: python3-setuptools Requires: setools-console = %{version}-%{release} Requires: setools-gui = %{version}-%{release} @@ -64,16 +70,20 @@ This package includes the following console tools: seinfoflow Information flow analysis tool sediff Semantic policy difference tool -%package -n python3-setools +%package -n %{python3_primary_provider}-setools Summary: Python bindings for SELinux policy analysis License: LGPL-2.0-only Group: Development/Languages/Python Requires: python Requires: python3-networkx -Obsoletes: python-setools < %{version} +Obsoletes: python-setools < %{version}-%{release} Provides: python-setools = %{version}-%{release} +%if "%{python3_primary_provider}" != "python3" +Obsoletes: python3-setools < %{version}-%{release} +Provides: python3-setools = %{version}-%{release} +%endif -%description -n python3-setools +%description -n %{python3_primary_provider}-setools SETools is a collection of graphical tools, command-line tools, and libraries designed to facilitate SELinux policy analysis. @@ -97,17 +107,16 @@ This package includes the following graphical tools: %setup -q -n %{name} %build -%python_build +%{expand:%%%{python3_primary_provider}_build} %install -%python_install -%fdupes -s %{buildroot}%{python3_sitearch} +%{expand:%%%{python3_primary_provider}_install} +%fdupes -s %{buildroot}%{expand:%%%{python3_primary_provider}_sitearch} -%files -n python3-setools +%files -n %{python3_primary_provider}-setools %defattr(-,root,root,-) -%dir %{python3_sitearch}/setools/ -%{python3_sitearch}/setools/* -%{python3_sitearch}/setools*egg-info* +%{expand:%%%{python3_primary_provider}_sitearch}/setools +%{expand:%%%{python3_primary_provider}_sitearch}/setools-%{version}*-info %files console %defattr(-,root,root,-) @@ -130,7 +139,7 @@ This package includes the following graphical tools: %files gui %defattr(-,root,root,-) -%{python3_sitearch}/setoolsgui* +%{expand:%%%{python3_primary_provider}_sitearch}/setoolsgui %{_bindir}/apol %{_mandir}/man1/apol.1.gz