From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 26C4F1381DF for ; Wed, 17 Feb 2016 07:13:25 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B3389E07D2; Wed, 17 Feb 2016 07:13:24 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 36D5CE07D2 for ; Wed, 17 Feb 2016 07:13:24 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 5275D340D06 for ; Wed, 17 Feb 2016 07:13:23 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 02C9D1074 for ; Wed, 17 Feb 2016 07:13:22 +0000 (UTC) From: "Mike Frysinger" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Frysinger" Message-ID: <1455693122.61a961b295ff529961d0a29356a02465d0808790.vapier@gentoo> Subject: [gentoo-commits] proj/portage-utils:master commit in: /, tests/qlop/ X-VCS-Repository: proj/portage-utils X-VCS-Files: qlop.c tests/qlop/dotest tests/qlop/list02.good tests/qlop/list03.good tests/qlop/list04.good tests/qlop/list05.good tests/qlop/sync.log tests/qlop/test04.good X-VCS-Directories: tests/qlop/ / X-VCS-Committer: vapier X-VCS-Committer-Name: Mike Frysinger X-VCS-Revision: 61a961b295ff529961d0a29356a02465d0808790 X-VCS-Branch: master Date: Wed, 17 Feb 2016 07:13:22 +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-Archives-Salt: 90c64cd0-7163-4ebf-abe9-e8d6b58c19ff X-Archives-Hash: a603c8ed17cbb8483f8f010e8b3a7e69 commit: 61a961b295ff529961d0a29356a02465d0808790 Author: Mike Frysinger gentoo org> AuthorDate: Wed Feb 17 07:12:02 2016 +0000 Commit: Mike Frysinger gentoo org> CommitDate: Wed Feb 17 07:12:02 2016 +0000 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=61a961b2 qlop: fix default -l/-u match behavior Adding atom parsing support accidentally broke the default behavior of matching all packages. Restore that edge case and add tests. URL: https://bugs.gentoo.org/574832 Reported-by: Nikos Chantziaras gmail.com> qlop.c | 14 +++++++++++--- tests/qlop/dotest | 14 +++++++++++++- tests/qlop/list02.good | 3 +++ tests/qlop/list03.good | 4 ++++ tests/qlop/list04.good | 1 + tests/qlop/list05.good | 1 + tests/qlop/sync.log | 46 ++++++++++++++++++++++++++++++++++++++++++++++ tests/qlop/test04.good | 0 8 files changed, 79 insertions(+), 4 deletions(-) diff --git a/qlop.c b/qlop.c index 8a89fba..dbbae06 100644 --- a/qlop.c +++ b/qlop.c @@ -241,6 +241,7 @@ show_emerge_history(int listflag, array_t *atoms, const char *logfile) size_t buflen, linelen; char *buf, merged; char *p, *q; + bool showit; size_t i; time_t t; depend_atom *atom, *logatom; @@ -283,10 +284,17 @@ show_emerge_history(int listflag, array_t *atoms, const char *logfile) continue; logatom = atom_explode(q); - array_for_each(atoms, i, atom) { - if (atom_compare(atom, logatom) != EQUAL) - continue; + if (array_cnt(atoms)) { + showit = false; + array_for_each(atoms, i, atom) + if (atom_compare(atom, logatom) == EQUAL) { + showit = true; + break; + } + } else + showit = true; + if (showit) { if (!quiet) printf("%s %s %s%s%s\n", chop_ctime(t), (merged ? ">>>" : "<<<"), (merged ? GREEN : RED), q, NORM); else { diff --git a/tests/qlop/dotest b/tests/qlop/dotest index 6525594..fad6011 100755 --- a/tests/qlop/dotest +++ b/tests/qlop/dotest @@ -22,9 +22,21 @@ test() { # We output dates, so make sure it matches our logs. export LC_TIME="C" -# simple install check +# simple sync check test 01 0 "qlop -s -f ${as}/sync.log" +# check all installed pkgs +test 02 0 "qlop -l -f ${as}/sync.log" + +# check all uninstalled pkgs +test 03 0 "qlop -u -f ${as}/sync.log" + +# verify atom parsing works (and not partial strings) +test 04 0 "qlop -l gcc -f ${as}/sync.log" + +# verify atom version parsing works +test 05 0 "qlop -l '>> dev-util/ccache-2.3 +Thu Jan 27 05:56:39 2005 >>> sys-devel/gcc-config-1.3.9 +Thu Jan 27 06:17:10 2005 >>> sys-devel/gcc-3.4.3-r1 diff --git a/tests/qlop/list03.good b/tests/qlop/list03.good new file mode 100644 index 0000000..add774a --- /dev/null +++ b/tests/qlop/list03.good @@ -0,0 +1,4 @@ +Thu Jan 27 05:56:39 2005 <<< sys-devel/gcc-config-1.3.6-r3 +Thu Jan 27 05:58:04 2005 <<< sys-apps/pam-login-3.14 +Thu Jan 27 05:58:06 2005 <<< sys-libs/pam-0.77-r1 +Thu Jan 27 05:58:16 2005 <<< sys-fs/devfsd-1.3.25-r8 diff --git a/tests/qlop/list04.good b/tests/qlop/list04.good new file mode 100644 index 0000000..c3de519 --- /dev/null +++ b/tests/qlop/list04.good @@ -0,0 +1 @@ +Thu Jan 27 06:17:10 2005 >>> sys-devel/gcc-3.4.3-r1 diff --git a/tests/qlop/list05.good b/tests/qlop/list05.good new file mode 100644 index 0000000..c3de519 --- /dev/null +++ b/tests/qlop/list05.good @@ -0,0 +1 @@ +Thu Jan 27 06:17:10 2005 >>> sys-devel/gcc-3.4.3-r1 diff --git a/tests/qlop/sync.log b/tests/qlop/sync.log index fc31edb..8979b23 100644 --- a/tests/qlop/sync.log +++ b/tests/qlop/sync.log @@ -1,3 +1,49 @@ +1098946153: Started emerge on: Oct 28, 2004 06:49:13 +1098946153: *** emerge --buildpkg --usepkg --oneshot --nodeps ccache +1098946153: >>> emerge (1 of 1) dev-util/ccache-2.3 to / +1098946153: === (1 of 1) Merging Binary (dev-util/ccache-2.3::/usr/portage/packages/All/ccache-2.3.tbz2) +1098946154: >>> AUTOCLEAN: dev-util/ccache +1098946154: --- AUTOCLEAN: Nothing unmerged. +1098946154: ::: completed emerge (1 of 1) dev-util/ccache-2.3 to / +1098946154: *** Finished. Cleaning up... +1098946154: *** exiting successfully. +1098946154: *** terminating. + +1106805388: Started emerge on: Jan 27, 2005 05:56:28 +1106805388: *** emerge gcc +1106805388: >>> emerge (1 of 2) sys-devel/gcc-config-1.3.9 to / +1106805388: === (1 of 2) Cleaning (sys-devel/gcc-config-1.3.9::/usr/portage/sys-devel/gcc-config/gcc-config-1.3.9.ebuild) +1106805388: === (1 of 2) Compiling/Merging (sys-devel/gcc-config-1.3.9::/usr/portage/sys-devel/gcc-config/gcc-config-1.3.9.ebuild) +1106805393: === (1 of 2) Post-Build Cleaning (sys-devel/gcc-config-1.3.9::/usr/portage/sys-devel/gcc-config/gcc-config-1.3.9.ebuild) +1106805393: >>> AUTOCLEAN: sys-devel/gcc-config +1106805398: === Unmerging... (sys-devel/gcc-config-1.3.6-r3) +1106805399: >>> unmerge success: sys-devel/gcc-config-1.3.6-r3 +1106805399: ::: completed emerge (1 of 2) sys-devel/gcc-config-1.3.9 to / +1106805399: >>> emerge (2 of 2) sys-devel/gcc-3.4.3-r1 to / +1106805399: === (2 of 2) Cleaning (sys-devel/gcc-3.4.3-r1::/usr/portage/sys-devel/gcc/gcc-3.4.3-r1.ebuild) +1106805399: === (2 of 2) Compiling/Merging (sys-devel/gcc-3.4.3-r1::/usr/portage/sys-devel/gcc/gcc-3.4.3-r1.ebuild) +1106805477: Started emerge on: Jan 27, 2005 05:57:57 +1106805477: *** emerge unmerge pam pam-login +1106805482: === Unmerging... (sys-apps/pam-login-3.14) +1106805484: >>> unmerge success: sys-apps/pam-login-3.14 +1106805484: === Unmerging... (sys-libs/pam-0.77-r1) +1106805486: >>> unmerge success: sys-libs/pam-0.77-r1 +1106805487: *** exiting successfully. +1106805487: *** terminating. +1106805490: Started emerge on: Jan 27, 2005 05:58:10 +1106805490: *** emerge unmerge devfsd +1106805495: === Unmerging... (sys-fs/devfsd-1.3.25-r8) +1106805496: >>> unmerge success: sys-fs/devfsd-1.3.25-r8 +1106805497: *** exiting successfully. +1106805497: *** terminating. +1106806630: === (2 of 2) Post-Build Cleaning (sys-devel/gcc-3.4.3-r1::/usr/portage/sys-devel/gcc/gcc-3.4.3-r1.ebuild) +1106806630: >>> AUTOCLEAN: sys-devel/gcc +1106806630: --- AUTOCLEAN: Nothing unmerged. +1106806630: ::: completed emerge (2 of 2) sys-devel/gcc-3.4.3-r1 to / +1106806630: *** Finished. Cleaning up... +1106806630: *** exiting successfully. +1106806630: *** terminating. + 1106804103: Started emerge on: Jan 27, 2005 05:35:03 1106804103: *** emerge sync 1106804103: === sync diff --git a/tests/qlop/test04.good b/tests/qlop/test04.good new file mode 100644 index 0000000..e69de29