diff options
author | Ted Trask <ttrask01@yahoo.com> | 2013-11-09 04:16:24 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2013-11-09 04:16:24 +0000 |
commit | 575a460374ca22192a955f3010f5f8342f96d3fc (patch) | |
tree | b280c211a0e6f3d97ea5dde93539f87d854f9922 /apk-model.lua | |
parent | bbb53e657f8f19043a4e10bcae55b1b01ed9c5ee (diff) | |
download | acf-apk-tools-575a460374ca22192a955f3010f5f8342f96d3fc.tar.bz2 acf-apk-tools-575a460374ca22192a955f3010f5f8342f96d3fc.tar.xz |
Update to account for warning messages in apk output
Diffstat (limited to 'apk-model.lua')
-rw-r--r-- | apk-model.lua | 23 |
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 = {} |