diff options
author | Hannu Nyman <hannu.nyman@iki.fi> | 2015-09-16 12:47:48 +0300 |
---|---|---|
committer | Hannu Nyman <hannu.nyman@iki.fi> | 2015-09-16 12:47:48 +0300 |
commit | 3288fe76ab3d2269abcf902d0df6f847c6200e8e (patch) | |
tree | d888be73618f08826021fae9ef74786c34535405 /modules/luci-base | |
parent | 7347cf00cb3a39e6b33026ad872beee6e3b0c6e7 (diff) |
Luci opkg/packages: Show package size in list of available packages
Add package *.ipk size information to package listing in Luci,
as opkg was today extended to support listing also the size information.
Visible fields are now: name, version, size, description
That will help users considering installation of a certain package
to assess its size impact on flash.
Note: Opkg data includes the size of the .ipk file, not the expanded size.
Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
Diffstat (limited to 'modules/luci-base')
-rw-r--r-- | modules/luci-base/luasrc/model/ipkg.lua | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/modules/luci-base/luasrc/model/ipkg.lua b/modules/luci-base/luasrc/model/ipkg.lua index 41633c43d..2ed92ca70 100644 --- a/modules/luci-base/luasrc/model/ipkg.lua +++ b/modules/luci-base/luasrc/model/ipkg.lua @@ -127,15 +127,15 @@ 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 @@ -143,10 +143,11 @@ local function _list(action, pat, cb) version = version:sub(1,21) .. ".." .. version:sub(-3,-1) end - cb(name, version, desc) + cb(name, version, sz, desc) name = nil version = nil + sz = nil desc = nil end @@ -155,15 +156,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 |