!12 [sync] PR-9: Fix import error in python2 package

From: @openeuler-sync-bot
Reviewed-by: @zhujianwei001
Signed-off-by: @zhujianwei001
This commit is contained in:
openeuler-ci-bot 2021-06-02 15:37:17 +08:00 committed by Gitee
commit c214346bb9
2 changed files with 36 additions and 3 deletions

View File

@ -0,0 +1,29 @@
From 2712100eaed081a454f5eff88dc6fae74ecb1aef Mon Sep 17 00:00:00 2001
From: wei dong <weidong@uniontech.com>
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

View File

@ -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<weidong@uniontech.com> - 3.1-2
- Fix import error in python2-selinux
* Tue Aug 18 2020 gaoyusong<gaoyusong1@huawei.com> - 3.1-1
- libselinux Update to 3.1