diff --git a/Fix-import-error-in-python2-package.patch b/Fix-import-error-in-python2-package.patch new file mode 100644 index 0000000000000000000000000000000000000000..66f49fc08185a403971e27e5b03e9171e5c9aeb3 --- /dev/null +++ b/Fix-import-error-in-python2-package.patch @@ -0,0 +1,29 @@ +From 2712100eaed081a454f5eff88dc6fae74ecb1aef Mon Sep 17 00:00:00 2001 +From: wei dong +Date: Thu, 13 May 2021 16:43:20 +0800 +Subject: [PATCH] Fix import error in python2 package + +--- + src/Makefile | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/src/Makefile b/src/Makefile +index 190016e..5e7baa9 100644 +--- a/src/Makefile ++++ b/src/Makefile +@@ -15,7 +15,11 @@ INCLUDEDIR ?= $(PREFIX)/include + PYINC ?= $(shell $(PKG_CONFIG) --cflags $(PYPREFIX)) + PYLIBS ?= $(shell $(PKG_CONFIG) --libs $(PYPREFIX)) + PYTHONLIBDIR ?= $(shell $(PYTHON) -c "from distutils.sysconfig import *; print(get_python_lib(plat_specific=1, prefix='$(PREFIX)'))") +-PYCEXT ?= $(shell $(PYTHON) -c 'import importlib.machinery;print(importlib.machinery.EXTENSION_SUFFIXES[0])') ++ifeq ($(shell $(PYTHON) -c 'import sys;print(sys.version_info[0])'), 3) ++ PYCEXT ?= $(shell $(PYTHON) -c 'import importlib.machinery;print(importlib.machinery.EXTENSION_SUFFIXES[0])') ++else ++ PYCEXT ?= .so ++endif + RUBYINC ?= $(shell $(RUBY) -e 'puts "-I" + RbConfig::CONFIG["rubyarchhdrdir"] + " -I" + RbConfig::CONFIG["rubyhdrdir"]') + RUBYLIBS ?= $(shell $(RUBY) -e 'puts "-L" + RbConfig::CONFIG["libdir"] + " -L" + RbConfig::CONFIG["archlibdir"] + " " + RbConfig::CONFIG["LIBRUBYARG_SHARED"]') + RUBYINSTALL ?= $(shell $(RUBY) -e 'puts RbConfig::CONFIG["vendorarchdir"]') +-- +2.27.0 + diff --git a/libselinux.spec b/libselinux.spec index 0dd180d3f1464564aa018a5cbd99c4a895c037b5..c67c4e9df85c2a6537d079309fc38babba501300 100644 --- a/libselinux.spec +++ b/libselinux.spec @@ -7,9 +7,8 @@ Release: 2 License: Public Domain Summary: SELinux library and simple utilities Url: https://github.com/SELinuxProject/selinux/wiki -Source0: https://github.com/SELinuxProject/selinux/releases/download/20200710/libselinux-3.1.tar.gz - -#Patch0: libselinux-Use-Python-distutils-to-install-SELinux-p.patch +Source0: https://raw.githubusercontent.com/wiki/SELinuxProject/selinux/files/releases/20180524/libselinux-3.1.tar.gz +Patch0: Fix-import-error-in-python2-package.patch BuildRequires: gcc python3-devel systemd swig pcre2-devel xz-devel BuildRequires: ruby-devel libsepol-static @@ -81,6 +80,9 @@ mkdir -p %{buildroot}%{_sbindir} install -d -m 0755 %{buildroot}%{_rundir}/setrans echo "d %{_rundir}/setrans 0755 root root" > %{buildroot}%{_tmpfilesdir}/libselinux.conf +make PYTHON=%{__python2} DESTDIR="%{buildroot}" LIBDIR="%{_libdir}" \ +SHLIBDIR="%{_lib}" BINDIR="%{_bindir}" SBINDIR="%{_sbindir}" LIBSEPOLA="%{_libdir}/libsepol.a" install-pywrap + make PYTHON=%{__python3} DESTDIR="%{buildroot}" LIBDIR="%{_libdir}" \ SHLIBDIR="%{_lib}" BINDIR="%{_bindir}" SBINDIR="%{_sbindir}" LIBSEPOLA="%{_libdir}/libsepol.a" install-pywrap @@ -112,6 +114,11 @@ mv %{buildroot}%{_sbindir}/getconlist %{buildroot}%{_sbindir}/selinuxconlist %{_libdir}/pkgconfig/libselinux.pc %{_includedir}/selinux/ +%files -n python2-libselinux +%{python2_sitearch}/selinux/ +%{python2_sitearch}/selinux-%{version}-* +%{python2_sitearch}/_selinux*.so + %files -n python3-libselinux %{python3_sitearch}/selinux/ %{python3_sitearch}/selinux-%{version}-* @@ -128,14 +135,11 @@ mv %{buildroot}%{_sbindir}/getconlist %{buildroot}%{_sbindir}/selinuxconlist %{_mandir}/ru/man8/* %changelog -* Tue Oct 27 2020 gaoyusong - 3.1-2 -- delete BuildRequires python2-devel - -* Fri Jul 17 2020 openEuler Buildteam - 3.1-1 -- update to 3.1; delete python2-libselinux +* Thu May 13 2021 weidong - 3.1-2 +- Fix import error in python2-selinux -* Tue Jun 23 2020 openEuler Buildteam - 2.9-3 -- add missing _selniux.so +* Tue Aug 18 2020 gaoyusong - 3.1-1 +- libselinux Update to 3.1 * Mon Jun 22 2020 openEuler Buildteam - 2.9-2 - use python distutils to install selinux python bindings