lua/lua.attr
Miro Hrončok ab3d82cbb9 Add lua(abi) requirements generator (requires RPM 4.16+)
Any package that installs to /usr/lib(64)/lua/X.Y/ or /usr/share/lua/X.Y/
will require lua(abi) = X.Y.

Co-own the RPM directories to avoid a dependency on RPM (or not owned directory).
2020-07-01 01:26:06 +02:00

20 lines
713 B
Plaintext

%__lua_requires() %{lua:
-- Match buildroot paths of the form
-- /PATH/OF/BUILDROOT/usr/lib(64)/lua/MAJOR.MINOR/ and
-- /PATH/OF/BUILDROOT/usr/share/pythonMAJOR.MINOR/
-- generating a line of the form:
-- lua(abi) = MAJOR.MINOR
local path = rpm.expand('%1')
local datadir = rpm.expand('%_datadir')
local libdir = rpm.expand('%_libdir')
for i, dir in ipairs({datadir, libdir}) do
if path:match(dir .. '/lua/%d+%.%d+/.*') then
local requires = path:gsub('.*' .. dir .. '/lua/(%d+%.%d+)/.*', 'lua(abi) = %1')
print(requires)
break
end
end
}
%__lua_path ^(%{_datadir}|%{_libdir})/lua/[[:digit:]]+\\.[[:digit:]]+/.+