--- a/macros.lua 2021-10-01 17:41:04.000000000 +0300 +++ b/macros.lua 2021-10-18 14:23:44.188532741 +0300 @@ -54,6 +54,30 @@ -- find the spec file specpath = rpm.expand("%_specfile") + + if posix.stat(specpath, "mode") == nil then + specpath = nil + local locations = { rpm.expand("%_sourcedir"), rpm.expand("%_specdir"), posix.getcwd(), posix.getcwd() .. "/" .. name } + for _,loc in ipairs(locations) do + local filename = loc .. "/" .. name .. ".spec" + if posix.stat(filename, "mode") ~= nil then + specpath = filename + break + else + local filename_candidate = io.popen("ls " .. loc .. "/*.spec"):read("*a"):gsub("%s+$","") + for filename in filename_candidate:gmatch("[^\n]+") do + if posix.stat(filename, "mode") ~= nil then + specpath = filename + break + end + end + if specpath ~= nil then + break + end + end + end + end + end function python_subpackages()