Browse Source

Fix freshnaut for update_names that don't contain a version number

master
mid-kid 8 years ago
parent
commit
cd162a6b49
  1. 10
      astronaut/freshnaut

10
astronaut/freshnaut

@ -74,7 +74,13 @@ function make_regex(filename, version)
-- Returns two regexes, meant to be used in a loop. (See code using this function to know what I mean) -- Returns two regexes, meant to be used in a loop. (See code using this function to know what I mean)
--]]-- --]]--
local regex = escape_regex(filename:gsub(escape_regex(version), "{{version}}"):gsub("%%", "%%%%")) local temp_filename = filename:gsub(escape_regex(version), "{{version}}")
if temp_filename == filename then
-- If we can't find version in filename, return.
return nil, nil
end
local regex = escape_regex(temp_filename:gsub("%%", "%%%%"))
return regex:gsub("{{version}}", "(.-") .. ")", regex:gsub(".*{{version}}", "(.-)") return regex:gsub("{{version}}", "(.-") .. ")", regex:gsub(".*{{version}}", "(.-)")
end end
@ -118,6 +124,7 @@ function get_available_versions(satellite)
for update_name in update_names:gmatch("[^,]+") do for update_name in update_names:gmatch("[^,]+") do
local loop_regex, end_regex = make_regex(update_name, version) local loop_regex, end_regex = make_regex(update_name, version)
if loop_regex and end_regex then
for x in update_file:gmatch(loop_regex) do for x in update_file:gmatch(loop_regex) do
-- Sometimes, the match starts way too soon, and we get a very long "version" number. -- Sometimes, the match starts way too soon, and we get a very long "version" number.
-- Here we make sure we really get the shortest possible match. -- Here we make sure we really get the shortest possible match.
@ -132,6 +139,7 @@ function get_available_versions(satellite)
count = count + 1 count = count + 1
end end
end end
end
io.stderr:write("\x1B[1K\r") io.stderr:write("\x1B[1K\r")

Loading…
Cancel
Save