setools: bump to 4.6.0
authorAlexandru Ardelean <redacted>
Fri, 3 Apr 2026 12:29:11 +0000 (15:29 +0300)
committerAlexandru Ardelean <redacted>
Sat, 4 Apr 2026 03:36:47 +0000 (06:36 +0300)
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 <redacted>
utils/setools/Makefile
utils/setools/patches/010-no-gui.patch
utils/setools/patches/030-remove-host-paths.patch
utils/setools/test.sh [new file with mode: 0755]

index b4f8afd76a2e31b7678fc19c5832a6e42bd7755b..a6fe66795ea7c21bda8f360ec96ae8d5f549db79 100644 (file)
@@ -6,14 +6,14 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=setools
-PKG_VERSION:=4.5.1
+PKG_VERSION:=4.6.0
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 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_LICENSE:=GPL-2.0-only LGPL-2.1-only
@@ -45,7 +45,7 @@ define Package/python3-setools
   SUBMENU:=Python
   TITLE:=SETools Python bindings
   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
 
 define Package/python3-setools/description
index efe18344693a8592d7610e3a165c2b31af757b22..23fcf3fe32896a6465742c749c7bbb780d1a1f13 100644 (file)
@@ -1,19 +1,25 @@
---- a/setup.py
-+++ b/setup.py
-@@ -70,13 +70,10 @@ setup(name='setools',
-       author='Chris PeBenito',
-       author_email='pebenito@ieee.org',
-       url='https://github.com/SELinuxProject/setools',
--      packages=['setools', 'setools.checker', 'setools.diff', 'setoolsgui', 'setoolsgui.widgets',
--                'setoolsgui.widgets.criteria', 'setoolsgui.widgets.details',
--                'setoolsgui.widgets.models', 'setoolsgui.widgets.views'],
--      scripts=['apol', 'sediff', 'seinfo', 'seinfoflow', 'sesearch', 'sedta', 'sechecker'],
-+      packages=['setools', 'setools.checker', 'setools.diff'],
-+      scripts=['sediff', 'seinfo', 'seinfoflow', 'sesearch', 'sedta', 'sechecker'],
-       data_files=installed_data,
--      package_data={'': ['*.css', '*.html'],
--                    'setools': ['perm_map', 'policyrep.pyi', 'py.typed']},
-+      package_data={'setools': ['perm_map', 'policyrep.pyi', 'py.typed']},
-       ext_modules=cythonize(ext_py_mods, include_path=['setools/policyrep'],
-                             annotate=cython_annotate,
-                             compiler_directives={"language_level": 3,
+--- a/pyproject.toml
++++ b/pyproject.toml
+@@ -48,8 +48,7 @@ optional-dependencies.test = ["tox"]
+ [tool.setuptools]
+ include-package-data = false
+-script-files = ["apol",
+-                "sediff",
++script-files = ["sediff",
+                 "seinfo",
+                 "seinfoflow",
+                 "sesearch",
+@@ -57,10 +56,10 @@ script-files = ["apol",
+                 "sechecker"]
+ [tool.setuptools.packages.find]
+-include = ["setools*"]
++include = ["setools", "setools.*"]
+ [tool.setuptools.package-data]
+-"*" = ["*.css", "*.html", "perm_map", "py.typed"]
++"setools" = ["perm_map", "py.typed"]
+ [tool.setuptools.exclude-package-data]
+ "*" = ["*.c", "*.pyi", "*.pyx"]
index 99b65e78e0c998a53b8abb65eec7b00a40d11e7a..359b242b836fc3b7c09eff71700947820ea04e36 100644 (file)
@@ -1,11 +1,11 @@
 --- a/setup.py
 +++ b/setup.py
-@@ -11,7 +11,7 @@ import os.path
+@@ -10,7 +10,7 @@ from Cython.Build import cythonize
  
  
  # Library linkage
--lib_dirs = ['.', '/usr/lib64', '/usr/lib', '/usr/local/lib']
-+lib_dirs = ['.', os.environ["STAGING_DIR"] + '/usr/lib']
- include_dirs = []
+-lib_dirs: list[str] = ['.', '/usr/lib64', '/usr/lib', '/usr/local/lib']
++lib_dirs: list[str] = ['.', os.environ["STAGING_DIR"] + '/usr/lib']
+ include_dirs: list[str] = []
  
- with suppress(KeyError):
+ userspace_src = os.getenv("USERSPACE_SRC", "")
diff --git a/utils/setools/test.sh b/utils/setools/test.sh
new file mode 100755 (executable)
index 0000000..2cf30db
--- /dev/null
@@ -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
git clone https://git.99rst.org/PROJECT