improve autoupdate

pull/2414/merge
ruki 11 months ago
parent 15ad332bc1
commit f37f033e9e
  1. 14
      scripts/checkupdate.lua

@ -98,6 +98,18 @@ function _check_version_from_github_releases(package, url)
end end
end end
function _version_is_behind_conditions(package)
local scriptfile = path.join(package:scriptdir(), "xmake.lua")
local file = io.open(scriptfile)
for line in file:lines() do
local pos = line:find("add_versions", 1, true) or line:find("add_versionfiles", 1, true)
if pos and pos > 5 then
return true
end
end
file:close()
end
function main(package) function main(package)
local checkers = { local checkers = {
["https://github%.com/.-/.-/archive/refs/tags/.*"] = _check_version_from_github_tags, ["https://github%.com/.-/.-/archive/refs/tags/.*"] = _check_version_from_github_tags,
@ -105,7 +117,7 @@ function main(package)
} }
for _, url in ipairs(package:urls()) do for _, url in ipairs(package:urls()) do
for pattern, checker in pairs(checkers) do for pattern, checker in pairs(checkers) do
if url:match(pattern) then if url:match(pattern) and not _version_is_behind_conditions(package) then
return checker(package, url) return checker(package, url)
end end
end end

Loading…
Cancel
Save