2021-11-17 11:38:00 +00:00
|
|
|
%__kmod_path ^/lib/modules/.*/(modules.builtin|.*\.ko|.*\.ko\.gz|.*\.ko\.bz2|.*\.ko\.xz|.*\.ko\.zst)$
|
2023-05-04 10:45:22 +00:00
|
|
|
|
|
|
|
# Notes on Lua:
|
|
|
|
# The backslash in strings (like "\n" newline) needs to be doubled
|
|
|
|
# because we are inside rpm macro. Single backslashes before most chars
|
|
|
|
# disappear (removed by rpm's parser), so "\n" turns into just "n".
|
|
|
|
# In string.gsub patterns, unlike regexps, backslash has no special meaning.
|
|
|
|
# It can't escape . and such. (Use one-character set [.] to represent
|
|
|
|
# literal period, or lua's percent escape: %.)
|
|
|
|
# Pipe (|) has no special meaning too.
|
|
|
|
|
2021-06-03 15:25:29 +00:00
|
|
|
%__kmod_provides() %{lua:
|
|
|
|
function basename(fn)
|
2023-05-04 10:45:22 +00:00
|
|
|
local b = string.gsub(fn, ".*/", "")
|
|
|
|
-- the above adjusts gsub() result to 1 value
|
|
|
|
-- "return f()" construct would return _all_ values, two in case of gsub()
|
|
|
|
return b
|
2021-06-03 15:25:29 +00:00
|
|
|
end
|
2021-11-15 23:19:11 +00:00
|
|
|
function strip_compress_sfx(fn)
|
2023-05-04 10:45:22 +00:00
|
|
|
local cnt
|
|
|
|
fn, cnt = string.gsub(fn, "%.gz$", "")
|
|
|
|
if cnt == 1 then return fn; end
|
|
|
|
fn, cnt = string.gsub(fn, "%.bz2$", "")
|
|
|
|
if cnt == 1 then return fn; end
|
|
|
|
fn, cnt = string.gsub(fn, "%.xz$", "")
|
|
|
|
if cnt == 1 then return fn; end
|
|
|
|
fn, cnt = string.gsub(fn, "%.zst$", "")
|
|
|
|
return fn
|
2021-11-15 23:19:11 +00:00
|
|
|
end
|
2021-06-03 15:25:29 +00:00
|
|
|
function printdep(mod)
|
2021-11-15 23:19:11 +00:00
|
|
|
print("kmod("..mod..") ")
|
2021-06-03 15:25:29 +00:00
|
|
|
end
|
2023-05-04 10:55:15 +00:00
|
|
|
local fn = rpm.expand("%1")
|
2021-06-03 15:25:29 +00:00
|
|
|
local bn = basename(fn)
|
|
|
|
if bn == "modules.builtin" then
|
|
|
|
for l in io.lines(fn) do
|
2021-11-15 23:19:11 +00:00
|
|
|
local builtin_mod = basename(l)
|
|
|
|
printdep(builtin_mod)
|
2023-05-04 10:43:01 +00:00
|
|
|
local nocompr = strip_compress_sfx(builtin_mod)
|
|
|
|
if nocompr ~= builtin_mod then
|
|
|
|
printdep(nocompr)
|
2021-11-15 23:19:11 +00:00
|
|
|
end
|
2021-06-03 15:25:29 +00:00
|
|
|
end
|
|
|
|
else
|
2023-05-04 10:37:36 +00:00
|
|
|
local mod = string.match(bn, "%g+%.ko")
|
2021-06-03 15:25:29 +00:00
|
|
|
if mod then
|
2023-05-04 10:55:15 +00:00
|
|
|
printdep(mod)
|
|
|
|
local nocompr = strip_compress_sfx(mod)
|
|
|
|
if nocompr ~= mod then
|
|
|
|
printdep(nocompr)
|
|
|
|
end
|
2021-06-03 15:25:29 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
}
|