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>
This commit is contained in:
parent
cfaf1a56f7
commit
956da198f9
16
kmod.attr
16
kmod.attr
@ -1,21 +1,31 @@
|
|||||||
%__kmod_path ^/lib/modules/.*/(modules.builtin|.*ko)
|
%__kmod_path ^/lib/modules/.*/(modules.builtin|.*\.ko|.*\.ko\.gz|.*\.ko\.bz2|.*\.ko\.xz)$
|
||||||
%__kmod_provides() %{lua:
|
%__kmod_provides() %{lua:
|
||||||
function basename(fn)
|
function basename(fn)
|
||||||
return string.gsub(fn, "(.*/)(.*)", "%2")
|
return string.gsub(fn, "(.*/)(.*)", "%2")
|
||||||
end
|
end
|
||||||
|
function strip_compress_sfx(fn)
|
||||||
|
return string.gsub(fn, "(.*)(\.gz|\.bz2|\.xz)?$", "%1")
|
||||||
|
end
|
||||||
function printdep(mod)
|
function printdep(mod)
|
||||||
print("kmod("..mod..")")
|
print("kmod("..mod..") ")
|
||||||
end
|
end
|
||||||
local fn = rpm.expand("%{1}")
|
local fn = rpm.expand("%{1}")
|
||||||
local bn = basename(fn)
|
local bn = basename(fn)
|
||||||
if bn == "modules.builtin" then
|
if bn == "modules.builtin" then
|
||||||
for l in io.lines(fn) do
|
for l in io.lines(fn) do
|
||||||
printdep(basename(l))
|
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
|
end
|
||||||
else
|
else
|
||||||
local mod = string.match(bn, "%g+.ko")
|
local mod = string.match(bn, "%g+.ko")
|
||||||
if mod then
|
if mod then
|
||||||
printdep(mod)
|
printdep(mod)
|
||||||
|
if strip_compress_sfx(mod) ~= mod then
|
||||||
|
printdep(strip_compress_sfx(mod))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user