From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1483766-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 5B6D915800F
	for <garchives@archives.gentoo.org>; Fri,  3 Feb 2023 19:03:35 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id A76AAE05C1;
	Fri,  3 Feb 2023 19:03:34 +0000 (UTC)
Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 8DED6E05C1
	for <gentoo-commits@lists.gentoo.org>; Fri,  3 Feb 2023 19:03:34 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id AFD72340D45
	for <gentoo-commits@lists.gentoo.org>; Fri,  3 Feb 2023 19:03:33 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 00BFB75
	for <gentoo-commits@lists.gentoo.org>; Fri,  3 Feb 2023 19:03:31 +0000 (UTC)
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" <sam@gentoo.org>
Message-ID: <1675451002.ccfb9e9f8433a844b3d2f2d9a1dd0c0d05e1f6df.sam@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-apps/kmod/
X-VCS-Repository: repo/gentoo
X-VCS-Files: sys-apps/kmod/kmod-30-r1.ebuild sys-apps/kmod/kmod-9999.ebuild
X-VCS-Directories: sys-apps/kmod/
X-VCS-Committer: sam
X-VCS-Committer-Name: Sam James
X-VCS-Revision: ccfb9e9f8433a844b3d2f2d9a1dd0c0d05e1f6df
X-VCS-Branch: master
Date: Fri,  3 Feb 2023 19:03:31 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: ca417bd9-b1aa-4ce2-89ae-3b2e9b946283
X-Archives-Hash: 1339b500528f0b96b7daf30da54131c7

commit:     ccfb9e9f8433a844b3d2f2d9a1dd0c0d05e1f6df
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Feb  3 19:00:18 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Feb  3 19:03:22 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ccfb9e9f

sys-apps/kmod: enable py3.11 and add python bindings smoketest

Thanks to Andrés for the suggestion for the Python test. Now we can
add future Python implementations with confidence.

Closes: https://bugs.gentoo.org/408915
Thanks-to: Andrés Becerra Sandoval <andres.becerra <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-apps/kmod/kmod-30-r1.ebuild | 23 +++++++++++++++++++++--
 sys-apps/kmod/kmod-9999.ebuild  | 25 ++++++++++++++++++++++---
 2 files changed, 43 insertions(+), 5 deletions(-)

diff --git a/sys-apps/kmod/kmod-30-r1.ebuild b/sys-apps/kmod/kmod-30-r1.ebuild
index 9cb6a84d3e0b..18c0daa0974a 100644
--- a/sys-apps/kmod/kmod-30-r1.ebuild
+++ b/sys-apps/kmod/kmod-30-r1.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=8
 
-PYTHON_COMPAT=( python3_{9..10} )
+PYTHON_COMPAT=( python3_{9..11} )
 
 inherit autotools libtool bash-completion-r1 python-r1
 
@@ -26,7 +26,7 @@ IUSE="debug doc +lzma pkcs7 python static-libs +tools +zlib +zstd"
 # I was also told that the test suite is intended for kmod developers.
 # So we have to restrict it.
 # See bug #408915.
-RESTRICT="test"
+#RESTRICT="test"
 
 # - >=zlib-1.2.6 required because of bug #427130
 # - Block systemd below 217 for -static-nodes-indicate-that-creation-of-static-nodes-.patch
@@ -139,6 +139,25 @@ src_compile() {
 	fi
 }
 
+src_test() {
+	python_test() {
+		mkdir "${T}/test-${EPYTHON}" || die
+		emake -C "${BUILD_DIR}" DESTDIR="${T}/test-${EPYTHON}" \
+                                VPATH="${native_builddir}:${S}" \
+                                install-pkgpyexecLTLIBRARIES \
+                                install-dist_pkgpyexecPYTHON
+
+		# Smoke test based on https://bugs.gentoo.org/891975#c5
+		local -x PYTHONPATH="${T}/test-${EPYTHON}/usr/lib/${EPYTHON}/site-packages:${PYTHONPATH}"
+		${EPYTHON} -c 'import kmod; km = kmod.Kmod(); print([(m.name, m.size) for m in km.loaded()])' || die
+		rm -r "${T}/test-${EPYTHON}" || die
+	}
+
+	if use python; then
+		python_foreach_impl python_test
+	fi
+}
+
 src_install() {
 	emake -C "${BUILD_DIR}" DESTDIR="${D}" install
 

diff --git a/sys-apps/kmod/kmod-9999.ebuild b/sys-apps/kmod/kmod-9999.ebuild
index 872dcbbc2737..50b51480db27 100644
--- a/sys-apps/kmod/kmod-9999.ebuild
+++ b/sys-apps/kmod/kmod-9999.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=8
 
-PYTHON_COMPAT=( python3_{9..10} )
+PYTHON_COMPAT=( python3_{9..11} )
 
 inherit autotools libtool bash-completion-r1 python-r1
 
@@ -26,7 +26,7 @@ IUSE="debug doc +lzma pkcs7 python static-libs +tools +zlib +zstd"
 # I was also told that the test suite is intended for kmod developers.
 # So we have to restrict it.
 # See bug #408915.
-RESTRICT="test"
+#RESTRICT="test"
 
 # - >=zlib-1.2.6 required because of bug #427130
 # - Block systemd below 217 for -static-nodes-indicate-that-creation-of-static-nodes-.patch
@@ -60,7 +60,7 @@ fi
 
 REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
 
-DOCS=( NEWS README TODO )
+DOCS=( NEWS README.md TODO )
 
 src_prepare() {
 	default
@@ -132,6 +132,25 @@ src_compile() {
 	fi
 }
 
+src_test() {
+	python_test() {
+		mkdir "${T}/test-${EPYTHON}" || die
+		emake -C "${BUILD_DIR}" DESTDIR="${T}/test-${EPYTHON}" \
+                                VPATH="${native_builddir}:${S}" \
+                                install-pkgpyexecLTLIBRARIES \
+                                install-dist_pkgpyexecPYTHON
+
+		# Smoke test based on https://bugs.gentoo.org/891975#c5
+		local -x PYTHONPATH="${T}/test-${EPYTHON}/usr/lib/${EPYTHON}/site-packages:${PYTHONPATH}"
+		${EPYTHON} -c 'import kmod; km = kmod.Kmod(); print([(m.name, m.size) for m in km.loaded()])' || die
+		rm -r "${T}/test-${EPYTHON}" || die
+	}
+
+	if use python; then
+		python_foreach_impl python_test
+	fi
+}
+
 src_install() {
 	emake -C "${BUILD_DIR}" DESTDIR="${D}" install