On Fri, Oct 25, 2024 at 07:22:01PM +0000, Alan Mackenzie wrote > > There doesn't appear to be anything better in emerge - I've looked but > not found an emerge action to unmerge specific packages only, apart from > --unmerge. Why is there not a version of --unmerge which does safety > checks first?
I've cobbled together a script of my own to handle this. It's /root/bin/autodepclean : NOTE: it does *NOT* clean out anything. Rather, it generates a script "cleanscript" in the current directory. The idea is that you inspect it first before running ./cleanscript ########################################## #!/bin/bash # autodepclean script v 0.04 released under GPL v3 by Walter Dnes # 2023/02/18 Generates a file "cleanscript" in the current directory to # remove unused ebuilds, including buildtime-only dependancies. # # Warning; this script is 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. # # version 0.05 wipes cleanscript if no files to process. This guards # against the edge case of running a flat "emerge --depclean" if there # are no ebuilds to remove. echo "#!/bin/bash" > cleanscript echo "#" >> cleanscript echo "emerge --depclean \\" >> cleanscript emerge --pretend --depclean |\ grep -A1 "^ .*/" |\ grep -v "^ \*" |\ grep -v "^--" |\ sed ":/: { N s:\n:: s/ selected: /-/ s/^ / =/ s/$/ \\\/ }" | grep -v "=app-editors/nano" |\ grep -v "=sys-kernel/gentoo-sources" |\ grep -v "=sys-devel/gcc-" >> cleanscript echo ' ; echo ""' >> cleanscript echo "revdep-rebuild" >> cleanscript chmod 744 cleanscript if grep "=" cleanscript >> /dev/null 2>&1 ; then echo "OK to proceed." else echo "" > cleanscript echo "Nothing to process" fi ########################################## I last updated my system 32 days ago. When I ran "autodepclean" after updating world today, it generated the following "cleanscript" ########################################## #!/bin/bash # emerge --depclean \ =net-dns/bind-tools-9.18.0 \ =dev-python/pip-24.2-r1 \ =dev-build/autoconf-2.71-r7 \ =dev-python/typing-extensions-4.12.2 \ =dev-python/truststore-0.9.2 \ =dev-python/rich-13.7.1 \ =dev-python/resolvelib-1.0.1 \ =dev-python/pyproject-hooks-1.1.0 \ =dev-python/distro-1.9.0 \ =dev-python/distlib-0.3.8 \ =dev-python/cachecontrol-0.14.0 \ =dev-python/requests-2.32.3 \ =dev-python/poetry-core-1.9.0 \ =dev-python/msgpack-1.0.8 \ =dev-python/markdown-it-py-3.0.0 \ =dev-python/colorama-0.4.6 \ =dev-python/urllib3-2.2.2 \ =dev-python/mdurl-0.1.2 \ =dev-python/linkify-it-py-2.0.3 \ =dev-python/lark-1.2.2 \ =dev-python/idna-3.8 \ =dev-python/fastjsonschema-2.20.0 \ =dev-python/charset-normalizer-3.3.2 \ =dev-python/certifi-3024.7.22 \ =dev-python/uc-micro-py-1.0.3 \ =dev-python/PySocks-1.7.1-r2 \ ; echo "" revdep-rebuild ########################################## autodepclean takes out a lot of "virtual-perl" packages after a perl update, but doesn't cause problems. -- There are 2 types of people in this world 1) Those who can extrapolate from incomplete data