Tag Archives: gentoo

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:

>=sys-apps/portage-2.2.0_alpha8

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:


dev-lang/nodejs
dev-lang/php
=dev-lang/python-3.1.3
>=dev-lang/ruby-1.8.7_p249-r2
dev-lang/tcl

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.

Conclusion

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


Geek Code

Remember this old bit? Well, I figured it was about time to generate my own. Gentoo users just emerge app-misc/geekcode and run geekcode. There’s also an online generator you can google for. It takes around 15 minutes, and transports you about 15 years into the past.

Here’s me:
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GAT d- s+: a-- C++ UL++ P- L++ E W+++ N o- K w
O-- M-- V-- PS PE- Y PGP t++ 5 X- R !tv b+++ DI+++ D+
G e++ h* r y?
------END GEEK CODE BLOCK------

Here’s a geek code interpreter.

SILT: Google’s Latest Gifts to Coders

This lady on the netbook is almost certainly perusing Google's coding gifts while being frustrated with Gentoo. She gets me. I took this photo at PayPal's Innovate conference a couple weeks ago and it's already my second-most popular photo on flickr. I dedicate this post to you, free netbook lady!


Work and life are trying to keep the SILT posts down, but no way, josé. Fight the power.

I don’t know if these are really the latest, but they’re pretty recent and boy are they handy.

  • I was thoroughly impressed by Google’s properties’ APIs, as demonstrated at the Google Code Playground. Seriously, there’s an incredible amount of data/functionality there.
  • I cannot wait to have something cool enough to code in Go, Google’s new programming language. It’s everything C++ could have been (in a much more perfect world). It mixes everything one could want from dynamic languages (e.g., Python) with the performance and compile-time checks of compiled languages. I’m really cheering for this one, hoping that Google’s backing brings forth a plethora of libraries and frameworks to leverage for practical purposes. Qt bindings or a web framework is what I’m seeking.
  • I’ve basically been relearning Python while using it for the biggest project I’ve done at work, yet. It’s really killing me in spots where there is some unwritten “Pythonic” way of doing something, and I’m met with implicit resistance in doing it the way I had thought made sense. Enter Google’s Style Guides (Python | All). It may not seem like much, but it really helps in those situations when the decision seems arbitrary, but somehow like you might regret making the wrong choice. The simple things, guys. Fundamentals.

As for things I am less grateful for, I am very frustrated with the fact that Gentoo is still on PHP 5.2, because 5.3 has a lot of sweet features, including much better crypto support (of which I am in dire need currently). PHP 5.3.1 is already out, and I can’t get 5.3.0? You guys call this bleeding edge?

SILT: Fences, Pastebin gone crazy, networking gone mad edition

Augh, I battled some large networking demons today to get a Gentoo box to have multiple MACs and static IPs. Also, it would seem some .NET/Windows developers are only a few years behind my brain.

Fences in play at work

Fences in play at work

  1. Today I got around to installing Fences 1.0. It’s an application to organize your desktop by functionally giving you icon groups. It’s kind of like being able to have multiple folders open in the background. This is all relevant because this is one of the first items on my software-writing to-do list that I tried to implement.
    Actually, it was #2 after writing an online to-do list, like Remember the Milk, except theirs doesn’t integrate with Checklist for the Palm, like I had started to write (I got as far as reverse engineering and writing a parser and minimal editor for Checklist’s binary format. It’s at once freeing and frustrating that 99% of the ideas I come up with will be implemented by someone else, and a good portion of those implementations will be too good for me to challenge. I gave up on Windows desktop development after a summer of .NET gross-out.
    BTW, pretty sure KDE4 has this.
  2. This link summed up how to get multiple IPs in the best way. It’s pretty much a quick primer in using ifconfig to set up your network card in bridging mode. The link specifies ubuntu, but it worked on Gentoo (and should work on all modern distros).
  3. I installed a pastebin over the weekend for internal use at work. I used the tarball made available at pastebin.com. It took quite a bit of modification to get it working the way I wanted to, however. Most importantly when using the "file" storage engine, it actually does not run, dying with an error about follow up posts. The solution is to actually dig through the code and comment out the die() call, then set the $post["followups"] = array(); inside the isset($post["followups"]) if clause. I realize the explanation is kind of hazy, if you actually run into this problem, let me know. In pretty much all othe respects it’s a great piece of software, and the perfect balance of things I was looking for in pastebin.

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.

Mix 1

My first recorded mix. I figured I was playing a lot of music, doin sweet stuff, so I might as well save it. I hooked up the decks to my Gentoo box running a newly compiled Audacity. The tracks are more or less random, though recognizable, and I’d say it’s uptempo, if not danceable, overall. If you need appx. 2 hrs of music and don’t feel like committing anything, this might be your lucky day.

About half an hour through I was graced by the presence of a somewhat inebriated Mr. Oltman, who had some interesting requests. I did what I could to make it work, but bear with the rest of it. It’s way more fun to mix with an audience, even if it’s just one. We had fun, so just think about that when it gets ugly 😉

