summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apk-model.lua23
1 files changed, 15 insertions, 8 deletions
diff --git a/apk-model.lua b/apk-model.lua
index 32fa7f4..f44e78d 100644
--- a/apk-model.lua
+++ b/apk-model.lua
@@ -41,7 +41,7 @@ local reload_upgrades = function()
local f = modelfunctions.run_executable({"apk", "version", "-l", "<"})
for line in string.gmatch(f, "[^\n]+") do
local name = string.match(line, "(%S+)%-%d")
- if repo[name] then
+ if name and repo[name] then
repo[name].upgrade = true
end
end
@@ -63,11 +63,13 @@ local reload_installed = function()
local f = modelfunctions.run_executable({"apk", "info", "-vv"})
for line in string.gmatch(f, "[^\n]+") do
local name, ver, comment = string.match(line, "(%S+)%-(%d+%S*)%s+%-%s+(.*)")
- if not repo[name] then
- repo[name] = {}
+ if name then
+ if not repo[name] then
+ repo[name] = {}
+ end
+ repo[name].installed = ver
+ repo[name].comment = comment
end
- repo[name].installed = ver
- repo[name].comment = comment
end
install_cache = true
end
@@ -109,7 +111,7 @@ find_dependents = function(package)
repo[package].dependents = {}
local f = modelfunctions.run_executable({"apk", "info", "-R", package})
for line in string.gmatch(f, "[^\n]+") do
- if not line:find("depends on:") and not line:find("^%s*$") then
+ if not line:find(":") and not line:find("^%s*$") then
table.insert(repo[package].dependents, line)
for i,dep in ipairs(find_dependents(line, saved, output)) do
table.insert(repo[package].dependents, dep)
@@ -349,8 +351,13 @@ mymodule.get_package_details = function(package)
details.installed.value = repo[package].installed
details.comment.value = repo[package].comment
local cmdresult = format.string_to_table((modelfunctions.run_executable({"apk", "info", "-ws", package})), "\n")
- details.webpage.value = cmdresult[2] or ""
- details.size.value = cmdresult[5] or ""
+ for i,line in ipairs(cmdresult) do
+ if string.find(line, " webpage:$") then
+ details.webpage.value = cmdresult[i+1] or ""
+ elseif string.find(line, " size:$") then
+ details.size.value = cmdresult[i+1] or ""
+ end
+ end
local dependents = find_dependents(package)
table.insert(dependents, 1, package)
local revdeps = {}