From 46c35610db75cfa7529ca89b3bf10579edf7c342 Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Fri, 3 Apr 2026 15:29:11 +0300 Subject: [PATCH] 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 --- utils/setools/Makefile | 8 ++-- utils/setools/patches/010-no-gui.patch | 44 +++++++++++-------- .../patches/030-remove-host-paths.patch | 10 ++--- utils/setools/test.sh | 19 ++++++++ 4 files changed, 53 insertions(+), 28 deletions(-) create mode 100755 utils/setools/test.sh diff --git a/utils/setools/Makefile b/utils/setools/Makefile index b4f8afd76a..a6fe66795e 100644 --- a/utils/setools/Makefile +++ b/utils/setools/Makefile @@ -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 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 diff --git a/utils/setools/patches/010-no-gui.patch b/utils/setools/patches/010-no-gui.patch index efe1834469..23fcf3fe32 100644 --- a/utils/setools/patches/010-no-gui.patch +++ b/utils/setools/patches/010-no-gui.patch @@ -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"] diff --git a/utils/setools/patches/030-remove-host-paths.patch b/utils/setools/patches/030-remove-host-paths.patch index 99b65e78e0..359b242b83 100644 --- a/utils/setools/patches/030-remove-host-paths.patch +++ b/utils/setools/patches/030-remove-host-paths.patch @@ -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 index 0000000000..2cf30dbbce --- /dev/null +++ b/utils/setools/test.sh @@ -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