Friday, April 16, 2010

Searching for installed packages in special section/category

$ for i in /usr/portage/dev-ruby/*; do eix -I --compact dev-ruby/$(basename $i); done  | grep I
This will show us all the installed packages under /usr/portage/dev-ruby.
How can we do it better?
$ equery list -i | grep dev-ruby
So we need to find a way to tell equery or eix to search just in dev-ruby category.
I asked this question in Gentoo Forums and got the answer I was looking for. Hehe.
Its:
eix -IcA dev-ruby
-I is for installed packages.
-c is for compact output (one line per package)
-A is the most important flag, we searched for and it is the --category-name
So we came back to eix and it solved our problems.
Sometimes you read the manual page, and you just don't find what you are looking for, even though its there obvious in plain text ;-)

In the thread where I asked the question, I got a few more ways to do this.
$  ls /var/db/pkg/dev-ruby/
cmdparse-2.0.2  rubygems-1.3.5
Another way is using qlist from app-portage/portage-utils this way:
$  qlist -I dev-ruby
dev-ruby/cmdparse
dev-ruby/rubygems
This qlist command is equivalent to this eix command:
$ eix -I --only-names dev-ruby/
dev-ruby/cmdparse
dev-ruby/rubygems
In the last command the / after dev-ruby is important. qlist doesn't have this problem.

I didn't go deeply how every command is working, but as a solution to our discussion, this is more then enough ;-)

Kfir

1 comment: