From 453d21ba295f8d5cf4422927c1cf58280fc24f32 Mon Sep 17 00:00:00 2001 From: Sam James Date: Tue, 19 May 2026 03:06:18 +0100 Subject: [PATCH] dev-util/umockdev: avoid automagic SELinux Signed-off-by: Sam James --- .../umockdev-0.19.7-selinux-automagic.patch | 29 ++++++++ dev-util/umockdev/umockdev-0.19.7-r1.ebuild | 71 +++++++++++++++++++ dev-util/umockdev/umockdev-9999.ebuild | 11 ++- 3 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 dev-util/umockdev/files/umockdev-0.19.7-selinux-automagic.patch create mode 100644 dev-util/umockdev/umockdev-0.19.7-r1.ebuild diff --git a/dev-util/umockdev/files/umockdev-0.19.7-selinux-automagic.patch b/dev-util/umockdev/files/umockdev-0.19.7-selinux-automagic.patch new file mode 100644 index 0000000000000..c1ccd86cfc708 --- /dev/null +++ b/dev-util/umockdev/files/umockdev-0.19.7-selinux-automagic.patch @@ -0,0 +1,29 @@ +--- a/meson.build ++++ b/meson.build +@@ -84,11 +84,10 @@ meson.add_dist_script(srcdir / 'getversion.sh') + optional_defines = [] + + dl = cc.find_library('dl') +-selinux = cc.find_library('libselinux', required: false) +-if selinux.found() +- if cc.check_header('selinux/selinux.h') +- optional_defines += ['--define=HAVE_SELINUX'] +- endif ++selinux = cc.find_library('libselinux', required: get_option('selinux')) ++selinux_header = cc.check_header('selinux/selinux.h', required: get_option('selinux')) ++if get_option('selinux').enabled() ++ optional_defines += ['--define=HAVE_SELINUX'] + endif + + glib = dependency('glib-2.0', version: '>= 2.32.0') +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -2,3 +2,8 @@ option('gtk_doc', + type : 'boolean', + value : false, + description : 'use gtk-doc to build documentation') ++ ++option('selinux', ++ type : 'feature', ++ value : 'auto', ++ description : 'SELinux support') diff --git a/dev-util/umockdev/umockdev-0.19.7-r1.ebuild b/dev-util/umockdev/umockdev-0.19.7-r1.ebuild new file mode 100644 index 0000000000000..71d257e42a395 --- /dev/null +++ b/dev-util/umockdev/umockdev-0.19.7-r1.ebuild @@ -0,0 +1,71 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 +PYTHON_COMPAT=( python3_{11..14} ) + +inherit flag-o-matic meson-multilib python-any-r1 vala + +if [[ ${PV} = 9999* ]]; then + EGIT_REPO_URI="https://github.com/martinpitt/${PN}.git" + inherit git-r3 +else + SRC_URI="https://github.com/martinpitt/umockdev/releases/download/${PV}/${P}.tar.xz" + KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86" +fi + +DESCRIPTION="Mock hardware devices for creating unit tests" +HOMEPAGE="https://github.com/martinpitt/umockdev/" + +LICENSE="LGPL-2.1+" +SLOT="0" +IUSE="selinux test" +RESTRICT="!test? ( test )" + +RDEPEND=" + net-libs/libpcap[${MULTILIB_USEDEP}] + virtual/libudev:=[${MULTILIB_USEDEP}] + >=dev-libs/glib-2.32:2[${MULTILIB_USEDEP}] + >=dev-libs/gobject-introspection-1.82.0-r2:= + selinux? ( sys-libs/libselinux ) +" +DEPEND="${RDEPEND} + test? ( + ${PYTHON_DEPS} + dev-libs/libgudev:=[introspection,${MULTILIB_USEDEP}] + ) +" +BDEPEND=" + $(vala_depend) + app-arch/xz-utils + virtual/pkgconfig +" + +PATCHES=( + "${FILESDIR}"/${PN}-0.19.7-selinux-automagic.patch +) + +pkg_setup() { + use test && python-any-r1_pkg_setup +} + +src_prepare() { + default + vala_setup +} + +multilib_src_configure() { + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101270 + filter-flags -fno-semantic-interposition + + local emesonargs=( + $(meson_feature selinux) + ) + + meson_src_configure +} + +multilib_src_test() { + export SLOW_TESTBED_FACTOR=100 + meson_src_test --num-processes=1 --timeout-multiplier=10 +} diff --git a/dev-util/umockdev/umockdev-9999.ebuild b/dev-util/umockdev/umockdev-9999.ebuild index 8709c99ee44f5..71d257e42a395 100644 --- a/dev-util/umockdev/umockdev-9999.ebuild +++ b/dev-util/umockdev/umockdev-9999.ebuild @@ -19,7 +19,7 @@ HOMEPAGE="https://github.com/martinpitt/umockdev/" LICENSE="LGPL-2.1+" SLOT="0" -IUSE="test" +IUSE="selinux test" RESTRICT="!test? ( test )" RDEPEND=" @@ -27,6 +27,7 @@ RDEPEND=" virtual/libudev:=[${MULTILIB_USEDEP}] >=dev-libs/glib-2.32:2[${MULTILIB_USEDEP}] >=dev-libs/gobject-introspection-1.82.0-r2:= + selinux? ( sys-libs/libselinux ) " DEPEND="${RDEPEND} test? ( @@ -40,6 +41,10 @@ BDEPEND=" virtual/pkgconfig " +PATCHES=( + "${FILESDIR}"/${PN}-0.19.7-selinux-automagic.patch +) + pkg_setup() { use test && python-any-r1_pkg_setup } @@ -53,6 +58,10 @@ multilib_src_configure() { # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101270 filter-flags -fno-semantic-interposition + local emesonargs=( + $(meson_feature selinux) + ) + meson_src_configure }