diff options
Diffstat (limited to 'modules/luci-base/luasrc/model/ipkg.lua')
-rw-r--r-- | modules/luci-base/luasrc/model/ipkg.lua | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/modules/luci-base/luasrc/model/ipkg.lua b/modules/luci-base/luasrc/model/ipkg.lua index 41633c43d7..e653b03465 100644 --- a/modules/luci-base/luasrc/model/ipkg.lua +++ b/modules/luci-base/luasrc/model/ipkg.lua @@ -127,26 +127,29 @@ local function _list(action, pat, cb) (pat and (" '%s'" % pat:gsub("'", "")) or "")) if fd then - local name, version, desc + local name, version, sz, desc while true do local line = fd:read("*l") if not line then break end - name, version, desc = line:match("^(.-) %- (.-) %- (.+)") + name, version, sz, desc = line:match("^(.-) %- (.-) %- (.-) %- (.+)") if not name then - name, version = line:match("^(.-) %- (.+)") + name, version, sz = line:match("^(.-) %- (.-) %- (.+)") desc = "" end - if #version > 26 then - version = version:sub(1,21) .. ".." .. version:sub(-3,-1) - end + if name and version then + if #version > 26 then + version = version:sub(1,21) .. ".." .. version:sub(-3,-1) + end - cb(name, version, desc) + cb(name, version, sz, desc) + end name = nil version = nil + sz = nil desc = nil end @@ -155,15 +158,15 @@ local function _list(action, pat, cb) end function list_all(pat, cb) - _list("list", pat, cb) + _list("list --size", pat, cb) end function list_installed(pat, cb) - _list("list_installed", pat, cb) + _list("list_installed --size", pat, cb) end function find(pat, cb) - _list("find", pat, cb) + _list("find --size", pat, cb) end @@ -237,4 +240,3 @@ function compare_versions(ver1, comp, ver2) -- all equal and not compare greater or lower then true return not (comp == "<" or comp == ">") end - |