Files
Alexandru Ardelean 9122b66499 selinux-python: 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 verifying python3-sepolgen module loads correctly and
selinux-audit2allow binary is functional.

Signed-off-by: Alexandru Ardelean <alex@shruggie.ro>
2026-04-25 07:48:58 +03:00

43 lines
1.0 KiB
Bash
Executable File

#!/bin/sh
case "$1" in
python3-sepolgen)
python3 - <<'EOF'
import sepolgen.interfaces as iface
import sepolgen.policygen as pg
import sepolgen.access as access
# Verify core classes are importable
assert hasattr(iface, 'InterfaceSet'), "InterfaceSet missing"
assert hasattr(pg, 'PolicyGenerator'), "PolicyGenerator missing"
assert hasattr(access, 'AccessVector'), "AccessVector missing"
# Basic AccessVector construction
av = access.AccessVector()
av.src_type = "httpd_t"
av.tgt_type = "var_log_t"
av.obj_class = "file"
av.perms.add("write")
assert "write" in av.perms
print("python3-sepolgen OK")
EOF
;;
python3-seobject)
python3 - <<'EOF'
import seobject
# Verify key record types are available (no SELinux system required)
assert hasattr(seobject, 'portRecords'), "portRecords missing"
assert hasattr(seobject, 'fcontextRecords'), "fcontextRecords missing"
assert hasattr(seobject, 'booleanRecords'), "booleanRecords missing"
assert hasattr(seobject, 'seluserRecords'), "seluserRecords missing"
print("python3-seobject OK")
EOF
;;
*)
exit 0
;;
esac