kernel-srpm-macros/kmod.attr
Eugene Syromiatnikov f9fcd7463c kmod.attr: add compressed kmod support
* kmod.attr (%__kmod_path): Add ".*\.ko\.gz|.*\.ko\.bz2|.*\.ko\.xz"
to he module path matching regular expression endings.
(%__kmod_provides) <strip_compress_sfx>: New function.
(%__kmod_provides): Generate dependencies with module file name without
compressed extension (just ".ko") for compressed modules.

Resolves: #1942537
Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
2021-11-18 14:22:00 +01:00

32 lines
930 B
Plaintext

%__kmod_path ^/lib/modules/.*/(modules.builtin|.*\.ko|.*\.ko\.gz|.*\.ko\.bz2|.*\.ko\.xz)$
%__kmod_provides() %{lua:
function basename(fn)
return string.gsub(fn, "(.*/)(.*)", "%2")
end
function strip_compress_sfx(fn)
return string.gsub(fn, "(.*)(\.gz|\.bz2|\.xz)?$", "%1")
end
function printdep(mod)
print("kmod("..mod..") ")
end
local fn = rpm.expand("%{1}")
local bn = basename(fn)
if bn == "modules.builtin" then
for l in io.lines(fn) do
local builtin_mod = basename(l)
printdep(builtin_mod)
if strip_compress_sfx(builtin_mod) ~= builtin_mod then
printdep(strip_compress_sfx(builtin_mod))
end
end
else
local mod = string.match(bn, "%g+.ko")
if mod then
printdep(mod)
if strip_compress_sfx(mod) ~= mod then
printdep(strip_compress_sfx(mod))
end
end
end
}