Hello again everybody. It has been a while since my last article.

Preface

Goal: Upgrade Gentoo by Category using equery

Table of Content


1: Issue

Gentoo is Fun. But sometimes it takes too long to compile.

With Equery, you can upgrade package by category. One category today. And other category the day after. You can install only what you need, instead of compile all at once. And save your precious time.

I think this classic issue is, already somewhere in gentoo manual. I just love to write a blog about this.

Common Upgrading

After a few month of not upgrading Gentoo, I always have a bunch of package that needed to be compiled. I do not have all the time in the world, I have life to take care of, so compile all upgraded packages is not an option.

 % sudo emerge --ask -uvDN @world

Example

Last month I have got a bunch of packages started with:

  • dev-ruby

  • dev-python

  • xfce-base

  • xfce-extra

  • x11-misc

  • dev-qt

  • kde-frameworks

Portage: emerge -uvDN @world

What a long list of packages! Sure that, I can’t give you the whole screenshot here. Too long that, the list does not even fit my wide screen.

Prerequisite

Before you do this tutorial, make sure that, you have already upgrade your base system.

 % sudo emerge --ask -uvDN @system

2: Using equery with emerge

Summary

It is as this below:

 % sudo emerge --ask -uvDN $(equery list -F '$name' "dev-ruby/*")

Well, although it looks complicated, it is actually simple.

How does it works

Listing Using equery

Start from this simple command:

 % sudo equery list "dev-ruby/*"
 * Searching for * in dev-ruby ...
[IP-] [  ] dev-ruby/did_you_mean-1.0.2:1
[IP-] [  ] dev-ruby/did_you_mean-1.1.2:2.4
[IP-] [  ] dev-ruby/fast_xs-0.8.0-r2:0
[IP-] [  ] dev-ruby/ffi-1.9.18:0
[IP-] [  ] dev-ruby/hpricot-0.8.6-r5:0
[IP-] [  ] dev-ruby/json-1.8.6-r1:0
[IP-] [  ] dev-ruby/json-2.1.0:2
[IP-] [  ] dev-ruby/kpeg-1.1.0-r1:1
[IP-] [  ] dev-ruby/listen-1.3.1-r4:1
[IP-] [  ] dev-ruby/listen-3.1.5-r1:3
[IP-] [  ] dev-ruby/minitest-5.10.3:5
[IP-] [  ] dev-ruby/mustache-1.0.5:0
[IP-] [  ] dev-ruby/net-telnet-0.1.1-r1:1
[IP-] [  ] dev-ruby/power_assert-1.1.1:0
[IP-] [  ] dev-ruby/racc-1.4.14:0
[IP-] [  ] dev-ruby/rake-12.3.1:0
[IP-] [  ] dev-ruby/rake-compiler-1.0.2:0
[IP-] [  ] dev-ruby/rb-inotify-0.9.10:0
[IP-] [  ] dev-ruby/rdiscount-2.2.0.1:0
[IP-] [  ] dev-ruby/rdoc-5.1.0:0
[IP-] [  ] dev-ruby/ruby_dep-1.5.0:1
[IP-] [  ] dev-ruby/rubygems-2.7.6-r1:0
[IP-] [  ] dev-ruby/sass-3.4.24:3.4
[IP-] [  ] dev-ruby/test-unit-3.2.7:2
[IP-] [  ] dev-ruby/xmlrpc-0.3.0:0

Portage: equery list "dev-ruby/*"


equery with Formatting

Now we can get the name of package using this command below:

 % sudo equery list -F '$name' "dev-ruby/*"
 * Searching for * in dev-ruby ...
did_you_mean
did_you_mean
fast_xs
ffi
hpricot
json
json
kpeg
listen
listen
minitest
mustache
net-telnet
power_assert
racc
rake
rake-compiler
rb-inotify
rdiscount
rdoc
ruby_dep
rubygems
sass
test-unit
xmlrpc

Portage: equery format "dev-ruby/*"


3: Base System Issue

Prerequiste

Remember our prerequiste ? We are not finished yet.

 % sudo emerge --ask -uvDN $(equery list -F '$name' "dev-ruby/*")

This command will still throw a bunch of packages, if you haven’t upgrade base system.

Emerge System

 % sudo emerge --ask -uvDN @system

Portage: emerge -uvDN @world

Emerge One Category

Now you can emerge your categories.

 % sudo emerge --ask -uvDN $(equery list -F '$name' "dev-ruby/*")

Portage: emerge -uvDN category


4: Finishing

Check

 % sudo emerge --ask -uvDN $(equery list -F '$name' "dev-ruby/*")

Portage: emerge -uvDN category empty

This should show empty, no more packages to be compiled.

Emerge Other Category.

Now you can emerge any other category as well:

 % sudo emerge --ask -uvDN $(equery list -F '$name' "xfce-base/*")
 % sudo emerge --ask -uvDN $(equery list -F '$name' "x11-misc/*")
 % sudo emerge --ask -uvDN $(equery list -F '$name' "dev-qt/*")
 % sudo emerge --ask -uvDN $(equery list -F '$name' "kde-frameworks/*")

At Last

After all packages upgraded, there might be some packages left. Now we can go back to our simple command.

 % sudo emerge --ask -uvDN @world

Conclusion

Solved. Compiling in Gentoo is fun again.

Happy New Year 2019. And thank you for reading.