You are not logged in.

#1 2017-06-26 19:09:03

scorici
Member
Registered: 2012-02-06
Posts: 19

[SOLVED] pacman -Qqdt doesn't find all orphan packages

Actually maybe it does, but I might not understand the logic behind it. I understand that an orphan package is one that it isn't required by other packages and is installed as a dependency for other package/s.
On my system if I run "pacman -Qqdt" it return only webkitgtk2
So I wrote a small script to test if there are packages that aren't required by other packages and are installed as dependencies.

#/bin/bash
for i in $(pacman -Qq)
do
	requiredby=$(pacman -Qi $i | grep 'Required By' | cut -d ':' -f 2)
	if [ "$requiredby" == " None" ]; then 
		installreason=$(pacman -Qi $i | grep 'Install Reason' | cut -d ':' -f 2)
		[ "$installreason" == " Installed as a dependency for another package" ] && echo $i
	fi
done

And the script returns:

coin-or-mp
dhclient
dialog
dvdauthor
fluidsynth
libisofs
lua-socket
pulseaudio-alsa
python-html2text
python2-pyqt4
ruby
scrot
unace
unixodbc
webkitgtk2

Only webkitgtk2 is found by "pacman -Qqdt".
The script doesn't run very fast but is the best I could do.
Don't ask me about those packages, I don't remember how they got there smile (except a few)
Maybe I manually installed them with the --asdeps flag or manually changed the install reason, I don't remember.
Anyway maybe this will help someone someday which has a messy system like mine smile
Any corrections or observations are welcomed as long as they are polite.

Last edited by scorici (2017-06-26 19:18:38)

Offline

#2 2017-06-26 19:14:06

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,449
Website

Re: [SOLVED] pacman -Qqdt doesn't find all orphan packages

man pacman wrote:

-t, --unrequired
   Restrict or filter output to packages not required or optionally required by any currently installed package. Specify this option twice to only filter packages that are direct dependencies (i.e. do not filter optional dependencies).

Read the second sentence.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2017-06-26 19:18:00

scorici
Member
Registered: 2012-02-06
Posts: 19

Re: [SOLVED] pacman -Qqdt doesn't find all orphan packages

Wow, thank you !
This is very helpful, and very fast compared with my script.

Offline

Board footer

Powered by FluxBB