Debugging File Type (MIME) Associations

I’m having less and less time to blog and write stuff lately, so it’s a good opportunity to catch up with old things I did. Back in the happy days when I used Gentoo, one of the irritating issues I faced was messed-up file type associations. The MIME type for some files was recognized incorrectly, and as a result, KDE offered to open files with unsuitable applications. In order to debug it, I wrote a small Python script that would help me debug the way KDE applications are associated with MIME types and what MIME type is inferred from each file.

The script does so by querying KMimeType and KMimeTypeTrader. The script does 3 things:

  • Given a MIME type, show its hierarchy and a list of applications associated with it.
  • Given an application, list all MIME types it’s associated with.
  • Given a file, show its MIME type (and also the accuracy, which allows one to know why that MIME type was selected, although I admit that in the two years since I wrote it, I forgot how it works :))

The script is pasted below. I hope someone who still fiddles with less-than-standard installations will find it helpful.
Continue reading Debugging File Type (MIME) Associations

Missing *.la files

Sometimes, when you compile a package, it fails and complains that it can’t find a *.la file for some library that is installed. Recently, I ran into this while compiling dev-libs/gobject-introspection, which complained about a missing libpng14.la. The solution is to run:

sudo lafilefixer --justfixit

It won’t create the .la file, but it will fix the libtool references so that nothing points to it, and packages will compile fine.

search_for_updates 0.2

This is a small update to my search_for_updates script, which has been lying around. The script allows you to search for updates from Portage without resolving dependencies. Thus, it’s much faster than

emerge -pvu world

The new version lists the best version available for each package that can be updated using the --verbose flag. You can download the new version here: search_for_updates-0.2.

Kernel Configuration and nvidia-drivers

This is more of a note to myself, as I keep forgetting this. The proprietary NVIDIA drivers, provided by x11-drivers/nvidia-drivers, dislike alternatives. They will refuse to build against a kernel with rivafb (CONFIG_FB_RIVA) and nvidiafb (CONFIG_FB_NVIDIA) built in or built as modules. Both can be found (and unset) under:

Device Drivers
-> Graphics support
   -> nVidia Framebuffer Support
   -> nVidia Riva support

Searching for Updates without emerge

The normal way to see which installed packages have available updates on Gentoo is to run

$ emerge -puv world

And then you usually select the packages you really want to update and emerge them. However, this workflow has several downsides:

  1. It’s slow. When Portage checks for updates this way, it fully resolves all the dependencies. This process is unnecessary, as in many cases you aren’t interested in updating all the packages, let alone their dependencies.
  2. It may fail. When Portage fails to resolve the dependencies, it will either complain or completely fail. If it complains, it isn’t really that bad, except for the time used to resolve the unmet dependencies. Sometimes it fails completely (usually when masking is involved) and won’t display any of the available packages, hence leaving the user in the dark (except for some dependency error message).
  3. It displays lots of output. Many times you aren’t interested in seeing the dependencies that will be updated if you emerge every package in the world file. It’s just confusing and distracts you from the interesting updates for packages in the world file.

The following script tries to work around these problems. It works by querying the Portage API for the best version available for each package in the world file. If that version isn’t installed, it reports that there are updates waiting for that package. The script runs faster than emerge -pvu world and only displays the packages from the world file. If you find a package that you want to upgrade, you can emerge it separately to see the required dependencies.

Continue reading Searching for Updates without emerge

Upgrading All KDE-Related Packages in Gentoo

Yesterday, Gentoo marked KDE 3.5.10 as stable on amd64. I looked for a way to upgrade all of the KDE-related packages without manually specifying each one of them. Normally, one could do

emerge -avu world

but I encountered some nasty conflicts that I didn’t have time, nor would I, to resolve at that time. So I looked for a different solution. To my rescue came qlist from the great app-portage/portage-utils package. This package provides a set of very fast utilities to query portage. I used qlist to list all of my installed packages, grep‘ed the list, and piped the result as arguments to emerge using xargs.
Continue reading Upgrading All KDE-Related Packages in Gentoo

phpMyAdmin + Lighttpd in Gentoo

Usually, installing software in Gentoo is a piece of cake. Just emerge what you want, and with the right USE flags, everything will be ready for you. However, as I’ve found out today, installing phpMyAdmin with Lighttpd isn’t as trivial as it should be.

In this post I’ll try to walk you through the necessary steps to install phpMyAdmin with Lighttpd in Gentoo.
Continue reading phpMyAdmin + Lighttpd in Gentoo