gpt4 book ai didi

centos - repoquery --whatrequires --installed 和 yum remove 输出不同。如何获得相同的依赖项输出?

转载 作者:行者123 更新时间:2023-12-04 19:31:29 33 4
gpt4 key购买 nike

在执行 yum remove 之前如何检查将删除哪些依赖项?我刚刚发现两个软件包之间存在一些差异,所以请您帮忙。

JDK 示例(做 yum 时没有依赖关系,但 repoquery 显示依赖关系 - 为什么有区别?)

    root@server DEV # yum remove jdk-1.7.0_101-fcs.x86_64
. . .
Dependencies Resolved

=================================================================================================================================================
Package Arch Version Repository Size
=================================================================================================================================================
Removing:
jdk x86_64 2000:1.7.0_101-fcs @rhel6-x86_64-660-barclays-custom 209 M

Transaction Summary
=================================================================================================================================================
Remove 1 Package(s)

Installed size: 209 M
Is this ok [y/N]: ^CExiting on user Command

root@server DEV # repoquery --whatrequires --installed jdk-1.7.0_101-fcs.x86_64
jdk-2000:1.7.0_101-fcs.x86_64
axis-0:1.2.1-7.5.el6_5.noarch
log4j-0:1.2.14-6.4.el6.x86_64
mx4j-1:3.0.1-9.13.el6.noarch
wsdl4j-0:1.5.2-7.8.el6.noarch
xml-commons-resolver-0:1.1-4.18.el6.x86_64
root@server DEV #

java gcj 在这种情况下工作正常:
    root@server DEV # repoquery --whatrequires --installed java-1.5.0-gcj-1.5.0.0-29.1.el6.x86_64
java-1.5.0-gcj-0:1.5.0.0-29.1.el6.x86_64
axis-0:1.2.1-7.5.el6_5.noarch
bcel-0:5.2-7.2.el6.x86_64
classpathx-jaf-0:1.0-15.4.el6.x86_64
classpathx-mail-0:1.1.1-9.4.el6.noarch
ecj-1:3.4.2-6.el6.x86_64
jakarta-commons-daemon-1:1.0.1-8.9.el6.x86_64
jakarta-commons-httpclient-1:3.1-0.9.el6_5.x86_64
jakarta-commons-pool-0:1.3-12.7.el6.x86_64
java-1.5.0-gcj-0:1.5.0.0-29.1.el6.x86_64
java_cup-1:0.10k-5.el6.x86_64
log4j-0:1.2.14-6.4.el6.x86_64
mx4j-1:3.0.1-9.13.el6.noarch
regexp-0:1.5-4.4.el6.x86_64
sinjdoc-0:0.5-9.1.el6.x86_64
tomcat6-0:6.0.24-80.el6.x86_64
wsdl4j-0:1.5.2-7.8.el6.noarch
xml-commons-apis-0:1.3.04-3.6.el6.x86_64
xml-commons-resolver-0:1.1-4.18.el6.x86_64

root@server DEV # yum remove java-1.5.0-gcj-1.5.0.0-29.1.el6.x86_64
. . .
Dependencies Resolved

=================================================================================================================================================
Package Arch Version Repository Size
=================================================================================================================================================
Removing:
java-1.5.0-gcj x86_64 1.5.0.0-29.1.el6 @rhel6-x86_64-660 150 k
Removing for dependencies:
axis noarch 1.2.1-7.5.el6_5 @rhel6-x86_64-660 1.6 M
bcel x86_64 5.2-7.2.el6 @rhel6-x86_64-660 16 M
classpathx-jaf x86_64 1.0-15.4.el6 @rhel6-x86_64-660 240 k
classpathx-mail noarch 1.1.1-9.4.el6 @rhel6-x86_64-660 822 k
ecj x86_64 1:3.4.2-6.el6 @rhel6-x86_64-660 7.3 M
jakarta-commons-daemon x86_64 1:1.0.1-8.9.el6 @rhel6-x86_64-660 121 k
jakarta-commons-dbcp noarch 1.2.1-13.8.el6 @rhel6-x86_64-660 125 k
jakarta-commons-httpclient x86_64 1:3.1-0.9.el6_5 @rhel6-x86_64-660 1.8 M
jakarta-commons-pool x86_64 1.3-12.7.el6 @rhel6-x86_64-660 368 k
java_cup x86_64 1:0.10k-5.el6 @rhel6-x86_64-660 544 k
log4j x86_64 1.2.14-6.4.el6 @rhel6-x86_64-660 2.0 M
mx4j noarch 1:3.0.1-9.13.el6 @rhel6-x86_64-660 1.7 M
regexp x86_64 1.5-4.4.el6 @rhel6-x86_64-660 248 k
sinjdoc x86_64 0.5-9.1.el6 @rhel6-x86_64-660 2.3 M
tomcat6 x86_64 6.0.24-80.el6 @rhel6-x86_64-660 189 k
tomcat6-lib x86_64 6.0.24-80.el6 @rhel6-x86_64-660 3.2 M
wsdl4j noarch 1.5.2-7.8.el6 @rhel6-x86_64-660 339 k
xml-commons-apis x86_64 1.3.04-3.6.el6 @rhel6-x86_64-660 1.6 M
xml-commons-resolver x86_64 1.1-4.18.el6 @rhel6-x86_64-660 416 k

Transaction Summary
=================================================================================================================================================
Remove 20 Package(s)

Installed size: 41 M
Is this ok [y/N]: ^CExiting on user Command
root@serverDEV #

我什至试过 repoquery --whatrequires --installed --exactdeps <package> .这不会显示不正确的 java gcj 依赖项。

最佳答案

我找到了列出与 yum remove 完全相同的依赖项列表的解决方案。在删除之前做。

因此,您可以采取适当的预删除操作并了解将要删除的内容。

作为一个初学者,我已经用 bash 编写了这个,但这可以很容易地转换为 Puppet 脚本、厨师食谱或任何自动化工具。主要命令是sudo -u nobody rpm -e --test它有两个保护门,以确保这是一个只读命令。

打印完整依赖列表的脚本:

#!/bin/bash

LEVEL="$1"
LEVEL=`rpm -q $LEVEL`

if [ "$?" == "0" ]
then
ALL=$LEVEL

time while :
do
OLD_DEP_COUNT=`echo $ALL| wc -w`
LEVEL=`sudo -u nobody rpm -e --test $LEVEL 2>&1 | grep -v 'Failed dependencies' | awk -F " " '{print $NF}' | sed -e s/[0-9]://g`
ALL="`echo "$LEVEL $ALL" | xargs -n1 | sort -u | xargs`"
NEW_DEP_COUNT=`echo $ALL | wc -w`
if [ "$OLD_DEP_COUNT" == "$NEW_DEP_COUNT" ]
then
for i in $ALL; do echo $i; done
echo "The count of dependencies:"
echo $ALL | wc -w
break
fi
done
else
echo "Cannot find the package"
fi

用法:

./script package_name

关于centos - repoquery --whatrequires --installed <package> 和 yum remove <package> 输出不同。如何获得相同的依赖项输出?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37487000/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com