Skip to content

Commit

Permalink
Merge setools 4.4.2-2 update
Browse files Browse the repository at this point in the history
  • Loading branch information
fishilico committed Jul 21, 2023
2 parents 5e4289a + 62b50b0 commit 9efb0a7
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 5 deletions.
6 changes: 4 additions & 2 deletions setools/.SRCINFO
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pkgbase = setools
pkgdesc = Policy analysis tools for SELinux
pkgver = 4.4.2
pkgrel = 1
pkgrel = 2
url = https://github.com/SELinuxProject/setools/wiki
arch = i686
arch = x86_64
Expand All @@ -19,9 +19,11 @@ pkgbase = setools
depends = python-setuptools
optdepends = python-pyqt5: needed for graphical tools
optdepends = qt5-tools: display apol help with Qt Assistant
provides = selinux-setools=4.4.2-1
provides = selinux-setools=4.4.2-2
conflicts = selinux-setools
source = https://github.com/SELinuxProject/setools/releases/download/4.4.2/setools-4.4.2.tar.bz2
source = 0001-SELinuxPolicy-Add-explicit-cast-for-libsepol-message.patch
sha256sums = f23e3c8635aa289096ca0218ca6f4568a4346e088bc46f374cb0917b7fb66f05
sha256sums = 877849712e1519c40e6a9b94805514729af8c9a17dfa6128f40f16637e626fec

pkgname = setools
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
From 31e104c3a9ca97038e09d3a4549fe2b8c8df36e8 Mon Sep 17 00:00:00 2001
From: Chris PeBenito <[email protected]>
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 <[email protected]>
---
setools/policyrep/selinuxpolicy.pxi | 2 +-
setools/policyrep/sepol.pxd | 4 +++-
2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/setools/policyrep/selinuxpolicy.pxi b/setools/policyrep/selinuxpolicy.pxi
index 9267a0c4..236316f1 100644
--- 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
diff --git a/setools/policyrep/sepol.pxd b/setools/policyrep/sepol.pxd
index 769498f2..36589ed1 100644
--- 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)


17 changes: 14 additions & 3 deletions setools/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

pkgname=setools
pkgver=4.4.2
pkgrel=1
pkgrel=2
pkgdesc="Policy analysis tools for SELinux"
groups=('selinux')
arch=('i686' 'x86_64' 'aarch64')
Expand All @@ -32,8 +32,19 @@ makedepends=('cython' 'python-tox')
checkdepends=('checkpolicy')
conflicts=("selinux-${pkgname}")
provides=("selinux-${pkgname}=${pkgver}-${pkgrel}")
source=("https://github.com/SELinuxProject/setools/releases/download/${pkgver}/${pkgname}-${pkgver}.tar.bz2")
sha256sums=('f23e3c8635aa289096ca0218ca6f4568a4346e088bc46f374cb0917b7fb66f05')
source=("https://github.com/SELinuxProject/setools/releases/download/${pkgver}/${pkgname}-${pkgver}.tar.bz2"
'0001-SELinuxPolicy-Add-explicit-cast-for-libsepol-message.patch')
sha256sums=('f23e3c8635aa289096ca0218ca6f4568a4346e088bc46f374cb0917b7fb66f05'
'877849712e1519c40e6a9b94805514729af8c9a17dfa6128f40f16637e626fec')

prepare() {
cd "${pkgname}"

# Fix cython 3.0 compatibility
# https://github.com/SELinuxProject/setools/pull/104
# https://github.com/SELinuxProject/setools/commit/31e104c3a9ca97038e09d3a4549fe2b8c8df36e8
patch -Np1 -i ../0001-SELinuxPolicy-Add-explicit-cast-for-libsepol-message.patch
}

build() {
cd "${pkgname}"
Expand Down

0 comments on commit 9efb0a7

Please sign in to comment.