Blame SOURCES/lua.attr

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