diff options
author | Boris Nagaev <bnagaev@gmail.com> | 2015-10-29 22:47:27 (GMT) |
---|---|---|
committer | Boris Nagaev <bnagaev@gmail.com> | 2015-11-09 02:04:29 (GMT) |
commit | 28b75d2b58bd0073c4409ed498be3a93fe04f244 (patch) | |
tree | 48dcc7e8c6d75fc38f199706fddaf0a1560a72c4 /tools | |
parent | 2bdd26e4904f1de6db26acc14a914e0c4957353f (diff) | |
download | mxe-28b75d2b58bd0073c4409ed498be3a93fe04f244.zip mxe-28b75d2b58bd0073c4409ed498be3a93fe04f244.tar.gz mxe-28b75d2b58bd0073c4409ed498be3a93fe04f244.tar.bz2 |
build-pkg: print progress
Example:
[ 4/100] The build is expected to complete in 0.3 hours, on Thu Oct 29 23:03:27 2015
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/build-pkg.lua | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/tools/build-pkg.lua b/tools/build-pkg.lua index 7b7497a..a18ff18 100755 --- a/tools/build-pkg.lua +++ b/tools/build-pkg.lua @@ -508,7 +508,9 @@ local function buildPackages(items, item2deps) end return false end - for _, item in ipairs(items) do + local nitems = #items + local started_at = os.time() + for i, item in ipairs(items) do if not brokenDep(item) then local files = buildItem(item, item2deps, file2item) if isBuilt(item, files) then @@ -524,6 +526,16 @@ local function buildPackages(items, item2deps) log('Item %s depends on broken item %s', item, brokenDep(item)) end + local now = os.time() + local spent = now - started_at + local predicted_duration = spent * nitems / i + local predicted_end = started_at + predicted_duration + local predicted_end_str = os.date("%c", predicted_end) + local predicted_wait = predicted_end - now + local predicted_wait_hours = predicted_wait / 3600.0 + echo("[%3d/%d] The build is expected to complete " .. + "in %0.1f hours, on %s", i, nitems, + predicted_wait_hours, predicted_end_str) end return unbroken, item2files end |