Blame SOURCES/lua.attr

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