setools: bump to 4.6.0

Fix dependency with python3-pkg-resources (it got removed).
And add test.sh

- Bump from 4.5.1 to 4.6.0
- Drop python3-pkg-resources dependency: setools uses
  'from importlib import resources as pkg_resources' which is stdlib,
  not the external pkg_resources package
- Update 010-no-gui.patch: pyproject.toml now manages script-files and
  package-data (was setup.py in 4.5.1); rewrite patch to target it
- Update 030-remove-host-paths.patch: lib_dirs now uses list[str] type
  hint; fix hunk header line numbers to match new upstream layout
- Add test.sh: verify core query classes (SELinuxPolicy, BoolQuery,
  TypeQuery, RoleQuery, UserQuery) are accessible

Signed-off-by: Alexandru Ardelean <alex@shruggie.ro>
This commit is contained in:
Alexandru Ardelean
2026-04-03 15:29:11 +03:00
committed by Alexandru Ardelean
parent 8c583808c7
commit 46c35610db
4 changed files with 53 additions and 28 deletions

View File

@@ -6,14 +6,14 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=setools PKG_NAME:=setools
PKG_VERSION:=4.5.1 PKG_VERSION:=4.6.0
PKG_RELEASE:=1 PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=https://github.com/SELinuxProject/setools/releases/download/$(PKG_VERSION) PKG_SOURCE_URL:=https://github.com/SELinuxProject/setools/releases/download/$(PKG_VERSION)
PKG_HASH:=25e47d00bbffd6046f55409c9ba3b08d9b1d5788cc159ea247d9e0ced8e482e7 PKG_HASH:=97319aabaf9d4237841ee60dcc9b2f291e73a761f317fd13e293ea2367d5806c
PKG_BUILD_DEPENDS:=python-cython/host # Cython>=0.27 PKG_BUILD_DEPENDS:=python-cython/host # Cython>=0.29.14
PKG_MAINTAINER:=W. Michael Petullo <mike@flyn.org> PKG_MAINTAINER:=W. Michael Petullo <mike@flyn.org>
PKG_LICENSE:=GPL-2.0-only LGPL-2.1-only PKG_LICENSE:=GPL-2.0-only LGPL-2.1-only
@@ -45,7 +45,7 @@ define Package/python3-setools
SUBMENU:=Python SUBMENU:=Python
TITLE:=SETools Python bindings TITLE:=SETools Python bindings
URL:=http://selinuxproject.org/page/Main_Page URL:=http://selinuxproject.org/page/Main_Page
DEPENDS:=+python3-light +python3-logging +python3-pkg-resources +libselinux +libsepol DEPENDS:=+python3-light +python3-logging +libselinux +libsepol
endef endef
define Package/python3-setools/description define Package/python3-setools/description

View File

@@ -1,19 +1,25 @@
--- a/setup.py --- a/pyproject.toml
+++ b/setup.py +++ b/pyproject.toml
@@ -70,13 +70,10 @@ setup(name='setools', @@ -48,8 +48,7 @@ optional-dependencies.test = ["tox"]
author='Chris PeBenito',
author_email='pebenito@ieee.org', [tool.setuptools]
url='https://github.com/SELinuxProject/setools', include-package-data = false
- packages=['setools', 'setools.checker', 'setools.diff', 'setoolsgui', 'setoolsgui.widgets', -script-files = ["apol",
- 'setoolsgui.widgets.criteria', 'setoolsgui.widgets.details', - "sediff",
- 'setoolsgui.widgets.models', 'setoolsgui.widgets.views'], +script-files = ["sediff",
- scripts=['apol', 'sediff', 'seinfo', 'seinfoflow', 'sesearch', 'sedta', 'sechecker'], "seinfo",
+ packages=['setools', 'setools.checker', 'setools.diff'], "seinfoflow",
+ scripts=['sediff', 'seinfo', 'seinfoflow', 'sesearch', 'sedta', 'sechecker'], "sesearch",
data_files=installed_data, @@ -57,10 +56,10 @@ script-files = ["apol",
- package_data={'': ['*.css', '*.html'], "sechecker"]
- 'setools': ['perm_map', 'policyrep.pyi', 'py.typed']},
+ package_data={'setools': ['perm_map', 'policyrep.pyi', 'py.typed']}, [tool.setuptools.packages.find]
ext_modules=cythonize(ext_py_mods, include_path=['setools/policyrep'], -include = ["setools*"]
annotate=cython_annotate, +include = ["setools", "setools.*"]
compiler_directives={"language_level": 3,
[tool.setuptools.package-data]
-"*" = ["*.css", "*.html", "perm_map", "py.typed"]
+"setools" = ["perm_map", "py.typed"]
[tool.setuptools.exclude-package-data]
"*" = ["*.c", "*.pyi", "*.pyx"]

View File

@@ -1,11 +1,11 @@
--- a/setup.py --- a/setup.py
+++ b/setup.py +++ b/setup.py
@@ -11,7 +11,7 @@ import os.path @@ -10,7 +10,7 @@ from Cython.Build import cythonize
# Library linkage # Library linkage
-lib_dirs = ['.', '/usr/lib64', '/usr/lib', '/usr/local/lib'] -lib_dirs: list[str] = ['.', '/usr/lib64', '/usr/lib', '/usr/local/lib']
+lib_dirs = ['.', os.environ["STAGING_DIR"] + '/usr/lib'] +lib_dirs: list[str] = ['.', os.environ["STAGING_DIR"] + '/usr/lib']
include_dirs = [] include_dirs: list[str] = []
with suppress(KeyError): userspace_src = os.getenv("USERSPACE_SRC", "")

19
utils/setools/test.sh Executable file
View File

@@ -0,0 +1,19 @@
#!/bin/sh
[ "$1" = python3-setools ] || exit 0
python3 - << 'EOF'
import setools
# Verify the module loads and basic query classes are accessible
assert hasattr(setools, 'SELinuxPolicy'), \
"setools missing SELinuxPolicy class"
assert hasattr(setools, 'BoolQuery'), \
"setools missing BoolQuery class"
assert hasattr(setools, 'TypeQuery'), \
"setools missing TypeQuery class"
assert hasattr(setools, 'RoleQuery'), \
"setools missing RoleQuery class"
assert hasattr(setools, 'UserQuery'), \
"setools missing UserQuery class"
EOF