Created
May 5, 2017 09:29
-
-
Save jtyr/45f78cbe97755a02dc01027b4711bb7b to your computer and use it in GitHub Desktop.
Bash function which helps to print out the RPM dependency tree for a specific package.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function walk() { | |
if [ $1 == 0 ]; then | |
echo -n "" > /tmp/deps; | |
fi | |
echo $2 >> /tmp/deps; | |
for N in $(seq $1); do | |
echo -n ' '; | |
done | |
echo -n '- '; | |
echo $2; | |
DEPS=$(rpm -q --whatrequires $2 | grep -v 'no package' | sort -u | sed 's/-[0-9].*//'); | |
for D in $DEPS; do | |
if [ $(egrep "^$D$" /tmp/deps | wc -l) == "0" ]; then | |
walk $(( $1 + 1 )) $D; | |
fi | |
done | |
} | |
walk 0 perl |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment