From a9b0f4a216062c17b75b445c39df51be5e84ea5cf644fb111f5718b83a53bef9 Mon Sep 17 00:00:00 2001 From: Johannes Segitz Date: Thu, 22 Mar 2018 10:58:22 +0000 Subject: [PATCH] Accepting request 590073 from home:jsegitz:branches:libselinux - Updated spec file to use python3. Added python3.patch to fix build OBS-URL: https://build.opensuse.org/request/show/590073 OBS-URL: https://build.opensuse.org/package/show/security:SELinux/libselinux?expand=0&rev=94 --- libselinux-bindings.changes | 6 ++++++ libselinux-bindings.spec | 28 +++++++++++++++++++--------- libselinux.spec | 2 +- python3.patch | 13 +++++++++++++ 4 files changed, 39 insertions(+), 10 deletions(-) create mode 100644 python3.patch diff --git a/libselinux-bindings.changes b/libselinux-bindings.changes index 3674448..e23b0dc 100644 --- a/libselinux-bindings.changes +++ b/libselinux-bindings.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Mar 16 15:25:10 UTC 2018 - jsegitz@suse.com + +- Updated spec file to use python3. Added python3.patch to fix + build + ------------------------------------------------------------------- Fri Nov 24 09:09:02 UTC 2017 - jsegitz@suse.com diff --git a/libselinux-bindings.spec b/libselinux-bindings.spec index 612c00f..29a2990 100644 --- a/libselinux-bindings.spec +++ b/libselinux-bindings.spec @@ -1,7 +1,7 @@ # # spec file for package libselinux-bindings # -# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2018 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,6 +16,8 @@ # +%{?!python_module:%define python_module() python-%{**} python3-%{**}} + %define libsepol_ver 2.6 Name: libselinux-bindings @@ -32,10 +34,12 @@ Source1: selinux-ready Source2: baselibs.conf # PATCH-FIX-UPSTREAM Include for readv prototype Patch4: readv-proto.patch +Patch5: python3.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: libsepol-devel-static >= %{libsepol_ver} BuildRequires: pcre-devel -BuildRequires: python-devel +BuildRequires: python-rpm-macros +BuildRequires: python3-devel BuildRequires: ruby-devel BuildRequires: swig @@ -43,14 +47,19 @@ BuildRequires: swig libselinux provides an interface to get and set process and file security contexts and to obtain security policy decisions. -%package -n python-selinux +%package -n python3-selinux Summary: Python bindings for the SELinux runtime library License: SUSE-Public-Domain Group: Development/Libraries/Python +%define oldpython python +%ifpython2 +Obsoletes: %{oldpython}-selinux < %{version} +Provides: %{oldpython}-selinux = %{version} +%endif Requires: libselinux1 = %{version} -Requires: python +Requires: python3 -%description -n python-selinux +%description -n python3-selinux libselinux provides an interface to get and set process and file security contexts and to obtain security policy decisions. @@ -74,11 +83,12 @@ language. %prep %setup -q -n libselinux-%{version} %patch4 -p1 +%patch5 -p1 %build make %{?_smp_mflags} LIBDIR="%{_libdir}" CFLAGS="$RPM_OPT_FLAGS" -C src make %{?_smp_mflags} LIBDIR="%{_libdir}" CFLAGS="$RPM_OPT_FLAGS" -C src swigify -make %{?_smp_mflags} LIBDIR="%{_libdir}" CFLAGS="$RPM_OPT_FLAGS" -C src pywrap +make %{?_smp_mflags} LIBDIR="%{_libdir}" CFLAGS="$RPM_OPT_FLAGS" PYTHON=/usr/bin/python3 -C src pywrap make %{?_smp_mflags} LIBDIR="%{_libdir}" CFLAGS="$RPM_OPT_FLAGS" -C src rubywrap %install @@ -87,10 +97,10 @@ make DESTDIR="$RPM_BUILD_ROOT" LIBDIR="$RPM_BUILD_ROOT%{_libdir}" SHLIBDIR="$RPM make DESTDIR="$RPM_BUILD_ROOT" LIBDIR="$RPM_BUILD_ROOT%{_libdir}" SHLIBDIR="$RPM_BUILD_ROOT/%{_lib}" -C src install-rubywrap rm -rf $RPM_BUILD_ROOT/%{_lib} $RPM_BUILD_ROOT%{_libdir}/libselinux.* $RPM_BUILD_ROOT%{_libdir}/pkgconfig -%files -n python-selinux +%files -n python3-selinux %defattr(-,root,root,-) -%{py_sitedir}/selinux/ -%{py_sitedir}/_selinux.so +%{python3_sitearch}/selinux/ +%{python3_sitearch}/_selinux.so %files -n ruby-selinux %defattr(-,root,root,-) diff --git a/libselinux.spec b/libselinux.spec index 459890f..08a338e 100644 --- a/libselinux.spec +++ b/libselinux.spec @@ -1,7 +1,7 @@ # # spec file for package libselinux # -# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2018 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 diff --git a/python3.patch b/python3.patch new file mode 100644 index 0000000..ae023b5 --- /dev/null +++ b/python3.patch @@ -0,0 +1,13 @@ +Index: libselinux-2.6/src/Makefile +=================================================================== +--- libselinux-2.6.orig/src/Makefile 2016-10-14 17:31:26.000000000 +0200 ++++ libselinux-2.6/src/Makefile 2018-03-22 11:33:36.527385495 +0100 +@@ -1,7 +1,7 @@ + # Support building the Python bindings multiple times, against various Python + # runtimes (e.g. Python 2 vs Python 3) by optionally prefixing the build + # targets with "PYPREFIX": +-PYTHON ?= python ++PYTHON ?= python3 + PYPREFIX ?= $(notdir $(PYTHON)) + RUBY ?= ruby + RUBYPREFIX ?= $(notdir $(RUBY))