11__author__ = 'desultory'
2- __version__ = '2.12.3 '
2+ __version__ = '2.13.0 '
33
44from pathlib import Path
55from subprocess import run
6+ from typing import Union
67
78from zenlib .util import contains , unset
89
@@ -52,11 +53,20 @@ def _process__kmod_auto_multi(self, module: str) -> None:
5253 self ['_kmod_auto' ].append (module )
5354
5455
56+ def _normalize_kmod_name (module : Union [str , list ]) -> str :
57+ """ Replaces -'s with _'s in a kernel module name. """
58+ if isinstance (module , list ) and not isinstance (module , str ):
59+ return [_normalize_kmod_name (m ) for m in module ]
60+ return module .replace ('-' , '_' )
61+
62+
5563def _get_kmod_info (self , module : str ):
5664 """
5765 Runs modinfo on a kernel module, parses the output and stored the results in self['_kmod_modinfo'].
5866 !!! Should be run after metadata is processed so the kver is set properly !!!
5967 """
68+ module = _normalize_kmod_name (module )
69+
6070 if module in self ['_kmod_modinfo' ]:
6171 return self .logger .debug ("[%s] Module info already exists." % module )
6272 args = ['modinfo' , module , '--set-version' , self ['kernel_version' ]]
@@ -77,9 +87,9 @@ def _get_kmod_info(self, module: str):
7787 module_info ['filename' ] = line .split ()[1 ]
7888 elif line .startswith ('depends:' ) and line != 'depends:' :
7989 if ',' in line :
80- module_info ['depends' ] = line .split (':' )[1 ].lstrip ().split (',' )
90+ module_info ['depends' ] = _normalize_kmod_name ( line .split (':' )[1 ].lstrip ().split (',' ) )
8191 else :
82- module_info ['depends' ] = [line .split ()[1 ]]
92+ module_info ['depends' ] = _normalize_kmod_name ( [line .split ()[1 ]])
8393 elif line .startswith ('softdep:' ):
8494 module_info ['softdep' ] = line .split ()[2 ::2 ]
8595 elif line .startswith ('firmware:' ):
0 commit comments