kumquat-buildroot/package/libselinux/0002-Do-not-use-PYCEXT-and-rely-on-the-installed-file-nam.patch

51 lines
2.5 KiB
Diff
Raw Normal View History

From c26495025ab1a2597e5433b67a3bf793d3ce1e08 Mon Sep 17 00:00:00 2001
package/libselinux: fix the build with Python 3.8 Following the switch to Python 3.8, the libselinux Python extension started to fail building. This is fixed by upstream commit 2efa06857575e4118e91ca250b6b92da68b130d5, which we backport as 0003-libselinux-Use-Python-distutils-to-install-SELinux-p.patch. This patch has the nice merit of switching to using distutils to build the Python extension of libselinux, instead of some custom logic. This allows to significantly simplify our libselinux.mk: we can rely on PKG_PYTHON_DISTUTILS_ENV and HOST_PKG_PYTHON_DISTUTILS_ENV instead of lots of custom variables. However, upstream commit 2efa06857575e4118e91ca250b6b92da68b130d5 had its own issues: * Hardcode of -I $(DESTDIR)/$(INCLUDEDIR) -L $(DESTDIR)/$(LIBDIR) at build time, while DESTDIR is normally empty at build time, causing bogus -I /usr/include -L /usr/lib to be used This is fixed in 0004-src-Makefile-don-t-pass-bogus-I-and-L-to-python-setu.patch * New usage of ln --relative, which is not supported in older distributions. This is fixed in 0005-Remove-ln-relative-usage-in-install-pywrap.patch * Usage of the host Python "imp" module to query the extension used for native Python module, but that returns an incorrect result when cross-compiling. We chose to simplify the code to not have to query for this information. This is fixed in 0006-Do-not-use-PYCEXT-and-rely-on-the-installed-file-nam.patch With this patch, the libselinux Python module was built-tested with Python 2 and Python 3, and run-time tested as well in both configurations, for both the target and host variants of libselinux. Fixes: http://autobuild.buildroot.net/results/aeb58de7ad674b980258e6ed30c7da3949a04452/ Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2019-10-25 15:27:31 +02:00
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
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.
Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
[Refreshed for 3.1]
package/libselinux: fix the build with Python 3.8 Following the switch to Python 3.8, the libselinux Python extension started to fail building. This is fixed by upstream commit 2efa06857575e4118e91ca250b6b92da68b130d5, which we backport as 0003-libselinux-Use-Python-distutils-to-install-SELinux-p.patch. This patch has the nice merit of switching to using distutils to build the Python extension of libselinux, instead of some custom logic. This allows to significantly simplify our libselinux.mk: we can rely on PKG_PYTHON_DISTUTILS_ENV and HOST_PKG_PYTHON_DISTUTILS_ENV instead of lots of custom variables. However, upstream commit 2efa06857575e4118e91ca250b6b92da68b130d5 had its own issues: * Hardcode of -I $(DESTDIR)/$(INCLUDEDIR) -L $(DESTDIR)/$(LIBDIR) at build time, while DESTDIR is normally empty at build time, causing bogus -I /usr/include -L /usr/lib to be used This is fixed in 0004-src-Makefile-don-t-pass-bogus-I-and-L-to-python-setu.patch * New usage of ln --relative, which is not supported in older distributions. This is fixed in 0005-Remove-ln-relative-usage-in-install-pywrap.patch * Usage of the host Python "imp" module to query the extension used for native Python module, but that returns an incorrect result when cross-compiling. We chose to simplify the code to not have to query for this information. This is fixed in 0006-Do-not-use-PYCEXT-and-rely-on-the-installed-file-nam.patch With this patch, the libselinux Python module was built-tested with Python 2 and Python 3, and run-time tested as well in both configurations, for both the target and host variants of libselinux. Fixes: http://autobuild.buildroot.net/results/aeb58de7ad674b980258e6ed30c7da3949a04452/ Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2019-10-25 15:27:31 +02:00
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
[Refreshed for 3.0]
Signed-off-by: Adam Duskett <Aduskett@gmail.com>
package/libselinux: fix the build with Python 3.8 Following the switch to Python 3.8, the libselinux Python extension started to fail building. This is fixed by upstream commit 2efa06857575e4118e91ca250b6b92da68b130d5, which we backport as 0003-libselinux-Use-Python-distutils-to-install-SELinux-p.patch. This patch has the nice merit of switching to using distutils to build the Python extension of libselinux, instead of some custom logic. This allows to significantly simplify our libselinux.mk: we can rely on PKG_PYTHON_DISTUTILS_ENV and HOST_PKG_PYTHON_DISTUTILS_ENV instead of lots of custom variables. However, upstream commit 2efa06857575e4118e91ca250b6b92da68b130d5 had its own issues: * Hardcode of -I $(DESTDIR)/$(INCLUDEDIR) -L $(DESTDIR)/$(LIBDIR) at build time, while DESTDIR is normally empty at build time, causing bogus -I /usr/include -L /usr/lib to be used This is fixed in 0004-src-Makefile-don-t-pass-bogus-I-and-L-to-python-setu.patch * New usage of ln --relative, which is not supported in older distributions. This is fixed in 0005-Remove-ln-relative-usage-in-install-pywrap.patch * Usage of the host Python "imp" module to query the extension used for native Python module, but that returns an incorrect result when cross-compiling. We chose to simplify the code to not have to query for this information. This is fixed in 0006-Do-not-use-PYCEXT-and-rely-on-the-installed-file-nam.patch With this patch, the libselinux Python module was built-tested with Python 2 and Python 3, and run-time tested as well in both configurations, for both the target and host variants of libselinux. Fixes: http://autobuild.buildroot.net/results/aeb58de7ad674b980258e6ed30c7da3949a04452/ Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2019-10-25 15:27:31 +02:00
---
src/Makefile | 3 +--
package/libselinux: fix the build with Python 3.8 Following the switch to Python 3.8, the libselinux Python extension started to fail building. This is fixed by upstream commit 2efa06857575e4118e91ca250b6b92da68b130d5, which we backport as 0003-libselinux-Use-Python-distutils-to-install-SELinux-p.patch. This patch has the nice merit of switching to using distutils to build the Python extension of libselinux, instead of some custom logic. This allows to significantly simplify our libselinux.mk: we can rely on PKG_PYTHON_DISTUTILS_ENV and HOST_PKG_PYTHON_DISTUTILS_ENV instead of lots of custom variables. However, upstream commit 2efa06857575e4118e91ca250b6b92da68b130d5 had its own issues: * Hardcode of -I $(DESTDIR)/$(INCLUDEDIR) -L $(DESTDIR)/$(LIBDIR) at build time, while DESTDIR is normally empty at build time, causing bogus -I /usr/include -L /usr/lib to be used This is fixed in 0004-src-Makefile-don-t-pass-bogus-I-and-L-to-python-setu.patch * New usage of ln --relative, which is not supported in older distributions. This is fixed in 0005-Remove-ln-relative-usage-in-install-pywrap.patch * Usage of the host Python "imp" module to query the extension used for native Python module, but that returns an incorrect result when cross-compiling. We chose to simplify the code to not have to query for this information. This is fixed in 0006-Do-not-use-PYCEXT-and-rely-on-the-installed-file-nam.patch With this patch, the libselinux Python module was built-tested with Python 2 and Python 3, and run-time tested as well in both configurations, for both the target and host variants of libselinux. Fixes: http://autobuild.buildroot.net/results/aeb58de7ad674b980258e6ed30c7da3949a04452/ Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2019-10-25 15:27:31 +02:00
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/Makefile b/src/Makefile
index 190016e2af34..7ee22fd35da3 100644
package/libselinux: fix the build with Python 3.8 Following the switch to Python 3.8, the libselinux Python extension started to fail building. This is fixed by upstream commit 2efa06857575e4118e91ca250b6b92da68b130d5, which we backport as 0003-libselinux-Use-Python-distutils-to-install-SELinux-p.patch. This patch has the nice merit of switching to using distutils to build the Python extension of libselinux, instead of some custom logic. This allows to significantly simplify our libselinux.mk: we can rely on PKG_PYTHON_DISTUTILS_ENV and HOST_PKG_PYTHON_DISTUTILS_ENV instead of lots of custom variables. However, upstream commit 2efa06857575e4118e91ca250b6b92da68b130d5 had its own issues: * Hardcode of -I $(DESTDIR)/$(INCLUDEDIR) -L $(DESTDIR)/$(LIBDIR) at build time, while DESTDIR is normally empty at build time, causing bogus -I /usr/include -L /usr/lib to be used This is fixed in 0004-src-Makefile-don-t-pass-bogus-I-and-L-to-python-setu.patch * New usage of ln --relative, which is not supported in older distributions. This is fixed in 0005-Remove-ln-relative-usage-in-install-pywrap.patch * Usage of the host Python "imp" module to query the extension used for native Python module, but that returns an incorrect result when cross-compiling. We chose to simplify the code to not have to query for this information. This is fixed in 0006-Do-not-use-PYCEXT-and-rely-on-the-installed-file-nam.patch With this patch, the libselinux Python module was built-tested with Python 2 and Python 3, and run-time tested as well in both configurations, for both the target and host variants of libselinux. Fixes: http://autobuild.buildroot.net/results/aeb58de7ad674b980258e6ed30c7da3949a04452/ Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2019-10-25 15:27:31 +02:00
--- 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])')
package/libselinux: fix the build with Python 3.8 Following the switch to Python 3.8, the libselinux Python extension started to fail building. This is fixed by upstream commit 2efa06857575e4118e91ca250b6b92da68b130d5, which we backport as 0003-libselinux-Use-Python-distutils-to-install-SELinux-p.patch. This patch has the nice merit of switching to using distutils to build the Python extension of libselinux, instead of some custom logic. This allows to significantly simplify our libselinux.mk: we can rely on PKG_PYTHON_DISTUTILS_ENV and HOST_PKG_PYTHON_DISTUTILS_ENV instead of lots of custom variables. However, upstream commit 2efa06857575e4118e91ca250b6b92da68b130d5 had its own issues: * Hardcode of -I $(DESTDIR)/$(INCLUDEDIR) -L $(DESTDIR)/$(LIBDIR) at build time, while DESTDIR is normally empty at build time, causing bogus -I /usr/include -L /usr/lib to be used This is fixed in 0004-src-Makefile-don-t-pass-bogus-I-and-L-to-python-setu.patch * New usage of ln --relative, which is not supported in older distributions. This is fixed in 0005-Remove-ln-relative-usage-in-install-pywrap.patch * Usage of the host Python "imp" module to query the extension used for native Python module, but that returns an incorrect result when cross-compiling. We chose to simplify the code to not have to query for this information. This is fixed in 0006-Do-not-use-PYCEXT-and-rely-on-the-installed-file-nam.patch With this patch, the libselinux Python module was built-tested with Python 2 and Python 3, and run-time tested as well in both configurations, for both the target and host variants of libselinux. Fixes: http://autobuild.buildroot.net/results/aeb58de7ad674b980258e6ed30c7da3949a04452/ Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2019-10-25 15:27:31 +02:00
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
package/libselinux: fix the build with Python 3.8 Following the switch to Python 3.8, the libselinux Python extension started to fail building. This is fixed by upstream commit 2efa06857575e4118e91ca250b6b92da68b130d5, which we backport as 0003-libselinux-Use-Python-distutils-to-install-SELinux-p.patch. This patch has the nice merit of switching to using distutils to build the Python extension of libselinux, instead of some custom logic. This allows to significantly simplify our libselinux.mk: we can rely on PKG_PYTHON_DISTUTILS_ENV and HOST_PKG_PYTHON_DISTUTILS_ENV instead of lots of custom variables. However, upstream commit 2efa06857575e4118e91ca250b6b92da68b130d5 had its own issues: * Hardcode of -I $(DESTDIR)/$(INCLUDEDIR) -L $(DESTDIR)/$(LIBDIR) at build time, while DESTDIR is normally empty at build time, causing bogus -I /usr/include -L /usr/lib to be used This is fixed in 0004-src-Makefile-don-t-pass-bogus-I-and-L-to-python-setu.patch * New usage of ln --relative, which is not supported in older distributions. This is fixed in 0005-Remove-ln-relative-usage-in-install-pywrap.patch * Usage of the host Python "imp" module to query the extension used for native Python module, but that returns an incorrect result when cross-compiling. We chose to simplify the code to not have to query for this information. This is fixed in 0006-Do-not-use-PYCEXT-and-rely-on-the-installed-file-nam.patch With this patch, the libselinux Python module was built-tested with Python 2 and Python 3, and run-time tested as well in both configurations, for both the target and host variants of libselinux. Fixes: http://autobuild.buildroot.net/results/aeb58de7ad674b980258e6ed30c7da3949a04452/ Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2019-10-25 15:27:31 +02:00
install-pywrap: pywrap
$(PYTHON) setup.py install --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR)` $(PYTHON_SETUP_ARGS)
package/libselinux: fix the build with Python 3.8 Following the switch to Python 3.8, the libselinux Python extension started to fail building. This is fixed by upstream commit 2efa06857575e4118e91ca250b6b92da68b130d5, which we backport as 0003-libselinux-Use-Python-distutils-to-install-SELinux-p.patch. This patch has the nice merit of switching to using distutils to build the Python extension of libselinux, instead of some custom logic. This allows to significantly simplify our libselinux.mk: we can rely on PKG_PYTHON_DISTUTILS_ENV and HOST_PKG_PYTHON_DISTUTILS_ENV instead of lots of custom variables. However, upstream commit 2efa06857575e4118e91ca250b6b92da68b130d5 had its own issues: * Hardcode of -I $(DESTDIR)/$(INCLUDEDIR) -L $(DESTDIR)/$(LIBDIR) at build time, while DESTDIR is normally empty at build time, causing bogus -I /usr/include -L /usr/lib to be used This is fixed in 0004-src-Makefile-don-t-pass-bogus-I-and-L-to-python-setu.patch * New usage of ln --relative, which is not supported in older distributions. This is fixed in 0005-Remove-ln-relative-usage-in-install-pywrap.patch * Usage of the host Python "imp" module to query the extension used for native Python module, but that returns an incorrect result when cross-compiling. We chose to simplify the code to not have to query for this information. This is fixed in 0006-Do-not-use-PYCEXT-and-rely-on-the-installed-file-nam.patch With this patch, the libselinux Python module was built-tested with Python 2 and Python 3, and run-time tested as well in both configurations, for both the target and host variants of libselinux. Fixes: http://autobuild.buildroot.net/results/aeb58de7ad674b980258e6ed30c7da3949a04452/ Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2019-10-25 15:27:31 +02:00
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)/
package/libselinux: fix the build with Python 3.8 Following the switch to Python 3.8, the libselinux Python extension started to fail building. This is fixed by upstream commit 2efa06857575e4118e91ca250b6b92da68b130d5, which we backport as 0003-libselinux-Use-Python-distutils-to-install-SELinux-p.patch. This patch has the nice merit of switching to using distutils to build the Python extension of libselinux, instead of some custom logic. This allows to significantly simplify our libselinux.mk: we can rely on PKG_PYTHON_DISTUTILS_ENV and HOST_PKG_PYTHON_DISTUTILS_ENV instead of lots of custom variables. However, upstream commit 2efa06857575e4118e91ca250b6b92da68b130d5 had its own issues: * Hardcode of -I $(DESTDIR)/$(INCLUDEDIR) -L $(DESTDIR)/$(LIBDIR) at build time, while DESTDIR is normally empty at build time, causing bogus -I /usr/include -L /usr/lib to be used This is fixed in 0004-src-Makefile-don-t-pass-bogus-I-and-L-to-python-setu.patch * New usage of ln --relative, which is not supported in older distributions. This is fixed in 0005-Remove-ln-relative-usage-in-install-pywrap.patch * Usage of the host Python "imp" module to query the extension used for native Python module, but that returns an incorrect result when cross-compiling. We chose to simplify the code to not have to query for this information. This is fixed in 0006-Do-not-use-PYCEXT-and-rely-on-the-installed-file-nam.patch With this patch, the libselinux Python module was built-tested with Python 2 and Python 3, and run-time tested as well in both configurations, for both the target and host variants of libselinux. Fixes: http://autobuild.buildroot.net/results/aeb58de7ad674b980258e6ed30c7da3949a04452/ Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2019-10-25 15:27:31 +02:00
install-rubywrap: rubywrap
test -d $(DESTDIR)$(RUBYINSTALL) || install -m 755 -d $(DESTDIR)$(RUBYINSTALL)
--
2.26.2
package/libselinux: fix the build with Python 3.8 Following the switch to Python 3.8, the libselinux Python extension started to fail building. This is fixed by upstream commit 2efa06857575e4118e91ca250b6b92da68b130d5, which we backport as 0003-libselinux-Use-Python-distutils-to-install-SELinux-p.patch. This patch has the nice merit of switching to using distutils to build the Python extension of libselinux, instead of some custom logic. This allows to significantly simplify our libselinux.mk: we can rely on PKG_PYTHON_DISTUTILS_ENV and HOST_PKG_PYTHON_DISTUTILS_ENV instead of lots of custom variables. However, upstream commit 2efa06857575e4118e91ca250b6b92da68b130d5 had its own issues: * Hardcode of -I $(DESTDIR)/$(INCLUDEDIR) -L $(DESTDIR)/$(LIBDIR) at build time, while DESTDIR is normally empty at build time, causing bogus -I /usr/include -L /usr/lib to be used This is fixed in 0004-src-Makefile-don-t-pass-bogus-I-and-L-to-python-setu.patch * New usage of ln --relative, which is not supported in older distributions. This is fixed in 0005-Remove-ln-relative-usage-in-install-pywrap.patch * Usage of the host Python "imp" module to query the extension used for native Python module, but that returns an incorrect result when cross-compiling. We chose to simplify the code to not have to query for this information. This is fixed in 0006-Do-not-use-PYCEXT-and-rely-on-the-installed-file-nam.patch With this patch, the libselinux Python module was built-tested with Python 2 and Python 3, and run-time tested as well in both configurations, for both the target and host variants of libselinux. Fixes: http://autobuild.buildroot.net/results/aeb58de7ad674b980258e6ed30c7da3949a04452/ Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2019-10-25 15:27:31 +02:00