Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 172338 - app-portage/portage-utils: qgrepping through installed ebuilds (in the VDB)
Summary: app-portage/portage-utils: qgrepping through installed ebuilds (in the VDB)
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Third-Party Tools (show other bugs)
Hardware: All Linux
: High enhancement
Assignee: Portage Utils Team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2007-03-26 20:24 UTC by TGL
Modified: 2007-04-05 18:43 UTC (History)
1 user (show)

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


Attachments
qgrep-add_--installed_and_drop_--invert-match.patch (qgrep-add_--installed_and_drop_--invert-match.patch,5.80 KB, patch)
2007-03-26 20:28 UTC, TGL
Details | Diff
qgrep-add_--installed_and_drop_--invert-match.patch (qgrep-add_--installed_and_drop_--invert-match.patch,6.09 KB, patch)
2007-03-26 21:45 UTC, TGL
Details | Diff
qgrep-add_--installed.patch (qgrep-add_--installed.patch,5.28 KB, patch)
2007-03-27 07:06 UTC, TGL
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description TGL 2007-03-26 20:24:54 UTC
I have written qgrep support for grepping through installed ebuilds (the ones stored in the VDB).  The only problem is how to name the option for this feature...

The "standard" name (à la qlist) is "-I/--installed", which conflicts with the existing "-I/--invert-match" option.  So i have chosen to drop --invert-match support.  It sounds a bit extreme, but actually something similar to --invert-match can now be achieved with --skip, so it's not a loss of functionality.  I mean, this two commands were equivalent:
 % qgrep --invert-match foo
 % qgrep --skip foo ""

Sure, if you don't agree this change, then i will rediff without dropping --invert-match, and with a new short option.
Comment 1 TGL 2007-03-26 20:28:57 UTC
Created attachment 114543 [details, diff]
qgrep-add_--installed_and_drop_--invert-match.patch

Solar, probably this patch will conflict with your qgrep-context-names.diff from bug #172240.  Still attaching it for review, but I will rediff later when you have applied yours.
Comment 2 solar (RETIRED) gentoo-dev 2007-03-26 21:12:24 UTC
hrmm. I'm not sure about this one. All you have to do now to get this same functionality is.
PORTDIR=/var/db/pkg/ qgrep -He virtual/x11
Comment 3 TGL 2007-03-26 21:42:50 UTC
(In reply to comment #2)
> hrmm. I'm not sure about this one. All you have to do now to get this same
> functionality is.
> PORTDIR=/var/db/pkg/ qgrep -He virtual/x11
> 

Nice trick, i hadn't thought about that.  

That said, there is still the problem that qgrep will always use the .ebuild.x cache for ebuilds paths. It's ok in /usr/portage, because the sync hook maintains it up-to-date, but for VDB there is nothing like that, which makes this trick less user-friendly than a qgrep option (need to be root, and need to remember deleting /var/db/pkg/.ebuild.x if you have installed/updated anything since last use).  

Sure, an other option would be to add some post merge/unmerge hooks to maintain a cache in VDB too, but it's a bit over-complicated if only done for that purpose imho.
Comment 4 TGL 2007-03-26 21:45:51 UTC
Created attachment 114556 [details, diff]
qgrep-add_--installed_and_drop_--invert-match.patch

Rediffed for rev. 1.20
Comment 5 solar (RETIRED) gentoo-dev 2007-03-26 23:17:02 UTC
Still not sure about being in love with this one under this approach.
Vs all the extra complexity it would seem eaiser to just point portdir at vdbdir.
If the .ebuild.x thing you are viewing as a problem then I think we are better off   
making a fallback there for all applets when no .ebuild.x exists. Like stuffing 
one in memory or /dev/shm or ~/.ebuild.x or so.
Comment 6 TGL 2007-03-27 07:06:25 UTC
(In reply to comment #5)
> Still not sure about being in love with this one under this approach.
> Vs all the extra complexity it would seem eaiser to just point portdir at
> vdbdir.

And I still prefer having an option, i find it more obvious to use.  Also, i don't think it adds that much extra complexity.  I will attach an alternative patch which names the short option "-J", so that there is no need to drop the current "-I".  See, it's really just about adding a third way to iterate, which is all isolated in a separate function, plus a few line to chdir($ROOT/VDB). 

Anyway, whether this option is needed or not is really a matter of taste. If you don't like it, well, then don't merge it, i promise won't mind too much :)

> If the .ebuild.x thing you are viewing as a problem then I think we are better
> off making a fallback there for all applets when no .ebuild.x exists. Like 
> stuffing one in memory or /dev/shm or ~/.ebuild.x or so.

Don't have time to really think about it right now, but yes, that's probably something to keep in mind.  Probably it's worth a line in the TODO.
Comment 7 TGL 2007-03-27 07:06:48 UTC
Created attachment 114573 [details, diff]
qgrep-add_--installed.patch
Comment 8 solar (RETIRED) gentoo-dev 2007-04-03 18:20:17 UTC
(In reply to comment #7)
> Created an attachment (id=114573) [edit]
> qgrep-add_--installed.patch

/var/cvsroot/gentoo-projects/portage-utils/qgrep.c,v  <--  qgrep.c
new revision: 1.21; previous revision: 1.20

Comment 9 solar (RETIRED) gentoo-dev 2007-04-05 18:42:21 UTC
This is released in 0.1.25

Bug #168334 ; q -r dies with a segfault after emerge --sync
Bug #168442 ; does not  properly parse the profile location
Bug #170795 ; add a -E/--eclass option to qgrep
Bug #170797 ; add a -s/--skip-comments option to qgrep
Bug #171024 ; opening '/usr/portage/.metadata.x' failed
Bug #171374 ; Misc enhancements for qgrep
Bug #172240 ; -A/-B options for qgrep (context lines) 
Bug #172338 ; qgrepping through installed ebuilds (in the VDB) 
Bug #173005 ; Colorized output for qgrep.
Comment 10 solar (RETIRED) gentoo-dev 2007-04-05 18:43:06 UTC
Closing