1 Star 0 Fork 107

junhe_arm/openEuler-rpm-config

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
kmod.attr 1.80 KB
一键复制 编辑 原始数据 按行查看 历史
Funda Wang 提交于 2025-01-31 14:04 +08:00 . add kabi, kmod dependency generators from fedora
%__kmod_path ^/lib/modules/.*/(modules.builtin|.*\.ko|.*\.ko\.gz|.*\.ko\.bz2|.*\.ko\.xz|.*\.ko\.zst)$
# 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.
%__kmod_provides() %{lua:
function basename(fn)
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
end
function strip_compress_sfx(fn)
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
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)
local nocompr = strip_compress_sfx(builtin_mod)
if nocompr ~= builtin_mod then
printdep(nocompr)
end
end
else
local mod = string.match(bn, "%g+%.ko")
if mod then
printdep(mod)
local nocompr = strip_compress_sfx(mod)
if nocompr ~= mod then
printdep(nocompr)
end
end
end
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/junhe_arm/openEuler-rpm-config.git
git@gitee.com:junhe_arm/openEuler-rpm-config.git
junhe_arm
openEuler-rpm-config
openEuler-rpm-config
master

搜索帮助