Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 369581 - app-portage/gentoolkit-0.3.0.3: annoying 'equery l' quirk
Summary: app-portage/gentoolkit-0.3.0.3: annoying 'equery l' quirk
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Tools (show other bugs)
Hardware: All All
: Normal normal
Assignee: Portage Tools Team
URL:
Whiteboard:
Keywords: InVCS, PATCH
Depends on:
Blocks:
 
Reported: 2011-05-31 21:56 UTC by Rafał Mużyło
Modified: 2023-10-03 15:44 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
patch that sems to fix this problem (fix_short_sight.patch,666 bytes, patch)
2014-10-18 20:00 UTC, Rafał Mużyło
Details | Diff
previous patch updated with formatting changes (0.6.0-equery-list.patch,744 bytes, patch)
2023-02-26 20:47 UTC, Rafał Mużyło
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Rafał Mużyło 2011-05-31 21:56:45 UTC
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.
Comment 1 Rafał Mużyło 2011-07-31 12:44:44 UTC
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.
Comment 2 Carsten Milkau 2014-10-17 16:16:38 UTC
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
Comment 3 Rafał Mużyło 2014-10-18 20:00:09 UTC
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.
Comment 4 Rafał Mużyło 2014-10-22 03:20:17 UTC
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.
Comment 5 Rafał Mużyło 2023-02-26 20:47:00 UTC
Created attachment 854880 [details, diff]
previous patch updated with formatting changes
Comment 6 Rafał Mużyło 2023-02-26 20:53:25 UTC
Comment on attachment 854880 [details, diff]
previous patch updated with formatting changes

Sorry, this patch is broken.
Comment 7 Rafał Mużyło 2023-02-26 21:16:15 UTC
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.
Comment 8 Rafał Mużyło 2023-02-26 21:36:21 UTC
...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:
Comment 9 Larry the Git Cow gentoo-dev 2023-07-18 22:30:07 UTC
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(-)
Comment 10 Larry the Git Cow gentoo-dev 2023-10-03 15:44:48 UTC
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(+)