mirror of
https://github.com/openwrt/packages.git
synced 2026-05-31 15:02:01 +08:00
python-selinux: fix cross-compilation, add test.sh
Add --no-build-isolation to PYTHON_SETUP_ARGS. Without it, pip creates an isolated build environment which fails during cross-compilation because _sysconfigdata is missing for the target arch. Add test.sh with basic import and API sanity checks. Signed-off-by: Alexandru Ardelean <alex@shruggie.ro>
This commit is contained in:
committed by
Alexandru Ardelean
parent
f64dd10a41
commit
e2e727e686
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ "$1" = python3-selinux ] || exit 0
|
||||
|
||||
python3 - <<'EOF'
|
||||
import selinux
|
||||
|
||||
# Verify key functions are available from the C extension
|
||||
assert hasattr(selinux, 'is_selinux_enabled'), "is_selinux_enabled missing"
|
||||
assert hasattr(selinux, 'getfilecon'), "getfilecon missing"
|
||||
assert hasattr(selinux, 'matchpathcon'), "matchpathcon missing"
|
||||
assert hasattr(selinux, 'selinux_getenforcemode'), "selinux_getenforcemode missing"
|
||||
assert hasattr(selinux, 'security_check_context'), "security_check_context missing"
|
||||
assert hasattr(selinux, 'context_new'), "context_new missing"
|
||||
|
||||
# Validate context parsing (works without a running SELinux system)
|
||||
ctx = selinux.context_new("system_u:object_r:bin_t:s0")
|
||||
assert ctx is not None, "context_new returned None"
|
||||
assert selinux.context_type_get(ctx) == "bin_t"
|
||||
assert selinux.context_role_get(ctx) == "object_r"
|
||||
assert selinux.context_user_get(ctx) == "system_u"
|
||||
assert selinux.context_range_get(ctx) == "s0"
|
||||
|
||||
print("python3-selinux OK")
|
||||
EOF
|
||||
Reference in New Issue
Block a user