Blame SOURCES/0009-Do-not-use-BlockDev-utils_have_kernel_module-to-check-for-modules.patch

8c0629
From 7303f4a3f2fe3280339f6303dcff31b6ade12176 Mon Sep 17 00:00:00 2001
8c0629
From: Vojtech Trefny <vtrefny@redhat.com>
8c0629
Date: Thu, 9 Jul 2020 16:30:55 +0200
8c0629
Subject: [PATCH] Do not use BlockDev.utils_have_kernel_module to check for
8c0629
 modules
8c0629
8c0629
The function unfortunately uses only the name when searching for
8c0629
the module and we need to use aliases for modules like ext2 and
8c0629
ext3. So we need to use "modprobe --dry-run" instead.
8c0629
---
8c0629
 blivet/formats/fs.py | 12 +++---------
8c0629
 1 file changed, 3 insertions(+), 9 deletions(-)
8c0629
8c0629
diff --git a/blivet/formats/fs.py b/blivet/formats/fs.py
8c0629
index eee15aaa..bcfbc08e 100644
8c0629
--- a/blivet/formats/fs.py
8c0629
+++ b/blivet/formats/fs.py
8c0629
@@ -60,12 +60,6 @@
8c0629
 import logging
8c0629
 log = logging.getLogger("blivet")
8c0629
 
8c0629
-import gi
8c0629
-gi.require_version("GLib", "2.0")
8c0629
-gi.require_version("BlockDev", "2.0")
8c0629
-
8c0629
-from gi.repository import GLib
8c0629
-from gi.repository import BlockDev
8c0629
 
8c0629
 AVAILABLE_FILESYSTEMS = kernel_filesystems
8c0629
 
8c0629
@@ -462,13 +456,13 @@ def check_module(self):
8c0629
 
8c0629
         for module in self._modules:
8c0629
             try:
8c0629
-                succ = BlockDev.utils_have_kernel_module(module)
8c0629
-            except GLib.GError as e:
8c0629
+                rc = util.run_program(["modprobe", "--dry-run", module])
8c0629
+            except OSError as e:
8c0629
                 log.error("Could not check kernel module availability %s: %s", module, e)
8c0629
                 self._supported = False
8c0629
                 return
8c0629
 
8c0629
-            if not succ:
8c0629
+            if rc:
8c0629
                 log.debug("Kernel module %s not available", module)
8c0629
                 self._supported = False
8c0629
                 return