From 4b02f1df76adfca15bc34192e3d8ed82239e6a5b Mon Sep 17 00:00:00 2001 From: Maurizio Lombardi Date: Wed, 2 Aug 2023 14:20:03 +0200 Subject: [PATCH] rtslib: explicitely import kmod's error and Kmod modules Signed-off-by: Maurizio Lombardi --- ...tely-import-kmod.error-and-kmod.Kmod.patch | 35 +++++++++++++++++++ python-rtslib.spec | 7 +++- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 0002-rtslib-explicitely-import-kmod.error-and-kmod.Kmod.patch diff --git a/0002-rtslib-explicitely-import-kmod.error-and-kmod.Kmod.patch b/0002-rtslib-explicitely-import-kmod.error-and-kmod.Kmod.patch new file mode 100644 index 0000000..012d2ad --- /dev/null +++ b/0002-rtslib-explicitely-import-kmod.error-and-kmod.Kmod.patch @@ -0,0 +1,35 @@ +From c1378f28f7abce6f8993a43c34d5e287b092bb1e Mon Sep 17 00:00:00 2001 +From: Maurizio Lombardi +Date: Wed, 2 Aug 2023 12:00:41 +0200 +Subject: [PATCH] rtslib: explicitely import "kmod.error" and "kmod.Kmod" + +While updating python-kmod to be able to be compiled with Cython 3.0, +I encountered a failure due to rtslib not finding the "error" and "Kmod" +modules. + +$ targetcli +module 'kmod' has no attribute 'error' + +If I explicitely import those two modules the failure goes away. + +Signed-off-by: Maurizio Lombardi +--- + rtslib/utils.py | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/rtslib/utils.py b/rtslib/utils.py +index 61e486a80836..630ebb721465 100644 +--- a/rtslib/utils.py ++++ b/rtslib/utils.py +@@ -423,6 +423,8 @@ def modprobe(module): + + try: + import kmod ++ import kmod.error ++ import kmod.Kmod + except ImportError: + process = subprocess.Popen(("modprobe", module), + stdout=subprocess.PIPE, +-- +2.39.3 + diff --git a/python-rtslib.spec b/python-rtslib.spec index bfa8233..7eaf7f2 100644 --- a/python-rtslib.spec +++ b/python-rtslib.spec @@ -7,10 +7,11 @@ Name: python-rtslib License: ASL 2.0 Summary: API for Linux kernel LIO SCSI target Version: 2.1.76 -Release: 3%{?dist} +Release: 4%{?dist} URL: https://github.com/open-iscsi/%{oname} Source: %{url}/archive/v%{version}/%{oname}-%{version}.tar.gz Patch0: 0001-disable-xen_pvscsi.patch +Patch1: 0002-rtslib-explicitely-import-kmod.error-and-kmod.Kmod.patch BuildArch: noarch %if %{with apidocs} BuildRequires: epydoc @@ -70,6 +71,7 @@ on system restart. %prep %setup -q -n %{oname}-%{version} %patch0 -p1 +%patch1 -p1 %build @@ -126,6 +128,9 @@ install -m 644 doc/saveconfig.json.5 %{buildroot}%{_mandir}/man5/ %endif %changelog +* Wed Aug 02 2023 Maurizio Lombardi - 2.1.76-4 +- Fix kmod import + * Fri Jul 21 2023 Fedora Release Engineering - 2.1.76-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild