On Tue, Aug 17, 2010 at 09:49:22PM +0200, Enrico Weigelt wrote
> I've just experimented a bit with that and it turned out that
> --depclean doesn't clean up the buildtime-only deps. But if I
> remove one of them (eg. cabextract), they don't get pulled in again
> (that's indicating the depending ebuilds are written properly).
This reminds me of a script I've been working on to remove unnecessary
cruft. Everything that follows is run as root, because it runs
"emerge". The attached script "autodepclean" parses the output from
"emerge --pretend --depclean" and generates a script "cleanscript" that
you can run to clean up your system. This should handle your situation,
but it's also a general solution to the entire class of problems of
cleaning up when you remove all programs or USE flags that pull in a
lib. It is not restricted to just HAL
Warning, this script is beta. Use with care. It will remove
gentoo-sources versions higher than your current kernel. This is
technically correct for removing unused ebuilds. But it may not be what
you want.
--
Walter Dnes <[email protected]>
#!/bin/bash
# autodepclean script v 0.01 released under GPL v3 by Walter Dnes 2010/08/18
# Generates a file "cleanscript" to remove unused ebuilds, including
# buildtime-only dependancies.
#
# Warning; this script is still beta. I recommend that you check the output
# in cleanscript before running it. It is agressive about removing unused
# gentoo-sources versions. This includes those that are higher than your
# current kernel. This is technically correct for removing unused ebuilds,
# but it may not be what you want.
#
echo "#!/bin/bash" > cleanscript
echo "#" > cleanscript.000
emerge --pretend --depclean |\
grep -A1 "^ .*/" |\
grep -v "^ \*" |\
grep -v "^--" |\
sed ":/: {
N
s:\n::
s/ selected: /-/
s/^ /emerge --depclean =/
}" >> cleanscript.000
while read
do
echo "${REPLY}" >> cleanscript
if [ "${REPLY:0:6}" == "emerge" ]; then
echo "revdep-rebuild" >> cleanscript
fi
done < cleanscript.000
chmod 744 cleanscript