From 8bc935fc0e00c3e3e7a56b28c58be74ab8b7cab9c38102eefe6bdb522efef4cf Mon Sep 17 00:00:00 2001 From: Johannes Segitz Date: Fri, 2 Jun 2023 12:03:50 +0000 Subject: [PATCH] Accepting request 1090487 from home:jsegitz:branches:home:ojkastl_buildservice:branches:security:SELinux - allow building this with different python versions, to make this usable for the new sle15 macro (using python3.11) OBS-URL: https://build.opensuse.org/request/show/1090487 OBS-URL: https://build.opensuse.org/package/show/security:SELinux/libselinux?expand=0&rev=154 --- libselinux-bindings.changes | 6 ++++++ libselinux-bindings.spec | 33 ++++++++++++++++++++++++++++----- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/libselinux-bindings.changes b/libselinux-bindings.changes index 52b6d28..b782141 100644 --- a/libselinux-bindings.changes +++ b/libselinux-bindings.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Jun 1 11:50:33 UTC 2023 - Johannes Kastl + +- allow building this with different python versions, to make this + usable for the new sle15 macro (using python3.11) + ------------------------------------------------------------------- Fri May 5 12:35:31 UTC 2023 - Daniel Garcia diff --git a/libselinux-bindings.spec b/libselinux-bindings.spec index eb12ea1..1264296 100644 --- a/libselinux-bindings.spec +++ b/libselinux-bindings.spec @@ -16,7 +16,30 @@ # -%{?!python_module:%define python_module() python-%{**} python3-%{**}} +%{?sle15_python_module_pythons} +%if 0%{?suse_version} < 1699 +# Leap15, SLES15 +# have some safe defaults +%define python_subpackage_name python3-libselinux +%define python_base_requirement python3 +%if "%pythons" == "python36" +%define python_subpackage_name python36-libselinux +%define python_base_requirement python36 +%endif +%if "%pythons" == "python310" +%define python_subpackage_name python310-libselinux +%define python_base_requirement python310 +%endif +%if "%pythons" == "python311" +%define python_subpackage_name python311-libselinux +%define python_base_requirement python311 +%endif +%else +# Tumbleweed +%define python_subpackage_name python3-libselinux +%define python_base_requirement python3 +%endif + %define libsepol_ver 3.5 Name: libselinux-bindings Version: 3.5 @@ -50,18 +73,18 @@ BuildRequires: pkgconfig(libpcre2-8) libselinux provides an interface to get and set process and file security contexts and to obtain security policy decisions. -%package -n python3-selinux +%package -n %{python_subpackage_name} %define oldpython python Summary: Python bindings for the SELinux runtime library Group: Development/Libraries/Python +Requires: %{python_base_requirement} Requires: libselinux1 = %{version} -Requires: python3 %ifpython2 Obsoletes: %{oldpython}-selinux < %{version} Provides: %{oldpython}-selinux = %{version} %endif -%description -n python3-selinux +%description -n %{python_subpackage_name} libselinux provides an interface to get and set process and file security contexts and to obtain security policy decisions. @@ -95,7 +118,7 @@ make DESTDIR=%{buildroot} LIBDIR="%{_libdir}" SHLIBDIR="/%{_lib}" LIBSEPOLA=%{_l make DESTDIR=%{buildroot} LIBDIR="%{_libdir}" SHLIBDIR="/%{_lib}" LIBSEPOLA=%{_libdir}/libsepol.a install-rubywrap V=1 rm -rf %{buildroot}/%{_lib} %{buildroot}%{_libdir}/libselinux.* %{buildroot}%{_libdir}/pkgconfig -%files -n python3-selinux +%files -n %{python_subpackage_name} %{python3_sitearch}/*selinux* %files -n ruby-selinux