Protecting slotted packages from 'emerge --depclean'
I've not been in the habit of using 'emerge --depclean' very often. Shame on me. It's good practice to run it often to clean the cruft off of the system.
But a recent attempt exposed a little problem for anyone who needs or desires to keep multiple versions of slotted packages installed on the system. Like, say, each of the four different slots of Python (2.4, 2.6, 2.7, 3.1).
So I did this:
emerge -avt --noreplace dev-lang/python:2.4 dev-lang/python:2.6 dev-lang/python:2.7 dev-lang/python:3.1
That nicely inserts those slot atoms into the world profile (/var/lib/portage/world), which ensures that --depclean considers them off-limits.
This technique works for explicit versions as well as slots. For example, I protected a prior kernel version that I wanted to keep around for a while longer:
emerge -avt --noreplace =sys-kernel/gentoo-sources-2.6.37-r4
That's a little more high maintenance, since when I want that version removed from the system, I'll have to unmerge it explicitly. Which I guess could be considered a good thing.
At any rate, once I'd protected these, I was free to do the depclean dance:
emerge -uDavt --newuse world emerge -avt --depclean