Beta autodepclean script (not yet ready for primetime)
The attached script takes the output of "emerge --pretend --depclean"
and formats it into a script "cleanscript" which contains a set of
"emerge --depclean" commands to remove individual items. Do *NOT*
remove the "exit" and source "cleanscript". It's there to protect you.
The script is very simple-minded about kernel-sources. I.e. it
removes all but the latest version. E.g. I have 3 kernels in /usr/src,
namely 2.6.31-r10, 2.6.32-r7, and 2.6.34-r1. I'm currently on
2.3.32-r7. The script will want to remove 2.6.31-r10 and 2.6.32-r7 and
keep 2.6.34-r1. I suspect that something similar may be true if you
have multiple versions of gcc. Sources and gcc are a bit weird in that
they're not "dependancies" of any packages, and they aren't listed in
One other thing I have noticed is that the format...
"emerge --depclean =sys-boom/bah-188.8.131.52"
...will not work if it's masked. autodepclean will find it, but you
need to use "emerge --unmerge" to remove it.
Other than that, the output from autodepclean seems to be OK. I've
manually removed a bunch of stuff (cutting-&-pasting lines from
cleanscript), and revdep-rebuild hasn't found any breakages. If you are
unsure about any of its suggestions, please ask on this list.