我可以像这样揭示包依赖关系
apt-cache show wget | grep ^Depends
不过,我还想列出依赖项的依赖项,因此输出将是这样的
wget
libc6
libgcc1
gcc-4.9-base
libidn11
libssl1.0.0
debconf
libuuid1
passwd
libpam0g
libselinux1
libsemanage1
libpam-modules
debianutils
zlib1g
此示例的深度为 4,但我希望实际解决方案具有完整的深度。
答案1
有时您需要找出某个软件包的所有依赖项。本教程介绍如何使用 apt-rdepends 递归列出 Debian/Ubuntu 软件包的所有依赖项。
我不能保证这对您有用!
1安装apt-rdepends
apt-rdepends 可以按如下方式安装:
apt-get install apt-rdepends
如果你使用的是 Ubuntu 并且没有以 root 身份登录,请使用
sudo apt-get install apt-rdepends
反而。
2使用apt-rdepends
apt-rdepends 的使用方法如下:
apt-rdepends <packagename>
例如,要找出包 wget 的所有依赖项,请运行:
apt-rdepends wget
这是一个示例输出:
falko@falko-virtual-machine:~$ apt-rdepends wget
Reading package lists... Done
Building dependency tree
Reading state information... Done
wget
Depends: dpkg (>= 1.15.4)
Depends: install-info
Depends: libc6 (>= 2.11)
Depends: libssl1.0.0 (>= 1.0.0)
dpkg
PreDepends: coreutils (>= 5.93-1)
PreDepends: libbz2-1.0
PreDepends: libc6 (>= 2.11)
PreDepends: libselinux1 (>= 1.32)
PreDepends: xz-utils
PreDepends: zlib1g (>= 1:1.1.4)
coreutils
PreDepends: libacl1 (>= 2.2.11-1)
PreDepends: libattr1 (>= 2.4.41-1)
PreDepends: libc6 (>= 2.7)
PreDepends: libselinux1 (>= 1.32)
libacl1
Depends: libattr1 (>= 2.4.41-1)
Depends: libc6 (>= 2.4)
PreDepends: multiarch-support
libattr1
Depends: libc6 (>= 2.4)
PreDepends: multiarch-support
libc6
Depends: libc-bin (= 2.13-20ubuntu5)
Depends: libgcc1
Depends: tzdata
libc-bin
libgcc1
Depends: gcc-4.6-base (= 4.6.1-9ubuntu3)
Depends: libc6 (>= 2.2.5)
PreDepends: multiarch-support
gcc-4.6-base
multiarch-support
Depends: libc6 (>= 2.3.6-2)
tzdata
Depends: debconf (>= 0.5)
Depends: debconf-2.0
debconf
PreDepends: perl-base (>= 5.6.1-4)
perl-base
PreDepends: dpkg (>= 1.14.20)
PreDepends: libc6 (>= 2.11)
debconf-2.0
libselinux1
Depends: libc6 (>= 2.8)
PreDepends: multiarch-support
libbz2-1.0
Depends: libc6 (>= 2.4)
xz-utils
Depends: libc6 (>= 2.7)
Depends: liblzma2 (>= 5.0.0)
liblzma2
Depends: libc6 (>= 2.4)
zlib1g
Depends: libc6 (>= 2.4)
PreDepends: multiarch-support
install-info
Depends: libc6 (>= 2.4)
libssl1.0.0
Depends: debconf (>= 0.5)
Depends: debconf-2.0
Depends: libc6 (>= 2.7)
Depends: zlib1g (>= 1:1.1.4)
PreDepends: multiarch-support
falko@falko-virtual-machine:~$
对于大多数软件包,输出会更长,可能无法在屏幕上显示。在这种情况下,您可以将输出导入 more(或 less),例如:
apt-rdepends apache2 | 更多
apt-rdepends apache2 | 更少
复制自如何锻造