Tag Archives: organization

Gentoo Love: Intro to Portage Sets

A few quick gentoo tips before we get to the instructional material.

  1. Emerge world as often as you can. Once a week is probably a good frequency.
  2. Unless you’ve got a rock solid track record emerging world, don’t do it when you are really tired.
  3. In the best interest of the above, and your sanity, minimize the number of tilde keywords you have unmasked. I got all adventurous with one of my servers some years ago and there’s no good exit strategy. Sometimes it’s a pride point, other times, just pain.
  4. Don’t unmerge zlib. Just don’t, even if you are planning to put it right back. Pretty much nothing can run without it. Not portage, and not make, so you can’t get it back really. If you did, just copy libz.so (and symlinks) from another machine (probably of the same architecture).
  5. Also, don’t run eclean. It will break a lot of ebuilds and can’t even do that particularly well.

Getting setsy with portage

One of the main disadvantages of portage is the generally poor grouping of related packages. There are:

  • Package Categories (media-libs, dev-python, etc.) – These are pretty great, except when a package’s category changes and some ebuilds don’t pick up on that change. There is some way for portage people to redirect old ebuilds to new packages, but it has failed me more than once. Also, package categories don’t speak much to dependencies (not that they should). Portage/ebuild people decide on these, though the project maintainers might have some say.
  • Meta Packages (kde-meta) – Not many of these, but they seem to mostly be a dependency container. They are fine for installing, if a bit opaque, but they can be terrible for uninstalling. I’ve uninstalled old metas that left their obsolete and orphaned packages strewn about (kde 4.2 stuff). These are made by the project maintainers, I think.
  • “Profiles”(world, system) – Not a great name (maybe the wrong name?), but these aren’t as helpful and commonly used as they should be. Emerging world is definitely useful, but there could be a more granular operation between individual packages and ALL PACKAGES. These are generally automatically constructed for the user, though the user can do some manual editing.
Portage Screenshot

Oh KDE, you slay me.

Enter sets

Sets are basically like profiles, but the user gets a lot more control. They are groups of packages that can be reference like:

emerge --ask --update @my-set

You’ve got to admit that’s nicer than doing something like this.

Now when I said “Enter sets,” I meant… almost. Sets are only available in portage 2.2+. So the first step is to get that. Before that, I want to mention that it is technically still in alpha and a broken portage can make it hard to revert to a working portage. Nevertheless, so far it works fine for me and a lot of others have been using it since early 2009. In /etc/portage/package.unmask, add:


And in /etc/portage/package.keywords add:

sys-apps/portage ~*

Now, just emerge --ask portage and make sure it’s gonna pull in 2.2.

Your first set

Long story short, the format of the most basic user sets is just like the world file under /var/lib/portage/world. Just make a file with a list of packages, one per line, and put that file under /etc/portage/sets. For example, a set of scripting languages:


Now you can refer to that list of package like:

emerge --ask --update --deep @my-scripting-set

It may be prudent to prefix your sets so they don’t conflict with any other packages.

How to really clean up your system

By now you’ve probably seen the light, but I’m going to share one of my favorite uses so far to drive the point home. Say you’ve let your system go for a while, and you’ve accumulated some packages. Maybe you’ve switched from Gnome to KDE or maybe all the way to xmonad; regardless there is cruft to be removed. Here’s how you clean that stuff the Right Way:

  1. Update your gentoolkit and portage
  2. equery for some packages to remove and save the list:

    equery list kde-*/* > ~/kde_installed_packages_12122010

  3. Review the result and format properly. equery gives specific versions by defaults, so we’re just gonna throw ‘=’ in front of every line to make them valid package atoms. We’ll use sed:

    sed ':a;N;$!ba;s/\n/\n=/g' ~/my-kde-set

    You’ll have to manually add one more equal sign for the first line, but that should work.

  4. Review the result and move the file into place:

    mv ~/my-kde-set /etc/portage/sets/

  5. Depclean and unmerge:

    emerge --depclean --ask --verbose @my-kde-set

Ah, so fresh and so clean. You should move the set file out of the /etc/portage/sets directory now.


Sets fill a much-lamented (by me) gap in portage. They add organizational power without removing fine-grained control, without which Gentoo would not be Gentoo. My only concern is
Why did this take so long? Given that this is basically how ‘world’ has always worked and we’re well into version 2, we should have had this ages ago. Also, sets are really not that complex or tailored to package management, I wonder if archlinux or some other distro has solved this better. Of course, I’ve only scratched the surface, and there’s a lot more you can do with sets, it seems. For a good starting point, you can do a search on sets.conf.

P.S. The screenshot above was brought to you by ImageMagick:

import -window root ~/screenshot.png

Music Management

Collections are pretty fun. Most people probably tend to accumulate things, and the smarter ones tend to realize that organization is the only way that one’s collection will ever see effective use.

Kid Loco on KDE4/Dolphin

Kid Loco on KDE4/Dolphin

DJing relies pretty heavily on having and knowing a lot of music. It’s also probably the coolest collection-based hobby/profession. Stamp and rock collections just don’t cut it. It’s easy to find examples of organization taken too far, but luckily my hobby supports my misprioritization, and I have a very organized MP3 collection. So, here’s how I do it.

  1. torrent or slsk or audiograbber (w/ lame) my music
  2. Use MusicBrainz Picard to complete incomplete tags and cluster/manually tag most music. It’s a little bit different, but it’s ridiculuously automated and very handy for letting you know when you have an incomplete album, etc. Before this, I used PsychicMP3 and discogs pages.

    MusicBrainz Picard Automated MP3 Tagger on Windows

    MusicBrainz Picard Automated MP3 Tagger on Windows

  3. Optional: Automatically record most of the bpm info into the file with MixMeister BPM analyzer. Even if you’re just making a playlist for your workout, knowing the speed of the tracks can help you create a much more cohesive and flowing mix.
  4. I tag anything rare or unrecognized by MusicBrainz with Mp3Tag at this point. Also, MixMeister’s not so good on swing rhythms and some stranger time signatures, or bpms less than 80/greater than 160, so I check them in Mp3Tag with a javascript bpm tapper.
  5. For when I feel like being crazy, I’ll run MP3Gain or something. MP3Gain can automatically normalize your music so you don’t have super loud or super soft tracks. If you don’t know what you’re doing you can introduce distortion, though. Usually, if the track sounds ok, I’ll leave well enough alone.
  6. I check for untagged/low quality files that got through before I started doing all this with MP3 Check

I stick to MP3, 192kbps or higher, VBR or CBR. I like to keep the sample rate at 44100hz, as that’s what the DN-S1200s support. I get FLAC albums (when I can find them), for my real faves, but of course keep the MP3s for portability reasons.

As for folder structure, I’m a sucker for Artist/Album (Year)/Tracks. A lot of renaming and tagging software will move stuff around for you, so yay. Oh, and I have to say that one of the most consistently frustrating things about tagging music is having to pick a genre for a song/album. I wish I could just leave it blank, but I’m a completionist.

So, is this waaay too much work? Did you note that all of these tools are Windows-based (except for Picard!)? Luckily, I store my MP3s on my server and grab them with samba, but if Linux had these tools, you know I’d grab that ebuild. If I missed them, let me know. Also, Amarok2 not working on amd64 gentoo is ridiculous. Not only that, but when I got it working, it blew chunks compared to amarok 1. Too much focus on peripheral media, not enough collection- and tag-based power.