As reported in gentoo-user [1], genlop -c displays apparently incorrect ETAs, that can differ significantly from the previous merge times. The incorrect merge time estimate in [1] (68 minutes and 27 seconds) matches the result of summing the three previous merge times and dividing by two [2]. When working with the array of merge times, the block of code where this is computed appears to use the index of the last element as the array length, causing the average issue. Reproducible: Always Steps to Reproduce: 1. With a clear emerge log, emerge a "big" package three times 2. Inspect the output of genlop -t, and compute the average (a) and the sum of merge times divided by two (b) 3. Build the same package a fourth time, and check the estimate calculated by genlop -c (by adding "current merge time" and "ETA"). Actual Results: The estimate presented by genlop -c should match (a) but will match (b).
Oops, sorry, forgot this: [1] Peter Humphrey's message of 2024-01-05: news://news.gmane.io/6020182.lOV4Wx5bFT@cube or https://marc.info/?l=gentoo-user&m=170449865110064&w=2 [2] my message of 2024-01-07: news://news.gmane.io/undsb2$app$1@ciao.gmane.io or https://marc.info/?l=gentoo-user&m=170462117718651&w=2
Created attachment 882303 [details, diff] genlop patch to adjust the average calculation and the slicing condition An attempt to address the issue; as so far I've only rarely written/modified perl code, please let me know if there is anything that I've overlooked. The affected code block was added in bug 658940; this patch changes the average calculation to add 1 to the denominator, and adjusts the condition used for slicing. (I haven't yet had the chance to test this locally, though.)
Yeah, it looks like "$#merge_times" returns the index of the last array element (which is zero-based), not the length of the array. Thus, your patch should be correct. Back when I created this patch, I haven't been familiar with perl - and that didn't change until today. In that sense: LGTM
Can confirm that the patch returns sane estimates - thanks!
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=42120a6726b6683906180fa32a69af7c716f5292 commit 42120a6726b6683906180fa32a69af7c716f5292 Author: Sam James <sam@gentoo.org> AuthorDate: 2024-03-10 05:36:15 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2024-03-10 05:38:24 +0000 app-portage/genlop: add 0.30.12 Closes: https://bugs.gentoo.org/922144 Signed-off-by: Sam James <sam@gentoo.org> app-portage/genlop/Manifest | 1 + app-portage/genlop/genlop-0.30.12.ebuild | 34 ++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+)