If an installed ebuild is removed from the tree, 'equery l' lists it with '[??]' annotation, but 'equery l -p' lists only in-tree packages, giving a false impression of package not being installed.
OK, let's change it from "slightly broken" to just "broken". ls /usr/portage/app-text/ghostscript-gpl/*.ebuild /usr/portage/app-text/ghostscript-gpl/ghostscript-gpl-8.71-r6.ebuild /usr/portage/app-text/ghostscript-gpl/ghostscript-gpl-9.00-r1.ebuild /usr/portage/app-text/ghostscript-gpl/ghostscript-gpl-9.01.ebuild /usr/portage/app-text/ghostscript-gpl/ghostscript-gpl-9.02.ebuild equery l -p ghostscript-gpl * Searching for ghostscript-gpl ... [-P-] [ ] app-text/ghostscript-gpl-8.71-r6:0 [-P-] [ ~] app-text/ghostscript-gpl-9.00-r1:0 equery l -p -o ghostscript-gpl * Searching for ghostscript-gpl ... [-P-] [ ] app-text/ghostscript-gpl-8.71-r6:0 [--O] [ ~] app-text/ghostscript-gpl-9.00:0 [-P-] [ ~] app-text/ghostscript-gpl-9.00-r1:0 [--O] [ ~] app-text/ghostscript-gpl-9.01:0 [I-O] [ ] app-text/ghostscript-gpl-9.02:0 That's definitely *not* an expected result. Looking at the sources, it would seem that it's just listing, that's broken. If I read the things correctly, in pym/gentoolkit/equery/list_.py, in main(input_args), in 'for pkg in matches' loop, two loop breaking conditions before pp.uprint(pkgstr) incorrectly skip installed packages if they are i.e. no longer in the tree. Note, that if '-l -p' is passed, output is correct, as that negates both of those conditions.
Addition: note that even equery -p -i refuses to list packages that have left the tree, which is definitely wrong. cami ~ # equery l -i firefox * Searching for firefox ... [I--] [??] www-client/firefox-31.0:0 cami ~ # equery l -i -p firefox * Searching for firefox ... [-P-] [ -] www-client/firefox-10.0.11:0 [-P-] [ ] www-client/firefox-17.0.9:0 [-P-] [ ] www-client/firefox-24.3.0:0 [-P-] [ ] www-client/firefox-24.7.0:0 [-P-] [ ] www-client/firefox-24.8.0:0 [-P-] [ ] www-client/firefox-31.1.0-r1:0 [-P-] [ ~] www-client/firefox-32.0:0 cami ~ # equery l -p firefox * Searching for firefox ... [-P-] [ -] www-client/firefox-10.0.11:0 [-P-] [ ] www-client/firefox-17.0.9:0 [-P-] [ ] www-client/firefox-24.3.0:0 [-P-] [ ] www-client/firefox-24.7.0:0 [-P-] [ ] www-client/firefox-24.8.0:0 [-P-] [ ] www-client/firefox-31.1.0-r1:0 [-P-] [ ~] www-client/firefox-32.0:0 cami ~ # equery l gentoolkit * Searching for gentoolkit ... equery l[IP-] [ ] app-portage/gentoolkit-0.3.0.8-r2:0
Created attachment 386910 [details, diff] patch that sems to fix this problem TBH, I've just about forgotten I've filed this bug - it's been a few years, after all. If I understand the current logic correctly, this patch should fix the problem. It's against 0.3.0.8-r2 - haven't checked ~0.3.0.9.
A little note: reading both the code and my patch a bit more, it becomes clear, that the logic of my patch is wrong, but in this particular context still leads to the correct output. It simply comes down to the fact, that if '-I' is passed to 'equery l', the query results that go into that patched lop already won't contain installed packages.
Created attachment 854880 [details, diff] previous patch updated with formatting changes
Comment on attachment 854880 [details, diff] previous patch updated with formatting changes Sorry, this patch is broken.
Comment on attachment 854880 [details, diff] previous patch updated with formatting changes Sorry again, panicked flailing after not visiting this bug for years, this patch *does* the same thing as the previous one.
...that's what happens when you forget what you were fixing: I've actually been using a different patch for quite awhile before the formatting changes and the newly attached version is the update of that patch, not the older patch in this bug. :sigh:
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=637bfbfb27d2104a81d80e5c67a7878d2e874966 commit 637bfbfb27d2104a81d80e5c67a7878d2e874966 Author: Rafał Mużyło <galtgendo@o2.pl> AuthorDate: 2023-07-18 22:28:44 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2023-07-18 22:28:44 +0000 equery: list: correctly handle installed packages no longer in tree Closes: https://bugs.gentoo.org/369581 Signed-off-by: Sam James <sam@gentoo.org> pym/gentoolkit/equery/list_.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c162ce62447fec711a28ecf1434879256c8aea6a commit c162ce62447fec711a28ecf1434879256c8aea6a Author: Sam James <sam@gentoo.org> AuthorDate: 2023-10-03 15:43:51 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2023-10-03 15:44:35 +0000 app-portage/gentoolkit: add 0.6.2 Bug: https://bugs.gentoo.org/900224 Closes: https://bugs.gentoo.org/369581 Closes: https://bugs.gentoo.org/382009 Closes: https://bugs.gentoo.org/576224 Closes: https://bugs.gentoo.org/709816 Closes: https://bugs.gentoo.org/861116 Closes: https://bugs.gentoo.org/877519 Closes: https://bugs.gentoo.org/902551 Signed-off-by: Sam James <sam@gentoo.org> app-portage/gentoolkit/Manifest | 1 + app-portage/gentoolkit/gentoolkit-0.6.2.ebuild | 71 ++++++++++++++++++++++++++ 2 files changed, 72 insertions(+)