Added versions to SolvitDB

This commit is contained in:
2026-05-03 19:12:19 +03:00
parent d84324c707
commit f275247b00
+7
View File
@@ -144,6 +144,9 @@ function solvitdb.set(path, name, data)
if data.packages then if data.packages then
encodedString = encodedString .. "p" .. table.concat(data.packages, ";") .. "." encodedString = encodedString .. "p" .. table.concat(data.packages, ";") .. "."
end end
if data.version then
encodedString = encodedString .. "v" .. data.version .. "."
end
writeHandle:write(encodedString .. "\n") writeHandle:write(encodedString .. "\n")
writeHandle:seek("set", patLength + 8) -- + 8 because that's the length of the header writeHandle:seek("set", patLength + 8) -- + 8 because that's the length of the header
local patData = ("%s.%s;"):format(name, string.pack("<I4", newPackageLocation)) local patData = ("%s.%s;"):format(name, string.pack("<I4", newPackageLocation))
@@ -203,12 +206,16 @@ function solvitdb.get(path, name)
elseif series:sub(1, 1) == "p" then elseif series:sub(1, 1) == "p" then
output.packages = {} output.packages = {}
seriesOutput = output.packages seriesOutput = output.packages
elseif series:sub(1, 1) == "v" then
output.version = series:sub(2, -1)
goto SkipSeries
end end
-- Finally a case where Lua's weird table linking shenanigans are actually useful -- Finally a case where Lua's weird table linking shenanigans are actually useful
series = series:sub(2, -1) series = series:sub(2, -1)
for seriesItem in series:gmatch("[^;]+") do for seriesItem in series:gmatch("[^;]+") do
table.insert(seriesOutput, seriesItem) table.insert(seriesOutput, seriesItem)
end end
::SkipSeries::
end end
return output return output
end end