1 |
On Sun, Apr 01, 2012 at 04:28:15PM +0100, Steven J Long wrote |
2 |
> Walter Dnes wrote: |
3 |
> > I've also cobbled together my |
4 |
> > own "autodepclean" script that check for, and optionally unmerges |
5 |
> > unneeded stuff that was pulled in as a dependancy of a package that has |
6 |
> > since been removed. |
7 |
> > |
8 |
> What advantage does it have over a standard --depclean? |
9 |
|
10 |
It reads the output of "emerge --pretend --depclean" and creates an |
11 |
executable script "cleanscript" in the current directory. cleanscript |
12 |
is a list of "emerge --depclean" commands, followed by "revdep-rebuild" |
13 |
at the very end. The advantage is that you get to see ahead of time |
14 |
what would be removed. Even edit it before running, if you so desire. |
15 |
Here it is... |
16 |
|
17 |
#!/bin/bash |
18 |
# autodepclean script v 0.03 released under GPL v3 by Walter Dnes 2012/01/16 |
19 |
# Generates a file "cleanscript" to remove unused ebuilds, including |
20 |
# buildtime-only dependancies. |
21 |
# |
22 |
# Warning; this script is still beta. I recommend that you check the output |
23 |
# in cleanscript before running it. |
24 |
# |
25 |
# With the arrival of "virtual/editor", the script now suggests removing |
26 |
# app-editors/nano, which may not be what you want. If you want to keep |
27 |
# nano, put it into world |
28 |
# |
29 |
# version 0.03 disables the removal of gentoo-sources. Your current kernel |
30 |
# is not always the most recent one in /usr/src. |
31 |
# |
32 |
echo "#!/bin/bash" > cleanscript |
33 |
echo "#" >> cleanscript |
34 |
emerge --pretend --depclean |\ |
35 |
grep -A1 "^ .*/" |\ |
36 |
grep -v "^ \*" |\ |
37 |
grep -v "^--" |\ |
38 |
sed ":/: { |
39 |
N |
40 |
s:\n:: |
41 |
s/ selected: /-/ |
42 |
s/^ /emerge --depclean =/ |
43 |
}" | grep -v "gentoo-sources" >> cleanscript |
44 |
echo "revdep-rebuild" >> cleanscript |
45 |
chmod 744 cleanscript |
46 |
|
47 |
-- |
48 |
Walter Dnes <waltdnes@××××××××.org> |