Make %py_provides work repeatedly
This commit is contained in:
parent
8fea79b1ec
commit
5fe974759a
@ -149,12 +149,8 @@
|
|||||||
evr = rpm.expand('%{?epoch:%{epoch}:}%{version}-%{release}')
|
evr = rpm.expand('%{?epoch:%{epoch}:}%{version}-%{release}')
|
||||||
end
|
end
|
||||||
print('Provides: ' .. name .. ' = ' .. evr .. '\\n')
|
print('Provides: ' .. name .. ' = ' .. evr .. '\\n')
|
||||||
local provides = python.python_altprovides_once(name, evr)
|
local provides = python.python_altprovides(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
|
for i, provide in ipairs(provides) do
|
||||||
print('Provides: ' .. provide .. '\\n')
|
print('Provides: ' .. provide .. '\\n')
|
||||||
end
|
end
|
||||||
end
|
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,11 @@ end
|
|||||||
-- Uses python_altnames under the hood
|
-- Uses python_altnames under the hood
|
||||||
-- Returns a table/array with strings.
|
-- Returns a table/array with strings.
|
||||||
local function python_altprovides(name, evr)
|
local function python_altprovides(name, evr)
|
||||||
|
-- global cache that tells what provides were already processed
|
||||||
|
if __python_altnames_provides_beenthere == nil then
|
||||||
|
__python_altnames_provides_beenthere = {}
|
||||||
|
end
|
||||||
|
__python_altnames_provides_beenthere[name .. ' ' .. evr] = true
|
||||||
local altprovides = {}
|
local altprovides = {}
|
||||||
for i, altname in ipairs(python_altnames(name)) do
|
for i, altname in ipairs(python_altnames(name)) do
|
||||||
table.insert(altprovides, altname .. ' = ' .. evr)
|
table.insert(altprovides, altname .. ' = ' .. evr)
|
||||||
@ -41,6 +46,7 @@ end
|
|||||||
|
|
||||||
-- Like python_altprovides but only return something once.
|
-- Like python_altprovides but only return something once.
|
||||||
-- For each argument can only be used once, returns nil otherwise.
|
-- For each argument can only be used once, returns nil otherwise.
|
||||||
|
-- Previous usage of python_altprovides counts as well.
|
||||||
local function python_altprovides_once(name, evr)
|
local function python_altprovides_once(name, evr)
|
||||||
-- global cache that tells what provides were already processed
|
-- global cache that tells what provides were already processed
|
||||||
if __python_altnames_provides_beenthere == nil then
|
if __python_altnames_provides_beenthere == nil then
|
||||||
|
Loading…
Reference in New Issue
Block a user