Implement %py_provides

This commit is contained in:
Miro Hrončok 2020-04-28 18:48:51 +02:00
commit 8fea79b1ec
2 changed files with 25 additions and 1 deletions

View file

@ -137,3 +137,24 @@
\
print(url .. first .. '/' .. src .. '/' .. src .. '-' .. ver .. '.' .. ext)
}
%py_provides() %{lua:
local python = require 'fedora.srpm.python'
local name = rpm.expand('%1')
if name == '%1' then
rpm.expand('%{error:%%py_provides requires at least 1 argument, the name to provide}')
end
local evr = rpm.expand('%2')
if evr == '%2' then
evr = rpm.expand('%{?epoch:%{epoch}:}%{version}-%{release}')
end
print('Provides: ' .. name .. ' = ' .. evr .. '\\n')
local provides = python.python_altprovides_once(name, evr)
-- provides is either an array/table or nil
-- nil means the function was already called with the same arguments
if provides then
for i, provide in ipairs(provides) do
print('Provides: ' .. provide .. '\\n')
end
end
}