You are not logged in.
Hello, is there a pacman argument that allows to check recursively the dependencies of a NON installed package?
Usually a first level dependency listing could be done by "pacman -Si". I prepared the following script for listing in each row the dependencies of the dependencies in a PKGBUILD
#!/bin/sh
if [ ! -f PKGBUILD ]; then
echo "PKGBUILD not found in the current directory."
exit 1
fi
read -p "Type the name of dependency you want to check: " target
deps=$(grep "^depends=" PKGBUILD | awk -F"=" '{print $2}' | sed -e "s/[()']//g" -e "s/ /\n/g" | sed '/^$/d')
echo "Checking for nested dependencies"
while read -r dep
do
list=$(pacman -Si $dep | grep "Depends On" | sed -e "s/Depends On : //g" -e "s/ /\n/g" | awk '!seen[$0]++' | awk -F"=" '{print $1}' | awk -F".so" '{print $1}') #Extract sub-dependencies for each package dep
while read -r subdep
do
if [ $target == "$subdep" ]; then
echo "The PKGBUILD dependency "$dep" contains the provided dependency $target."
fi
done <<< $list
if [ $target == "$dep" ]; then
echo "The typed dependency "$dep" is directly inside the PKGBUILD ad dependency."
fi
done <<< $deps
I know that I could get the result of using a further nested loop for each sub-dependency but I was looking for something more efficient (i.e., a pacman argument if exists).
Thanks
Last edited by D3vil0p3r (2023-01-22 18:45:46)
Offline
pactree, from pacman-contrib, can do this. It has a switch to use the sync databases instead of the local databases.
Offline
Thank you @Scimmia. I see "pactree -s <pkgname>"
Offline
If you also only care about dependencies in that tree that are also not installed, you can just use pacman:
pacman -S --print-format %n $pkg
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline