aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2018-09-12 19:28:44 +0200
committerCarlo Landmeter <clandmeter@alpinelinux.org>2019-11-11 15:34:55 +0000
commit5181bf9e574b445c7816bd4d6b16ff5653bcfb2f (patch)
treeb21c41c7ab29ce5eb1f34a8eabd3502fe0329dd9
parent58bc96236c25193450624d392955e3b9453e1934 (diff)
downloadalpine-mirror-status-master.tar.bz2
alpine-mirror-status-master.tar.xz
fix progress indicatorHEADmaster
print the grand total since we fetch mirrors async
-rwxr-xr-xgenerate-json.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/generate-json.lua b/generate-json.lua
index f8448ba..d43ba3e 100755
--- a/generate-json.lua
+++ b/generate-json.lua
@@ -8,6 +8,8 @@ local utils = require("utils")
local conf = require("config")
local cqueues = require("cqueues")
+local total_indexes = 0
+
----
-- convert apkindex list to a table
function get_apkindexes()
@@ -84,7 +86,7 @@ end
function progress(num)
if arg[1] == "debug" then
num = (num < 10) and "0"..num or num
- io.write(("Indexes left: %s\r"):format(num))
+ io.write(("Indexes left: %s \r"):format(num))
io.flush()
end
end
@@ -96,6 +98,7 @@ function check_apkindexes(mirror)
local qty = 0
local cnt = 0
local allowed_archs = utils.to_list(conf.archs)
+ total_indexes = total_indexes + num_indexes
for branch in utils.kpairs(indexes, utils.sort_branch) do
local repos = {}
for repo in utils.kpairs(indexes[branch], utils.sort_repo) do
@@ -108,7 +111,8 @@ function check_apkindexes(mirror)
if status == "200" then qty = qty+1 end
end
cnt = cnt + 1
- progress(num_indexes-cnt)
+ total_indexes = total_indexes - 1
+ progress(total_indexes)
end
table.insert(repos, {name=repo, arch=archs})
end