python-semanage: fix cross-compilation, add test.sh

Add HOST_PYTHON3_PIP_VARS and --no-build-isolation to MAKE_VARS.
Without --no-build-isolation, pip creates an isolated build environment
which fails during cross-compilation because _sysconfigdata is missing.
Aligns with python-selinux which already has this fix.

The libsemanage pywrap uses the host Python's EXT_SUFFIX to name the
C extension, so we will use the PYCEXT env-var to correct that.

Add basic test.sh to verify the semanage Python bindings load correctly
in environments without SELinux kernel support.

Signed-off-by: Alexandru Ardelean <alex@shruggie.ro>
This commit is contained in:
Alexandru Ardelean
2026-04-03 13:53:03 +03:00
committed by Alexandru Ardelean
parent e2e727e686
commit acfafdaa03
2 changed files with 21 additions and 2 deletions
+5 -2
View File
@@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=python-semanage
PKG_VERSION:=3.9
PKG_RELEASE:=1
PKG_RELEASE:=2
SRC_NAME:=libsemanage
PKG_SOURCE:=$(SRC_NAME)-$(PKG_VERSION).tar.gz
@@ -51,7 +51,10 @@ define Package/python3-semanage/description
endef
MAKE_VARS += \
$(PYTHON3_VARS)
$(PYTHON3_VARS) \
$(HOST_PYTHON3_PIP_VARS) \
PYCEXT=.cpython-$(PYTHON3_VERSION_MAJOR)$(PYTHON3_VERSION_MINOR)$(ABIFLAGS)-$(MULTIARCH).so \
PYTHON_SETUP_ARGS="--no-compile --no-build-isolation"
define Build/Compile
$(call Build/Compile/Default,pywrap)