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 86089138334 for ; Tue, 10 Sep 2019 18:25:16 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id C55A9E082B; Tue, 10 Sep 2019 18:25:15 +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 8E886E082B for ; Tue, 10 Sep 2019 18:25:15 +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 6325434AF91 for ; Tue, 10 Sep 2019 18:25:14 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 0CB577E8 for ; Tue, 10 Sep 2019 18:25:13 +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: <1568139711.3dc607a8a6cfd3bafbc2f10d9a7c3aae90c3a757.grobian@gentoo> Subject: [gentoo-commits] proj/portage-utils:master commit in: /, man/ X-VCS-Repository: proj/portage-utils X-VCS-Files: man/qlop.1 qlop.c X-VCS-Directories: man/ / X-VCS-Committer: grobian X-VCS-Committer-Name: Fabian Groffen X-VCS-Revision: 3dc607a8a6cfd3bafbc2f10d9a7c3aae90c3a757 X-VCS-Branch: master Date: Tue, 10 Sep 2019 18:25:13 +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: 8115907f-e196-4026-a8ef-84ee4ca5e65a X-Archives-Hash: 2abe09c97f83d6cac45cd26def608f54 commit: 3dc607a8a6cfd3bafbc2f10d9a7c3aae90c3a757 Author: Fabian Groffen gentoo org> AuthorDate: Tue Sep 10 18:21:51 2019 +0000 Commit: Fabian Groffen gentoo org> CommitDate: Tue Sep 10 18:21:51 2019 +0000 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=3dc607a8 qlop: add mode to print last run in a similar way like emerge(1) does For example, the output could be like this, showing upgrade information: % ./qlop -E -t U app-shells/bash-5.0_p11 [5.0_p9-r0]: 2′38″ U app-admin/eselect-1.4.15 [1.4.14-r0]: 19s U sys-libs/talloc-2.3.0 [2.2.0-r0]: 1′56″ U app-portage/prefix-toolkit-5 [4-r0]: 10s U dev-python/cryptography-2.7 [2.6.1-r0]: 1′59″ U net-dns/bind-tools-9.14.5 [9.14.4-r0]: 4′17″ R dev-python/sphinxcontrib-applehelp-1.0.1: 28s R dev-python/sphinxcontrib-devhelp-1.0.1: 27s R dev-python/sphinxcontrib-jsmath-1.0.1: 25s R dev-python/sphinxcontrib-htmlhelp-1.0.2: 28s R dev-python/sphinxcontrib-serializinghtml-1.1.3: 28s R dev-python/sphinxcontrib-qthelp-1.0.2: 28s U dev-python/sphinx-2.0.1 [1.7.5-r1]: 1′13″ U net-mail/notmuch-0.29.1-r1 [0.28.4-r0]: 1′00″ Signed-off-by: Fabian Groffen gentoo.org> man/qlop.1 | 5 ++++- qlop.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 52 insertions(+), 2 deletions(-) diff --git a/man/qlop.1 b/man/qlop.1 index baa5bf5..de1e525 100644 --- a/man/qlop.1 +++ b/man/qlop.1 @@ -1,5 +1,5 @@ .\" generated by mkman.py, please do NOT edit! -.TH qlop "1" "Jul 2019" "Gentoo Foundation" "qlop" +.TH qlop "1" "Sep 2019" "Gentoo Foundation" "qlop" .SH NAME qlop \- emerge log analyzer .SH SYNOPSIS @@ -65,6 +65,9 @@ Show autoclean unmerge history. \fB\-s\fR, \fB\-\-sync\fR Show sync history. .TP +\fB\-E\fR, \fB\-\-emerge\fR +Show last merge like how emerge(1) -v would show it. +.TP \fB\-e\fR, \fB\-\-endtime\fR Report time at which the operation finished (iso started). .TP diff --git a/qlop.c b/qlop.c index 243c8b6..3cc3367 100644 --- a/qlop.c +++ b/qlop.c @@ -24,7 +24,7 @@ #define QLOP_DEFAULT_LOGFILE "emerge.log" -#define QLOP_FLAGS "ctaHMmuUslerd:f:w:F:" COMMON_FLAGS +#define QLOP_FLAGS "ctaHMmuUsElerd:f:w:F:" COMMON_FLAGS static struct option const qlop_long_opts[] = { {"summary", no_argument, NULL, 'c'}, {"time", no_argument, NULL, 't'}, @@ -35,6 +35,7 @@ static struct option const qlop_long_opts[] = { {"unmerge", no_argument, NULL, 'u'}, {"autoclean", no_argument, NULL, 'U'}, {"sync", no_argument, NULL, 's'}, + {"emerge", no_argument, NULL, 'E'}, {"endtime", no_argument, NULL, 'e'}, {"running", no_argument, NULL, 'r'}, {"date", a_argument, NULL, 'd'}, @@ -54,6 +55,7 @@ static const char * const qlop_opts_help[] = { "Show unmerge history", "Show autoclean unmerge history", "Show sync history", + "Show last merge like how emerge(1) -v would show it", "Report time at which the operation finished (iso started)", "Show current emerging packages", "Limit selection to this time (1st -d is start, 2nd -d is end)", @@ -85,6 +87,7 @@ struct qlop_mode { char do_machine:1; char do_endtime:1; char show_lastmerge:1; + char show_emerge:1; const char *fmt; }; @@ -334,6 +337,7 @@ static int do_emerge_log( time_t elapsed; depend_atom *atom; depend_atom *atomw; + depend_atom *upgrade_atom = NULL; DECLARE_ARRAY(merge_matches); DECLARE_ARRAY(merge_averages); DECLARE_ARRAY(unmerge_matches); @@ -638,6 +642,34 @@ static int do_emerge_log( flags->do_time ? ": " : "", flags->do_time ? fmt_elapsedtime(flags, elapsed) : ""); + } else if (flags->show_emerge) { + int state = NOT_EQUAL; + if (upgrade_atom != NULL) + state = atom_compare(pkgw->atom, upgrade_atom); + switch (state) { + /* "NRUD " */ + case EQUAL: + printf(" %sR%s ", YELLOW, NORM); + break; + case NOT_EQUAL: + printf("%sN%s ", GREEN, NORM); + break; + case NEWER: + printf(" %sU%s ", BLUE, NORM); + break; + case OLDER: + printf(" %sU%sD%s ", BLUE, DKBLUE, NORM); + break; + } + printf("%s", atom_format(flags->fmt, pkgw->atom)); + if (state == NEWER || state == OLDER) + printf(" %s[%s%s%s]%s", DKBLUE, NORM, + atom_format("%[PVR]", upgrade_atom), + DKBLUE, NORM); + if (flags->do_time) + printf(": %s\n", fmt_elapsedtime(flags, elapsed)); + else + printf("\n"); } else if (flags->do_time) { printf("%s >>> %s: %s\n", fmt_date(flags, pkgw->tbegin, tstart), @@ -675,6 +707,14 @@ static int do_emerge_log( if (atom == NULL) continue; + if (p[-20] == ' ' && flags->show_emerge) + { + if (upgrade_atom != NULL) + atom_implode(upgrade_atom); + upgrade_atom = atom; + continue; + } + /* see if we need this atom */ atomw = NULL; array_for_each(atoms, i, atomw) { @@ -942,6 +982,7 @@ int qlop_main(int argc, char **argv) m.do_machine = 0; m.do_endtime = 0; m.show_lastmerge = 0; + m.show_emerge = 0; m.fmt = NULL; while ((ret = GETOPT_LONG(QLOP, qlop, "")) != -1) { @@ -953,6 +994,12 @@ int qlop_main(int argc, char **argv) case 'u': m.do_unmerge = 1; break; case 'U': m.do_autoclean = 1; break; case 's': m.do_sync = 1; break; + case 'E': m.do_merge = 1; + m.do_unmerge = 1; + m.do_autoclean = 1; + m.show_lastmerge = 1; + m.show_emerge = 1; + verbose = 1; break; case 'r': m.do_running = 1; break; case 'a': m.do_average = 1; break; case 'c': m.do_summary = 1; break;