summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2023-07-27 07:34:49 +0100
committerSam James <sam@gentoo.org>2023-07-27 07:53:42 +0100
commit1ee9417567fe86de5aa2e53159575bc73376b950 (patch)
tree25e8e556c7c2301676aa964e3375f0f9d58744cf /app-admin/setools
parentapp-admin/setools: disable py3.9 (diff)
downloadgentoo-1ee9417567fe86de5aa2e53159575bc73376b950.tar.gz
gentoo-1ee9417567fe86de5aa2e53159575bc73376b950.tar.bz2
gentoo-1ee9417567fe86de5aa2e53159575bc73376b950.zip
app-admin/setools: backport cython-3 fix, use d_e_t, set DISTUTILS_EXT
Closes: https://bugs.gentoo.org/898664 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'app-admin/setools')
-rw-r--r--app-admin/setools/files/setools-4.4.1-cython3.patch43
-rw-r--r--app-admin/setools/setools-4.4.1-r1.ebuild60
-rw-r--r--app-admin/setools/setools-9999.ebuild14
3 files changed, 112 insertions, 5 deletions
diff --git a/app-admin/setools/files/setools-4.4.1-cython3.patch b/app-admin/setools/files/setools-4.4.1-cython3.patch
new file mode 100644
index 000000000000..386b92f44576
--- /dev/null
+++ b/app-admin/setools/files/setools-4.4.1-cython3.patch
@@ -0,0 +1,43 @@
+https://bugs.gentoo.org/898664
+https://github.com/SELinuxProject/setools/pull/105/commits/fc443b5a0379f3644e071a458e996ea6115ccba3
+(cherry-picked from https://github.com/SELinuxProject/setools/commit/31e104c3a9ca97038e09d3a4549fe2b8c8df36e8)
+
+From fc443b5a0379f3644e071a458e996ea6115ccba3 Mon Sep 17 00:00:00 2001
+From: Chris PeBenito <chpebeni@linux.microsoft.com>
+Date: Mon, 17 Jul 2023 16:08:21 -0400
+Subject: [PATCH] SELinuxPolicy: Add explicit cast for libspol message
+ callback.
+
+Cython 3.0 is more strict. The change fixes this issue:
+
+setools/policyrep/selinuxpolicy.pxi:685:46: Cannot assign type 'void (void *, sepol_handle_t *, const char *, ...) except *' to 'msg_callback'
+
+Additionally, the msg_callback is not typedef-ed in sepol/debug.h, so it must
+be explicitly defined in sepol.pxd for the casting to work.
+
+Signed-off-by: Chris PeBenito <chpebeni@linux.microsoft.com>
+--- a/setools/policyrep/selinuxpolicy.pxi
++++ b/setools/policyrep/selinuxpolicy.pxi
+@@ -668,7 +668,7 @@ cdef class SELinuxPolicy:
+ if self.sh == NULL:
+ raise MemoryError
+
+- sepol.sepol_msg_set_callback(self.sh, sepol_logging_callback, self.handle)
++ sepol.sepol_msg_set_callback(self.sh, <sepol.msg_callback>sepol_logging_callback, self.handle)
+
+ if sepol.sepol_policydb_create(&self.handle) < 0:
+ raise MemoryError
+--- a/setools/policyrep/sepol.pxd
++++ b/setools/policyrep/sepol.pxd
+@@ -16,8 +16,10 @@ cdef extern from "<sepol/handle.h>":
+ void sepol_handle_destroy(sepol_handle_t *sh)
+
+
++ctypedef void (*msg_callback)(void *varg, sepol_handle_t *handle, const char *fmt, ...)
++
++
+ cdef extern from "<sepol/debug.h>":
+- ctypedef void (*msg_callback)(void *varg, sepol_handle_t *handle, const char *fmt, ...)
+ void sepol_msg_set_callback(sepol_handle * handle, msg_callback cb, void *cb_arg)
+
+
diff --git a/app-admin/setools/setools-4.4.1-r1.ebuild b/app-admin/setools/setools-4.4.1-r1.ebuild
new file mode 100644
index 000000000000..b2f3219fe402
--- /dev/null
+++ b/app-admin/setools/setools-4.4.1-r1.ebuild
@@ -0,0 +1,60 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="7"
+
+PYTHON_COMPAT=( python3_{10..11} )
+DISTUTILS_EXT=1
+DISTUTILS_USE_SETUPTOOLS=rdepend
+
+inherit distutils-r1
+
+DESCRIPTION="Policy Analysis Tools for SELinux"
+HOMEPAGE="https://github.com/SELinuxProject/setools/wiki"
+
+if [[ ${PV} == 9999 ]] ; then
+ inherit git-r3
+ EGIT_REPO_URI="https://github.com/SELinuxProject/setools.git"
+ S="${WORKDIR}/${P}"
+else
+ SRC_URI="https://github.com/SELinuxProject/setools/releases/download/${PV}/${P}.tar.bz2"
+ KEYWORDS="~amd64 ~arm ~arm64 ~x86"
+ S="${WORKDIR}/${PN}"
+fi
+
+LICENSE="GPL-2 LGPL-2.1"
+SLOT="0"
+IUSE="test infoflow X"
+RESTRICT="!test? ( test )"
+
+RDEPEND="${PYTHON_DEPS}
+ dev-python/setuptools[${PYTHON_USEDEP}]
+ >=sys-libs/libsepol-3.2:=
+ >=sys-libs/libselinux-3.2:=
+ infoflow? ( >=dev-python/networkx-2.0[${PYTHON_USEDEP}] )
+ X? (
+ dev-python/PyQt5[gui,widgets,${PYTHON_USEDEP}]
+ )"
+DEPEND="${RDEPEND}"
+BDEPEND=">=dev-python/cython-0.27[${PYTHON_USEDEP}]
+ dev-python/setuptools[${PYTHON_USEDEP}]
+ test? (
+ >=dev-python/networkx-2.0[${PYTHON_USEDEP}]
+ sys-apps/checkpolicy
+ )"
+
+PATCHES=(
+ "${FILESDIR}"/0001-__init__.py-Make-NetworkX-dep-optional.patch
+ "${FILESDIR}"/${P}-cython3.patch
+)
+
+distutils_enable_tests setup.py
+
+python_prepare_all() {
+ sed -i "s/'-Werror', //" "${S}"/setup.py || die "failed to remove Werror"
+ sed -i "s@^lib_dirs = .*@lib_dirs = ['${ROOT:-/}usr/$(get_libdir)']@" "${S}"/setup.py || \
+ die "failed to set lib_dirs"
+
+ use X || local PATCHES+=( "${FILESDIR}"/setools-4.4.0-remove-gui.patch )
+ distutils-r1_python_prepare_all
+}
diff --git a/app-admin/setools/setools-9999.ebuild b/app-admin/setools/setools-9999.ebuild
index ebd2c04ae49c..4f18e7303d13 100644
--- a/app-admin/setools/setools-9999.ebuild
+++ b/app-admin/setools/setools-9999.ebuild
@@ -2,7 +2,9 @@
# Distributed under the terms of the GNU General Public License v2
EAPI="7"
+
PYTHON_COMPAT=( python3_{10..11} )
+DISTUTILS_EXT=1
DISTUTILS_USE_SETUPTOOLS=rdepend
inherit distutils-r1
@@ -41,15 +43,17 @@ BDEPEND=">=dev-python/cython-0.27[${PYTHON_USEDEP}]
sys-apps/checkpolicy
)"
+PATCHES=(
+ "${FILESDIR}"/0001-__init__.py-Make-NetworkX-dep-optional.patch
+)
+
+distutils_enable_tests setup.py
+
python_prepare_all() {
sed -i "s/'-Werror', //" "${S}"/setup.py || die "failed to remove Werror"
sed -i "s@^lib_dirs = .*@lib_dirs = ['${ROOT:-/}usr/$(get_libdir)']@" "${S}"/setup.py || \
die "failed to set lib_dirs"
- use X || local PATCHES=( "${FILESDIR}"/setools-4.4.0-remove-gui.patch )
+ use X || local PATCHES+=( "${FILESDIR}"/setools-4.4.0-remove-gui.patch )
distutils-r1_python_prepare_all
}
-
-python_test() {
- esetup.py test
-}