高效的 apt 依赖

高效的 apt 依赖

我想了解更多有关给定包实际安装的内容(出于调试目的)。

apt-cache 的所有选项仅提供依赖包,可能是所需的版本,但不提供这些包的已安装版本。

我知道编写脚本并不难,但我很好奇想找到现有的解决方案(我确信我不是第一个这样做的人!)

答案1

我对你的问题有点困惑,因为我理解使用 rdepends 实用程序应该会向你显示你需要什么(这应该在你使用的任何发行版的存储库中可用),例如:

$ apt-rdepends bash
Reading package lists... Done
Building dependency tree       
Reading state information... Done
bash
  Depends: base-files (>= 2.1.12)
  Depends: debianutils (>= 2.15)
  PreDepends: libc6 (>= 2.7-1)
  PreDepends: libncurses5 (>= 5.6+20071006-3)
base-files
  Depends: base-passwd (>= 2.0.3.4)
  PreDepends: awk
...

是 bash 中显示的内容。

答案2

apt-get 的“-s”选项会显示将安装哪些其他软件包,以便在您的系统上安装特定软件包,而无需实际安装任何内容。这就是您想要的吗?

xen1:~# apt-get -s install spamassassin
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  binutils cpp cpp-4.3 gcc gcc-4.3 libc6-dev libdigest-hmac-perl
  libdigest-sha1-perl liberror-perl libgmp3c2 libgomp1 libio-socket-inet6-perl
  libmail-spf-perl libmpfr1ldbl libnet-dns-perl libnet-ip-perl
  libnetaddr-ip-perl libsocket6-perl libsys-hostname-long-perl
  libsys-syslog-perl linux-libc-dev make re2c spamc
Suggested packages:
  binutils-doc cpp-doc gcc-4.3-locales gcc-multilib manpages-dev autoconf
  automake1.9 libtool flex bison gdb gcc-doc gcc-4.3-multilib
  libmudflap0-4.3-dev gcc-4.3-doc libgcc1-dbg libgomp1-dbg libmudflap0-dbg
  glibc-doc make-doc razor libnet-ident-perl libio-socket-ssl-perl pyzor
  libmail-dkim-perl
The following NEW packages will be installed:
  binutils cpp cpp-4.3 gcc gcc-4.3 libc6-dev libdigest-hmac-perl
  libdigest-sha1-perl liberror-perl libgmp3c2 libgomp1 libio-socket-inet6-perl
  libmail-spf-perl libmpfr1ldbl libnet-dns-perl libnet-ip-perl
  libnetaddr-ip-perl libsocket6-perl libsys-hostname-long-perl
  libsys-syslog-perl linux-libc-dev make re2c spamassassin spamc
0 upgraded, 25 newly installed, 0 to remove and 0 not upgraded.
Inst binutils (2.18.1~cvs20080103-7 Debian:5.0.1/stable)
Inst libgmp3c2 (2:4.2.2+dfsg-3 Debian:5.0.1/stable)
Inst libmpfr1ldbl (2.3.1.dfsg.1-2 Debian:5.0.1/stable)
Inst cpp-4.3 (4.3.2-1.1 Debian:5.0.1/stable)
Inst cpp (4:4.3.2-2 Debian:5.0.1/stable)
Inst libgomp1 (4.3.2-1.1 Debian:5.0.1/stable)
Inst gcc-4.3 (4.3.2-1.1 Debian:5.0.1/stable)
Inst gcc (4:4.3.2-2 Debian:5.0.1/stable)
Inst linux-libc-dev (2.6.26-15lenny2 Debian-Security:5.0/stable)
Inst libc6-dev (2.7-18 Debian:5.0.1/stable)
Inst libdigest-sha1-perl (2.11-2+b1 Debian:5.0.1/stable)
Inst libdigest-hmac-perl (1.01-7 Debian:5.0.1/stable)
Inst liberror-perl (0.17-1 Debian:5.0.1/stable)
Inst libsocket6-perl (0.20-1 Debian:5.0.1/stable)
Inst libio-socket-inet6-perl (2.54-1 Debian:5.0.1/stable)
Inst libnetaddr-ip-perl (4.007+dfsg-2+b1 Debian:5.0.1/stable)
Inst libnet-ip-perl (1.25-2 Debian:5.0.1/stable)
Inst libnet-dns-perl (0.63-2 Debian:5.0.1/stable)
Inst libmail-spf-perl (2.005-1 Debian:5.0.1/stable)
Inst libsys-hostname-long-perl (1.4-2 Debian:5.0.1/stable)
Inst libsys-syslog-perl (0.26-1 Debian:5.0.1/stable)
Inst make (3.81-5 Debian:5.0.1/stable)
Inst re2c (0.13.5-1 Debian:5.0.1/stable)
Inst spamassassin (3.2.5-2 Debian:5.0.1/stable)
Inst spamc (3.2.5-2 Debian:5.0.1/stable)
Conf binutils (2.18.1~cvs20080103-7 Debian:5.0.1/stable)
Conf libgmp3c2 (2:4.2.2+dfsg-3 Debian:5.0.1/stable)
Conf libmpfr1ldbl (2.3.1.dfsg.1-2 Debian:5.0.1/stable)
Conf cpp-4.3 (4.3.2-1.1 Debian:5.0.1/stable)
Conf cpp (4:4.3.2-2 Debian:5.0.1/stable)
Conf libgomp1 (4.3.2-1.1 Debian:5.0.1/stable)
Conf gcc-4.3 (4.3.2-1.1 Debian:5.0.1/stable)
Conf gcc (4:4.3.2-2 Debian:5.0.1/stable)
Conf linux-libc-dev (2.6.26-15lenny2 Debian-Security:5.0/stable)
Conf libc6-dev (2.7-18 Debian:5.0.1/stable)
Conf libdigest-sha1-perl (2.11-2+b1 Debian:5.0.1/stable)
Conf libdigest-hmac-perl (1.01-7 Debian:5.0.1/stable)
Conf liberror-perl (0.17-1 Debian:5.0.1/stable)
Conf libsocket6-perl (0.20-1 Debian:5.0.1/stable)
Conf libio-socket-inet6-perl (2.54-1 Debian:5.0.1/stable)
Conf libnetaddr-ip-perl (4.007+dfsg-2+b1 Debian:5.0.1/stable)
Conf libnet-ip-perl (1.25-2 Debian:5.0.1/stable)
Conf libnet-dns-perl (0.63-2 Debian:5.0.1/stable)
Conf libmail-spf-perl (2.005-1 Debian:5.0.1/stable)
Conf libsys-hostname-long-perl (1.4-2 Debian:5.0.1/stable)
Conf libsys-syslog-perl (0.26-1 Debian:5.0.1/stable)
Conf make (3.81-5 Debian:5.0.1/stable)
Conf re2c (0.13.5-1 Debian:5.0.1/stable)
Conf spamassassin (3.2.5-2 Debian:5.0.1/stable)
Conf spamc (3.2.5-2 Debian:5.0.1/stable)
xen1:~# 

相关内容