Mix 1 – 3/26/2009

1:51 running time – 205MB 256kbps MP3

Tracklisting (Spoiler Alert!)

Highlight it for a better view.

  1. Mr. Scruff – Get a Move On
  2. David Snell – International Flight
  3. Hooverphonic – Electro Shock Faders
  4. Ladyhawke – Paris is Burning
  5. New Young Pony Club – Ice Cream
  6. Snoop Dogg – Sensual Seduction (Some Dance Mix of)
  7. Kid Cudi vs Crookers – Day n Nite (club mix)
  8. Mr. Oizo – Flat Beat
  9. Daft Punk – Phoenix
  10. Chemical Brothers – Hey Boy, Hey Girl
  11. Groove Armada – Superstylin’
  12. Kanye West – Love Lockdown
  13. Smashing Pumpkins – 1979 (New Originals mix)
  14. Benny Benassi feat. Sir Mixalot – Benny Got Back (Bass211 mix)
  15. John Legend and Andre 3000 – Green Light (MSTRKRFT mix)
  16. The Police – Roxanne (DiscoTech mix)
  17. The Glimmers – Cassette
  18. The Faint – Let the Poison Spill From Your Throat
  19. The Rapture – Olio
  20. Death From Above 1979 – Romantic Rights
  21. The Prodigy vs OutKast – Hey Ride
  22. Pink Grease – Superfool
  23. Spank Rock – Bump
  24. The Sneaker Pimps – Kiro TV
  25. The Prodigy – Warrior’s Dance
  26. Elite Force – Ghetto Fabulous
  27. Groove Armada – I See You Baby (Fatboy Slim mix)
  28. Royksopp – Eple (Shakedown mix)
  29. The Avalanches – Live at Dominoes
  30. Ragtyme – Fix It Man
  31. Kid Cudi – Maui Wowie
  32. dZihan and Kamien – Before
  • At first I wasn’t sure if I was going to keep the recording, so I was just futzing around at the beginning. International Flight was only in there for like a minute.
  • I really like Mr. Oizo’s Flat Beat into Phoenix; it works really well for a minimal beat mix.
  • Hey Boy, Hey Girl was a silly choice that I just included for the “Superstar DJs” lyric irony. I remember really not liking the transition into Superstylin’.
  • The Smashing Pumpkins to Benny Got Back cut was intentionally horrendous and sudden; I only did it to make Oltman lol, and it worked. Ben lol’d too, so I hope you can appreciate it.
  • I hope you caught the Green Light-Roxanne joke (Green Light && !Red Light). I don’t know if the humor makes up for the lame mix.
  • The Rapture to DFA1979 was a 25 bpm differential mix, so I ain’t ashamed.
  • I was really pleased with the Eple (Shakedown) and The Avalanches’ match. To the point where I _know_  I played with it too much, but that’s a mashup waiting to happen.
  • I got to use Ragtyme’s 1987 track Fix It Man. Took me forever to find the vinyl rip and it’s one of my faves.
  • I wish Kid Cudi didn’t have stock audio of farts peppering his new (unreleased) album.
  • dzihan and kamien bring us home with one of my old tyme favorites.

Anyway, the tracklisting and notes are good for me as they solidify the mix. I hope the tracklisting works for you. DJing’s not magic and I don’t intend on keeping secrets. If you need help finding any tracks, hit me up in the comments or email.

Is Gentoo dying?

gentoo_logoI started using Gentoo linux for a few reasons:

  1. To learn the inner workings of linux, as opposed to glossing over them with ubuntu or some other “user-friendly” distro.
  2. To learn more about the software I use. Gentoo really lets you configure all the various features of the software that I use. Hooray configurability!
  3. Because it had great documentation, like the Gentoo wiki. I was using OpenSuSE at the time and I kept finding myself reading HOWTOs about Gentoo and applying them to OpenSuSE .

Anyway, now there’s all sorts of ruckus about the Gentoo Foundation being leaderless and maybe I’m just not paying attention, but I haven’t heard anything promising about that situation in a while. Also, the Gentoo wiki had a massive data loss due to an unexpected data center closure, and it hasn’t recovered since (it’s been a while now).

As for the other benefits of Gentoo, well, there are other power-user distros, even some that give you good package management that does its best to stay close to the source. I’m looking at Arch Linux at the moment. Arch Linux also does a ton of bleeding-edge software stuff, which I find myself doing a lot on Gentoo nowadays.

On that note I should mention very subjectively that recently in order to upgrade I’ve had to blindly work around a lot more issues than when I started out. One could argue that it’s something about KDE 4.2, but there’s something else going on here as well. There’s way too much unmasking and way too much manual dependency resolving for the type of basic stuff I’m trying to do, stuff that I’ve seen portage do the equivalent of in the past. And I’m doing it during a major documentation shortage, one that doesn’t seem to be coming to an end.

Well, if I switch, you can be sure I’ll post my whinings about my next distro right here.