当使用lz4
检查依赖于特定包(在本例中为rpm
)的包时,它不会列出任何需要lz4-1.7.5-2.el7.i686
和lz4-1.7.5-2.el7.x86_64
的包...
# rpm -q --whatrequires lz4-1.7.5-2.el7.i686
no package requires lz4-1.7.5-2.el7.i686
# rpm -q --whatrequires lz4-1.7.5-2.el7.x86_64
no package requires lz4-1.7.5-2.el7.x86_64
#
但是我不能在不使用rpm --nodeps
的情况下卸载其中任何一个,因为systemd
和/或systemd-libs
似乎需要它们。
# rpm --erase --allmatches lz4
error: Failed dependencies:
liblz4.so.1()(64bit) is needed by (installed) systemd-libs-219-57.el7_5.1.x86_64
liblz4.so.1()(64bit) is needed by (installed) systemd-219-57.el7_5.1.x86_64
liblz4.so.1 is needed by (installed) systemd-libs-219-57.el7_5.1.i686
#
看起来rpm --whatrequires
的输出是错误的但是它呢? (我怀疑它实际上是错的 - 但我不明白它为什么不包括systemd
或systemd-libs
?
我想如果使用rpm --erase --test
而不是rpm --whatrequires
来识别是否具有依赖性的包但是还有另一种更可靠的方法来做到这一点?
谢谢你的帮助。
这有点棘手。 rpm --whatrequires
追踪能力;不仅仅是包裹。
如果你再试一次;你会看到:
rpm --whatrequires "liblz4.so.1()(64bit)"
将为您提供结果。
rpm --erase --test
似乎是一个很好的方式去找我。另一种方法是循环使用要删除的包提供的功能;但那会慢一些。这是一个小的bash脚本,它循环遍历lz4的功能并打印依赖于这些功能的包:
packageToRemove=lz4
for capability in $(rpm -q $packageToRemove --provides | awk '{print $1}')
do
echo "packages requiring $capability:"
rpm -q --whatrequires "$capability"
done
以下命令给出了我期待的结果,尽管我仍然不明白为什么rpm --whatrequires
不起作用。 (在构建我的第一个包之前,我可能不会想到这一点)。
# repoquery --alldeps --whatrequires --cache --installed lz4
systemd-0:219-57.el7.x86_64
systemd-libs-0:219-57.el7.i686
systemd-libs-0:219-57.el7.x86_64
#
但在某些情况下,输出可能会“有趣”......
# repoquery --alldeps --whatrequires --cache --installed lvm2-libs
lvm2-7:2.02.177-4.el7.x86_64
lvm2-libs-7:2.02.177-4.el7.x86_64
#
# repoquery --whatrequires --cache --installed lvm2
lvm2-7:2.02.177-4.el7.x86_64
#