Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
My new bash portage query tool, etool.
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
Xero
n00b
n00b


Joined: 12 Sep 2003
Posts: 17

PostPosted: Tue Mar 15, 2005 5:10 am    Post subject: My new bash portage query tool, etool. Reply with quote

So basically I was fed up with qpkg and equery. Equery is so slow it's not even funny, and qpkg is fast, but not as fast as it could be. Plus, qpkg has some problems with one of my favorite options, -f, particularly it fails completely with directories.

My new script can do qpkg -f style stuff but that's not all, it can even take wildcards. So you can for example, etool -f /etc/X11/* and it will work. You can even pass multiple parameters, say etool -f /etc/X11/* /etc/make* /usr/bin/test, or what not. This functionality requires app-admin/realpath, but it's well worth the dep (plus it's tiny and kinda useful anyway.) On another note, it can take multiple options for all it's arguments, etool -s package1 package2 will indeed spit out both. The only option that can't is -e but that doesn't take any options anyway...so yeah.

Here's the help output for those too lazy to read all this:

Usage: etool [-f FILE|-l PACKAGE|-s PACKAGE|-e|-h]
-f check what package owns a file(s)
-l list package contents
-s search installed packages and display count. No args will list all
-e list files in /etc that aren't in portage
-h display this help and exit

the majority of the code is basically making the output pretty, it's even faster without that code, however I find how it is now to be quite satisfactory, and a simple time test will reveal its speed. It can beat out qpkg easily in almost every fair comparison I can give it, though I can't even fully compare it as it has features qpkg does not (though it lacks the majority of qpkg features obviously.)

The -e option is kind of like the findcruft script except it's only for /etc. I didn't realize findcruft existed when I started writing this so, it's a bit redundant I suppose. It's no where near as fancy, but it's fast enough and gets the job done. It has a preliminary whitelist style thing, which I've basically decided upon by comparing to a fresh install, among other things. It also completely ignores the gconf.xml.defaults directory (I really have no way to clean this directory out, other than maybe comparing names in there to installed packages....even that would be unreliable though.) it also ignores the runlevel directory as i'm sure no one wants to be deleting that.....

The -s option is pretty neat if you want to search your installed packages for something, it also gives you a package count so you can see how many packages you have installed total, which is pretty useful...It just counts how many search results it found. It searches both category and package name so you can do things like etool -s media-sound and get everything you have installed in media-sound listed...

you can download the script here: http://www.xeron.cc/main/files/etool

Again, it depends on realpath. It also uses grep, find, and column, but I think most people will have those...

I'm sure there might be some bugs in it. I'm guessing you can probably pass it weird options and make it break somehow...I've tested it on one stable box and one ~x86 box so far and it seems to work fine.

I'm curious if anyone finds this useful at all.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum