回答

回答

我正在尝试在 RHEL5 上安装第 3 方 RPM 软件包,该软件包依赖于 sqlite 3.4 版本。根据 Yum 的说法,我已经安装了 3.3.6。

有没有办法列出依赖于 sqlite 3.3.6 的已安装软件包?

答案1

回答

repoquery -q --installed --whatrequires sqlite

说明

还有另一个命令 ,rpm -q --whatrequires sqlite但它并没有真正起作用,因为它只报告对包名称的依赖关系。

相反,repoquery也会寻找非显式的依赖关系。手册页摘录:

   --alldeps
          When used with --whatrequires, look for non-explicit dependencies in addition to explicit ones (e.g. files and Provides  in  addition  to  package  names).
          This is the default.

例子

我们拿包裹吧libdb

# rpm -q --whatrequires libdb
no package requires libdb

如果我们信任rpm,则没有任何软件包依赖,libdb因此我们应该能够顺利删除它。然而...

# yum remove -y libdb
Loaded plugins: fastestmirror
Resolving Dependencies
--> Running transaction check
---> Package libdb.x86_64 0:5.3.21-19.el7 will be erased
--> Processing Dependency: libdb(x86-64) = 5.3.21-19.el7 for package: libdb-utils-5.3.21-19.el7.x86_64
--> Processing Dependency: libdb-5.3.so()(64bit) for package: pam-1.1.8-12.el7_1.1.x86_64
--> Processing Dependency: libdb-5.3.so()(64bit) for package: rpm-4.11.3-17.el7.x86_64
--> Processing Dependency: libdb-5.3.so()(64bit) for package: rpm-libs-4.11.3-17.el7.x86_64
--> Processing Dependency: libdb-5.3.so()(64bit) for package: libdb-utils-5.3.21-19.el7.x86_64
--> Processing Dependency: libdb-5.3.so()(64bit) for package: cyrus-sasl-lib-2.1.26-20.el7_2.x86_64
--> Processing Dependency: libdb-5.3.so()(64bit) for package: rpm-python-4.11.3-17.el7.x86_64
--> Processing Dependency: libdb-5.3.so()(64bit) for package: python-libs-2.7.5-39.el7_2.x86_64
--> Processing Dependency: libdb-5.3.so()(64bit) for package: rpm-devel-4.11.3-17.el7.x86_64
--> Processing Dependency: libdb-5.3.so()(64bit) for package: 2:postfix-2.10.1-6.el7.x86_64
--> Processing Dependency: libdb-5.3.so()(64bit) for package: rpm-build-libs-4.11.3-17.el7.x86_64
--> Processing Dependency: libdb-5.3.so()(64bit) for package: iproute-3.10.0-54.el7_2.1.x86_64
--> Running transaction check
. . .
. . .
. . .
Error: Trying to remove "systemd", which is protected
Error: Trying to remove "yum", which is protected

正如您所看到的,其他一些包并不直接依赖于 package libdb,而是依赖于它提供的文件libdb-5.3.so()(64bit)

最后,在使用时repoquery我们会得到真正的软件包列表,具体取决于libdb

# repoquery -q --installed --whatrequires libdb
cyrus-sasl-lib-0:2.1.26-20.el7_2.x86_64
iproute-0:3.10.0-54.el7_2.1.x86_64
libdb-utils-0:5.3.21-19.el7.x86_64
pam-0:1.1.8-12.el7_1.1.x86_64
postfix-2:2.10.1-6.el7.x86_64
python-libs-0:2.7.5-39.el7_2.x86_64
rpm-0:4.11.3-17.el7.x86_64
rpm-build-libs-0:4.11.3-17.el7.x86_64
rpm-devel-0:4.11.3-17.el7.x86_64
rpm-libs-0:4.11.3-17.el7.x86_64
rpm-python-0:4.11.3-17.el7.x86_64

答案2

您想要的 rpm 选项是:

rpm -q --whatrequires sqlite

编辑:添加--根据其他答案/评论中的讨论安装

编辑:删除 --installed 因为它是 rpm 的无效选项

答案3

对于 dnf(新版 yum),您可以尝试使用重新查询包装器命令:

dnf repoquery --whatrequires sqlite

如果它不可用,您可以使用命令安装它:

dnf -y install dnf-plugins-core

答案4

我认为您真正想知道的是“哪些软件包需要 sqlite-3.3.6,但对 sqlite-3.4.z 不满意”......找出这一点的唯一好方法是尝试一下。喜欢:

echo | yum upgrade sqlite

相关内容