I have a script I've written for my own use.  It's not 100% polished,
but it does the job for me.  My "autodepclean" script runs
"emerge --pretend --depclean", and reformats the output into another
script, named "cleanscript", which contains a bunch of lines like...

emerge --depclean --verbose =fu-bar/xyz-1.2.3

  Before running "./cleanscript", I check it for problems.  Here's the
autodepclean script...

#!/bin/bash
# autodepclean script v 0.04 released under GPL v3 by Walter Dnes 2012/07/09
# 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.
#
# With the arrival of "virtual/editor", the script now suggests removing
# app-editors/nano, which may not be what you want.  If you want to keep
# nano, put it into world
#
# version 0.03 disables the removal of gentoo-sources.  Your current kernel
# is not always the most recent one in /usr/src.
#
# version 0.04 adds "--verbose" to the "emerge --depclean".  This makes it
# easier to track down circular dependancies.
#
echo "#!/bin/bash" > cleanscript
echo "#" >> cleanscript
emerge --pretend --depclean |\
  grep -A1 "^ .*/" |\
  grep -v "^ \*" |\
  grep -v "^--" |\
  sed ":/: {
N
s:\n::
s/    selected: /-/
s/^ /emerge --depclean --verbose =/
}" | grep -v "gentoo-sources" >> cleanscript
echo "revdep-rebuild" >> cleanscript
chmod 744 cleanscript

-- 
Walter Dnes <waltd...@waltdnes.org>
I don't run "desktop environments"; I run useful applications

Reply via email to