From b452f8c085de7afc0595186c583165fdbbed8c3d Mon Sep 17 00:00:00 2001 From: Yi Zhao Date: Sun, 28 Aug 2022 10:29:22 +0800 Subject: libselinux-python: upgrade 3.3 -> 3.4 * Use libpcre2 instead of libpcre. * Refresh patches. Signed-off-by: Yi Zhao Signed-off-by: Joe MacDonald --- recipes-security/selinux/libselinux-python_3.3.bb | 50 --------------------- recipes-security/selinux/libselinux-python_3.4.bb | 51 +++++++++++++++++++++ ...PYCEXT-and-rely-on-the-installed-file-nam.patch | 52 ---------------------- ...x-python-modules-install-path-for-multili.patch | 8 ++-- ...PYCEXT-and-rely-on-the-installed-file-nam.patch | 52 ++++++++++++++++++++++ 5 files changed, 107 insertions(+), 106 deletions(-) delete mode 100644 recipes-security/selinux/libselinux-python_3.3.bb create mode 100644 recipes-security/selinux/libselinux-python_3.4.bb delete mode 100644 recipes-security/selinux/libselinux/0001-Do-not-use-PYCEXT-and-rely-on-the-installed-file-nam.patch create mode 100644 recipes-security/selinux/libselinux/0002-Do-not-use-PYCEXT-and-rely-on-the-installed-file-nam.patch diff --git a/recipes-security/selinux/libselinux-python_3.3.bb b/recipes-security/selinux/libselinux-python_3.3.bb deleted file mode 100644 index 136f538..0000000 --- a/recipes-security/selinux/libselinux-python_3.3.bb +++ /dev/null @@ -1,50 +0,0 @@ -SUMMARY = "SELinux library and simple utilities" -DESCRIPTION = "libselinux provides an API for SELinux applications to get and set \ -process and file security contexts and to obtain security policy \ -decisions. Required for any applications that use the SELinux API." -SECTION = "base" -LICENSE = "PD" -LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=84b4d2c6ef954a2d4081e775a270d0d0" - -require selinux_common.inc - -inherit python3native python3targetconfig pkgconfig - -FILESEXTRAPATHS:prepend := "${THISDIR}/libselinux:" -SRC_URI += "\ - file://0001-Makefile-fix-python-modules-install-path-for-multili.patch \ - file://0001-Do-not-use-PYCEXT-and-rely-on-the-installed-file-nam.patch \ - " - -S = "${WORKDIR}/git/libselinux" - -DEPENDS += "python3 swig-native libpcre libsepol" -RDEPENDS:${PN} += "libselinux python3-core python3-shell" - -def get_policyconfigarch(d): - import re - target = d.getVar('TARGET_ARCH') - p = re.compile('i.86') - target = p.sub('i386',target) - return "ARCH=%s" % (target) - -EXTRA_OEMAKE += "${@get_policyconfigarch(d)}" -EXTRA_OEMAKE += "LDFLAGS='${LDFLAGS} -lpcre' LIBSEPOLA='${STAGING_LIBDIR}/libsepol.a'" -EXTRA_OEMAKE:append:libc-musl = " FTS_LDLIBS=-lfts" - -FILES:${PN} = "${libdir}/python${PYTHON_BASEVERSION}/site-packages/*" -INSANE_SKIP:${PN} = "dev-so" - -do_compile() { - oe_runmake pywrap -j1 \ - PYLIBVER='python${PYTHON_BASEVERSION}${PYTHON_ABI}' \ - PYINC='-I${STAGING_INCDIR}/${PYLIBVER}' \ - PYLIBS='-L${STAGING_LIBDIR}/${PYLIBVER} -l${PYLIBVER}' -} - -do_install() { - oe_runmake install-pywrap \ - DESTDIR=${D} \ - PYLIBVER='python${PYTHON_BASEVERSION}${PYTHON_ABI}' \ - PYTHONLIBDIR='${libdir}/python${PYTHON_BASEVERSION}/site-packages' -} diff --git a/recipes-security/selinux/libselinux-python_3.4.bb b/recipes-security/selinux/libselinux-python_3.4.bb new file mode 100644 index 0000000..a850369 --- /dev/null +++ b/recipes-security/selinux/libselinux-python_3.4.bb @@ -0,0 +1,51 @@ +SUMMARY = "SELinux library and simple utilities" +DESCRIPTION = "libselinux provides an API for SELinux applications to get and set \ +process and file security contexts and to obtain security policy \ +decisions. Required for any applications that use the SELinux API." +SECTION = "base" +LICENSE = "PD" +LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=84b4d2c6ef954a2d4081e775a270d0d0" + +require selinux_common.inc + +inherit python3targetconfig pkgconfig + +FILESEXTRAPATHS:prepend := "${THISDIR}/libselinux:" +SRC_URI += "\ + file://0001-Makefile-fix-python-modules-install-path-for-multili.patch \ + file://0002-Do-not-use-PYCEXT-and-rely-on-the-installed-file-nam.patch \ + " + +S = "${WORKDIR}/git/libselinux" + +DEPENDS = "libsepol libpcre2 swig-native" +DEPENDS:append:libc-musl = " fts" + +RDEPENDS:${PN} = "libselinux python3-core python3-shell" + +def get_policyconfigarch(d): + import re + target = d.getVar('TARGET_ARCH') + p = re.compile('i.86') + target = p.sub('i386',target) + return "ARCH=%s" % (target) + +EXTRA_OEMAKE = "${@get_policyconfigarch(d)}" +EXTRA_OEMAKE:append:libc-musl = " FTS_LDLIBS=-lfts" + +FILES:${PN} = "${libdir}/python${PYTHON_BASEVERSION}/site-packages/*" +INSANE_SKIP:${PN} = "dev-so" + +do_compile() { + oe_runmake pywrap -j1 \ + PYLIBVER='python${PYTHON_BASEVERSION}${PYTHON_ABI}' \ + PYINC='-I${STAGING_INCDIR}/${PYLIBVER}' \ + PYLIBS='-L${STAGING_LIBDIR}/${PYLIBVER} -l${PYLIBVER}' +} + +do_install() { + oe_runmake install-pywrap \ + DESTDIR=${D} \ + PYLIBVER='python${PYTHON_BASEVERSION}${PYTHON_ABI}' \ + PYTHONLIBDIR='${libdir}/python${PYTHON_BASEVERSION}/site-packages' +} diff --git a/recipes-security/selinux/libselinux/0001-Do-not-use-PYCEXT-and-rely-on-the-installed-file-nam.patch b/recipes-security/selinux/libselinux/0001-Do-not-use-PYCEXT-and-rely-on-the-installed-file-nam.patch deleted file mode 100644 index 0fafcef..0000000 --- a/recipes-security/selinux/libselinux/0001-Do-not-use-PYCEXT-and-rely-on-the-installed-file-nam.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 1542c79660484a2f2e24ee0593586dba35c3ad13 Mon Sep 17 00:00:00 2001 -From: Thomas Petazzoni -Date: Fri, 25 Oct 2019 13:37:14 +0200 -Subject: [PATCH] Do not use PYCEXT, and rely on the installed file name - -PYCEXT is computed by asking the Python intrepreter what is the -file extension used for native Python modules. - -Unfortunately, when cross-compiling, the host Python doesn't give the -proper result: it gives the result matching the build machine, and not -the target machine. Due to this, the symlink has an incorrect name, -and doesn't point to the .so file that was actually built/installed. - -To address this and keep things simple, this patch just changes the ln -invocation to rely on the name of the _selinux*.so Python module that -was installed. - -[Upstream: https://github.com/SELinuxProject/selinux/pull/184] -Signed-off-by: Thomas Petazzoni - -Upstream-Status: Denied [https://patchwork.kernel.org/patch/11212405/] - -[Refreshed for 3.0] -Signed-off-by: Changqing Li ---- - src/Makefile | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/src/Makefile b/src/Makefile -index dcdeb10..da6f719 100644 ---- a/src/Makefile -+++ b/src/Makefile -@@ -15,7 +15,6 @@ 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])') - 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"]') -@@ -176,7 +175,7 @@ install: all - install-pywrap: pywrap - $(PYTHON) setup.py install --prefix=$(PREFIX) --root=$(DESTDIR) --install-lib=$(PYTHONLIBDIR) $(PYTHON_SETUP_ARGS) - install -m 644 $(SWIGPYOUT) $(DESTDIR)$(PYTHONLIBDIR)/selinux/__init__.py -- ln -sf --relative $(DESTDIR)$(PYTHONLIBDIR)/selinux/_selinux$(PYCEXT) $(DESTDIR)$(PYTHONLIBDIR)/_selinux$(PYCEXT) -+ ln -sf --relative $(DESTDIR)$(PYTHONLIBDIR)/selinux/_selinux*.so $(DESTDIR)$(PYTHONLIBDIR)/ - - install-rubywrap: rubywrap - test -d $(DESTDIR)$(RUBYINSTALL) || install -m 755 -d $(DESTDIR)$(RUBYINSTALL) --- -2.17.1 - diff --git a/recipes-security/selinux/libselinux/0001-Makefile-fix-python-modules-install-path-for-multili.patch b/recipes-security/selinux/libselinux/0001-Makefile-fix-python-modules-install-path-for-multili.patch index 9dfd8d4..9750cd6 100644 --- a/recipes-security/selinux/libselinux/0001-Makefile-fix-python-modules-install-path-for-multili.patch +++ b/recipes-security/selinux/libselinux/0001-Makefile-fix-python-modules-install-path-for-multili.patch @@ -1,4 +1,4 @@ -From 41540f5c4e3552a2806097613f016d1a2fd4754a Mon Sep 17 00:00:00 2001 +From 1ff60a36bb0bfc95ce33cf950f58e121548a3c8a Mon Sep 17 00:00:00 2001 From: Yi Zhao Date: Mon, 13 Apr 2020 12:44:23 +0800 Subject: [PATCH] Makefile: fix python modules install path for multilib @@ -11,10 +11,10 @@ Signed-off-by: Yi Zhao 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile b/src/Makefile -index 190016e..dcdeb10 100644 +index 04bf4f2..81ae6a2 100644 --- a/src/Makefile +++ b/src/Makefile -@@ -174,7 +174,7 @@ install: all +@@ -181,7 +181,7 @@ install: all ln -sf --relative $(DESTDIR)$(SHLIBDIR)/$(LIBSO) $(DESTDIR)$(LIBDIR)/$(TARGET) install-pywrap: pywrap @@ -24,5 +24,5 @@ index 190016e..dcdeb10 100644 ln -sf --relative $(DESTDIR)$(PYTHONLIBDIR)/selinux/_selinux$(PYCEXT) $(DESTDIR)$(PYTHONLIBDIR)/_selinux$(PYCEXT) -- -2.17.1 +2.25.1 diff --git a/recipes-security/selinux/libselinux/0002-Do-not-use-PYCEXT-and-rely-on-the-installed-file-nam.patch b/recipes-security/selinux/libselinux/0002-Do-not-use-PYCEXT-and-rely-on-the-installed-file-nam.patch new file mode 100644 index 0000000..db7d68f --- /dev/null +++ b/recipes-security/selinux/libselinux/0002-Do-not-use-PYCEXT-and-rely-on-the-installed-file-nam.patch @@ -0,0 +1,52 @@ +From dae53d7cd4d7875f7fb7aba016a0331559044eea Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Fri, 25 Oct 2019 13:37:14 +0200 +Subject: [PATCH] Do not use PYCEXT, and rely on the installed file name + +PYCEXT is computed by asking the Python intrepreter what is the +file extension used for native Python modules. + +Unfortunately, when cross-compiling, the host Python doesn't give the +proper result: it gives the result matching the build machine, and not +the target machine. Due to this, the symlink has an incorrect name, +and doesn't point to the .so file that was actually built/installed. + +To address this and keep things simple, this patch just changes the ln +invocation to rely on the name of the _selinux*.so Python module that +was installed. + +[Upstream: https://github.com/SELinuxProject/selinux/pull/184] +Signed-off-by: Thomas Petazzoni + +Upstream-Status: Denied [https://patchwork.kernel.org/patch/11212405/] + +[Refreshed for 3.0] +Signed-off-by: Changqing Li +--- + src/Makefile | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/src/Makefile b/src/Makefile +index 81ae6a2..37399e1 100644 +--- a/src/Makefile ++++ b/src/Makefile +@@ -15,7 +15,6 @@ 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])') + 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"]') +@@ -183,7 +182,7 @@ install: all + install-pywrap: pywrap + $(PYTHON) setup.py install --prefix=$(PREFIX) --root=$(DESTDIR) --install-lib=$(PYTHONLIBDIR) $(PYTHON_SETUP_ARGS) + install -m 644 $(SWIGPYOUT) $(DESTDIR)$(PYTHONLIBDIR)/selinux/__init__.py +- ln -sf --relative $(DESTDIR)$(PYTHONLIBDIR)/selinux/_selinux$(PYCEXT) $(DESTDIR)$(PYTHONLIBDIR)/_selinux$(PYCEXT) ++ ln -sf --relative $(DESTDIR)$(PYTHONLIBDIR)/selinux/_selinux*.so $(DESTDIR)$(PYTHONLIBDIR)/ + + install-rubywrap: rubywrap + test -d $(DESTDIR)$(RUBYINSTALL) || install -m 755 -d $(DESTDIR)$(RUBYINSTALL) +-- +2.25.1 + -- cgit v1.2.3-54-g00ecf