From d508bb19b875246a0b9f9510be47c8239df1fb48 Mon Sep 17 00:00:00 2001 From: wei dong Date: Thu, 13 May 2021 13:42:21 +0800 Subject: [PATCH] Fix import error in python2-selinux (cherry picked from commit e964d6af6520351beb6393d0f632a9bd3b9761e8) --- Fix-import-error-in-python2-package.patch | 29 +++++++++++++++++++++++ libselinux.spec | 10 +++++--- 2 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 Fix-import-error-in-python2-package.patch diff --git a/Fix-import-error-in-python2-package.patch b/Fix-import-error-in-python2-package.patch new file mode 100644 index 0000000..66f49fc --- /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 ccbb9bf..2cf1caf 100644 --- a/libselinux.spec +++ b/libselinux.spec @@ -3,11 +3,12 @@ Name: libselinux Version: 3.1 -Release: 1 +Release: 2 License: Public Domain Summary: SELinux library and simple utilities Url: https://github.com/SELinuxProject/selinux/wiki 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: python2-devel ruby-devel libsepol-static >= %{libsepol_version} @@ -88,7 +89,7 @@ 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}"\ +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}" \ @@ -125,7 +126,7 @@ mv %{buildroot}%{_sbindir}/getconlist %{buildroot}%{_sbindir}/selinuxconlist %files -n python2-libselinux %{python2_sitearch}/selinux/ %{python2_sitearch}/selinux-%{version}-* -%{python2_sitearch}/_selinux +%{python2_sitearch}/_selinux*.so %files -n python3-libselinux %{python3_sitearch}/selinux/ @@ -143,6 +144,9 @@ mv %{buildroot}%{_sbindir}/getconlist %{buildroot}%{_sbindir}/selinuxconlist %{_mandir}/ru/man8/* %changelog +* Thu May 13 2021 weidong - 3.1-2 +- Fix import error in python2-selinux + * Tue Aug 18 2020 gaoyusong - 3.1-1 - libselinux Update to 3.1 -- Gitee