initial fix

This commit is contained in:
MihailRis 2025-09-21 23:46:09 +03:00
parent 7dab722561
commit f02e6c65d8
2 changed files with 32 additions and 22 deletions

View File

@ -255,30 +255,33 @@ function check_dependencies(packinfo)
if packinfo.dependencies == nil then if packinfo.dependencies == nil then
return return
end end
for i,dep in ipairs(packinfo.dependencies) do for i, dep in ipairs(packinfo.dependencies) do
local depid, depver = unpack(string.split(dep:sub(2,-1), "@")) local depid, depver = unpack(string.split(dep:sub(2,-1), "@"))
if dep:sub(1,1) == '!' then if dep:sub(1,1) ~= '!' then
goto continue
end
if not table.has(packs_all, depid) then if not table.has(packs_all, depid) then
return string.format( return string.format(
"%s (%s)", gui.str("error.dependency-not-found"), depid "%s (%s)", gui.str("error.dependency-not-found"), depid
) )
end end
local dep_pack = pack.get_info(depid); local dep_pack = pack.get_info(depid);
if not compare_version(depver, dep_pack.version) then if not compare_version(depver, dep_pack.version) then
local op, ver = Version.parse(depver); local op, ver = Version.parse(depver)
return string.format(
print(string.format("%s: %s !%s %s (%s)", gui.str("error.dependency-version-not-met"), dep_pack.version, op, ver, depid)); "%s: %s != %s (%s)",
return string.format("%s: %s != %s (%s)", gui.str("error.dependency-version-not-met"), dep_pack.version, ver, depid); gui.str("error.dependency-version-not-met"),
dep_pack.version, ver, depid
);
end end
if table.has(packs_installed, packinfo.id) then if table.has(packs_installed, packinfo.id) then
table.insert(required, depid) table.insert(required, depid)
end end
end ::continue::
end end
return return
end end

View File

@ -115,7 +115,14 @@ static int l_pack_get_info(
throw std::runtime_error(""); throw std::runtime_error("");
} }
lua::pushfstring(L, "%s%s@%s%s", prefix.c_str(), dpack.id.c_str(), dpack.op.c_str(), dpack.version.c_str()); lua::pushfstring(
L,
"%s%s@%s%s",
prefix.c_str(),
dpack.id.c_str(),
dpack.op != "=" ? dpack.op.c_str() : "",
dpack.version.c_str()
);
lua::rawseti(L, i + 1); lua::rawseti(L, i + 1);
} }
lua::setfield(L, "dependencies"); lua::setfield(L, "dependencies");