From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 8DDEA138334 for ; Fri, 27 Dec 2019 21:14:53 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 65371E0AC7; Fri, 27 Dec 2019 21:14:52 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 36685E0AC7 for ; Fri, 27 Dec 2019 21:14:52 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 9C71F34DC12 for ; Fri, 27 Dec 2019 21:14:50 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 9B9D034 for ; Fri, 27 Dec 2019 21:14:48 +0000 (UTC) From: "Fabian Groffen" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Fabian Groffen" Message-ID: <1577481239.a7269e48f4961afcc8bc5f0b2d426f645612e973.grobian@gentoo> Subject: [gentoo-commits] proj/portage-utils:master commit in: / X-VCS-Repository: proj/portage-utils X-VCS-Files: qlop.c X-VCS-Directories: / X-VCS-Committer: grobian X-VCS-Committer-Name: Fabian Groffen X-VCS-Revision: a7269e48f4961afcc8bc5f0b2d426f645612e973 X-VCS-Branch: master Date: Fri, 27 Dec 2019 21:14:48 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 83618916-aee5-47a2-ace7-1d00f1880bd3 X-Archives-Hash: 5fbf8c6082b1701a2df4ae303bccc3ea commit: a7269e48f4961afcc8bc5f0b2d426f645612e973 Author: Fabian Groffen gentoo org> AuthorDate: Fri Dec 27 21:13:59 2019 +0000 Commit: Fabian Groffen gentoo org> CommitDate: Fri Dec 27 21:13:59 2019 +0000 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=a7269e48 qlop: report running over estimated time basically try saying something useful, instead of unknown Bug: https://bugs.gentoo.org/701386 Signed-off-by: Fabian Groffen gentoo.org> qlop.c | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/qlop.c b/qlop.c index 634431a..3120d85 100644 --- a/qlop.c +++ b/qlop.c @@ -903,7 +903,9 @@ static int do_emerge_log( if (pkg != NULL) { maxtime = pkg->time / pkg->cnt; if (elapsed >= maxtime) { - maxtime = elapsed >= pkg->tbegin ? 0 : pkg->tbegin; + maxtime = pkg->tbegin; + if (elapsed >= maxtime) + maxtime -= elapsed; isMax = true; } } @@ -928,12 +930,15 @@ static int do_emerge_log( fmt_date(flags, pkgw->tbegin, 0), atom_format(flags->fmt, pkgw->atom)); } - printf("...%s ETA: %s%s\n", - p == NULL ? "" : p, - maxtime == 0 ? "unknown" : - fmt_elapsedtime(flags, maxtime - elapsed), - maxtime > 0 && verbose ? - isMax ? " (longest run)" : " (average run)" : ""); + if (maxtime < 0) + printf("... +%s\n", fmt_elapsedtime(flags, -maxtime)); + else + printf("...%s ETA: %s%s\n", + p == NULL ? "" : p, + maxtime == 0 ? "unknown" : + fmt_elapsedtime(flags, maxtime - elapsed), + maxtime > 0 && verbose ? + isMax ? " (longest run)" : " (average run)" : ""); } clear_set(pkgs_seen); array_for_each(unmerge_matches, i, pkgw) { @@ -957,7 +962,9 @@ static int do_emerge_log( if (pkg != NULL) { maxtime = pkg->time / pkg->cnt; if (elapsed >= maxtime) { - maxtime = elapsed >= pkg->tbegin ? 0 : pkg->tbegin; + maxtime = pkg->tbegin; + if (elapsed >= maxtime) + maxtime -= elapsed; isMax = true; } } @@ -972,11 +979,14 @@ static int do_emerge_log( fmt_date(flags, pkgw->tbegin, 0), atom_format(flags->fmt, pkgw->atom)); } - printf("... ETA: %s%s\n", - maxtime == 0 ? "unknown" : - fmt_elapsedtime(flags, maxtime - elapsed), - maxtime > 0 && verbose ? - isMax ? " (longest run)" : " (average run)" : ""); + if (maxtime < 0) + printf("... +%s\n", fmt_elapsedtime(flags, -maxtime)); + else + printf("... ETA: %s%s\n", + maxtime == 0 ? "unknown" : + fmt_elapsedtime(flags, maxtime - elapsed), + maxtime > 0 && verbose ? + isMax ? " (longest run)" : " (average run)" : ""); } free_set(pkgs_seen); } else if (flags->do_average) {