On Sun, Apr 01, 2012 at 04:28:15PM +0100, Steven J Long wrote
> Walter Dnes wrote:
> > I've also cobbled together my
> > own "autodepclean" script that check for, and optionally unmerges
> > unneeded stuff that was pulled in as a dependancy of a package that has
> > since been removed.
> >
> What advantage does it have over a standard --depclean?

  It reads the output of "emerge --pretend --depclean" and creates an
executable script "cleanscript" in the current directory.  cleanscript
is a list of "emerge --depclean" commands, followed by "revdep-rebuild"
at the very end.  The advantage is that you get to see ahead of time
what would be removed.  Even edit it before running, if you so desire.
Here it is...

#!/bin/bash
# autodepclean script v 0.03 released under GPL v3 by Walter Dnes 2012/01/16
# 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.
#
echo "#!/bin/bash" > cleanscript
echo "#" >> cleanscript
emerge --pretend --depclean |\
  grep -A1 "^ .*/" |\
  grep -v "^ \*" |\
  grep -v "^--" |\
  sed ":/: {
N
s:\n::
s/    selected: /-/
s/^ /emerge --depclean =/
}" | grep -v "gentoo-sources" >> cleanscript
echo "revdep-rebuild" >> cleanscript
chmod 744 cleanscript

-- 
Walter Dnes <waltd...@waltdnes.org>

Reply via email to