realdep - moar dependency
Posted: Thu Feb 04, 2016 12:04 pm
realdep shows the next level dependencies of dependencies. "WTF" you ask? Here is the answer:
imagine you check the dependency count of a certain package you want to install, usually you use apt-cache depends <package>, like for xterm:
This does not show you the next dependency level. Using the realdep script, the output gets a bit more verbose:
So here is the script:
It does not iterate through the second dependency level, because in (literally) all of the cases you will arrive at libc6 or libgcc1.
imagine you check the dependency count of a certain package you want to install, usually you use apt-cache depends <package>, like for xterm:
Code: Select all
xterm
Depends: xbitmaps
Depends: libc6
Depends: libfontconfig1
Depends: libice6
Depends: libtinfo5
Depends: libutempter0
Depends: libx11-6
Depends: libxaw7
Depends: libxft2
Depends: libxmu6
Depends: libxpm4
Depends: libxt6
Recommends: x11-utils
Suggests: xfonts-cyrillic
Code: Select all
xterm depends on:
xbitmaps
libc6
libfontconfig1
libice6
libtinfo5
libutempter0
libx11-6
libxaw7
libxft2
libxmu6
libxpm4
libxt6
xbitmaps depends on:
libc6 depends on:
libgcc1
libfontconfig1 depends on:
fontconfig-config
libc6
libexpat1
libfreetype6
multiarch-support
libice6 depends on:
libc6
multiarch-support
x11-common
libtinfo5 depends on:
libc6
libutempter0 depends on:
libc6
libx11-6 depends on:
libc6
libx11-data
libxcb1
multiarch-support
libxaw7 depends on:
libc6
libx11-6
libxext6
libxmu6
libxpm4
libxt6
libxft2 depends on:
libc6
libfontconfig1
libfreetype6
libx11-6
libxrender1
multiarch-support
libxmu6 depends on:
libc6
libx11-6
libxext6
libxt6
libxpm4 depends on:
libc6
libx11-6
multiarch-support
libxt6 depends on:
libc6
libice6
libsm6
libx11-6
Code: Select all
#!/bin/sh
PKG=$@
DEPLIST=/tmp/deplist.$$$
NEXTDEPLIST=/tmp/nextdeplist.$$$
apt-cache depends $PKG | grep epends | gawk -F: '{ print $2 } ' | sed '/^$/d' > $DEPLIST
printf "$PKG depends on:\n"
cat $DEPLIST
for line in $(cat $DEPLIST); do
apt-cache depends $line | grep epends | gawk -F: '{ print $2 } ' | sed '/^$/d' | tr -d '<>' | sort -u | uniq > $NEXTDEPLIST
printf "$line depends on: \n"
cat $NEXTDEPLIST
done