为什么我特意列出来的时候 rpm/yum 没有取到需要的包?

Why won't rpm/yum pick up the required packages when I list it specifically?

我遇到一个问题,使用 rpmyum 无法获取更新所需的软件包。我正在将 main-package 从 16.1 升级到 16.2。如果我执行 yum upgrade,我会得到:

# yum upgrade
...
======================================================================================================
 Package                       Arch           Version                      Repository            Size
======================================================================================================
Updating:
 sub-package                   x86_64         1.1-455015.el7               privaterepo           29 k
 main-package                  noarch         16.2-460032.el7              privaterepo          1.9 M
...

如果我 运行 yum upgrade main-package 我明白了:

# yum upgrade main-package
======================================================================================================
 Package                        Arch            Version                   Repository             Size
======================================================================================================
Updating:
 main-package                   noarch          16.2-460032.el7           privaterepo           1.9 M

Transaction Summary
======================================================================================================

它似乎并不认为我需要新的 子包 ,尽管 RPM 表明它需要:

# rpm -q --requires -p main-package-16.2-460032.el7.noarch.rpm  | grep -i sub-package
sub-package >= 1.1

# rpm -qa | grep sub-package
sub-package-1.0-455013.el7.x86_64

根据我的观察,当我yum upgrade main-package时,它应该看到它需要sub-package >= 1.1 并得到它。我应该补充一点,安装工作正常。就好像 rpmyum 完全忽略了 main-package 需要 1.1 版本的要求 分包.

编辑:

这是 rpm 显示的有关依赖项的内容:

# rpm -q --provides -p sub-package-1.1-455015.el7.x86_64.rpm 
sub-package
sub-package = 1.1-455015.el7
sub-package(x86-64) = 1.1-455015.el7

# rpm -q --requires -p main-package-16.2-460032.el7.noarch.rpm  | grep sub-package
sub-package >= 1.1

这是已安装的旧 子包

# rpm -q --provides sub-package
sub-package
sub-package = 1.0-455013.el7
sub-package(x86-64) = 1.0-455013.el7

这是我的规范文件中的相关信息:

$ grep sub-package main-package.spec
Requires: sub-package >= 1.1

$ head -n4 sub-package.spec
Summary: sub-package (...)
Name: sub-package
Version: 1.1
Release: %{BUILD_NUMBER}%{?dist}

编辑 2:

我一直在做更多的挖掘,我注意到的一件事是 sub-package 如果我 rpm -q --whatprovides sub 列出了两次-package 它选择的其他依赖项只列出一次。

感谢@alvits,答案是我有

Provides: sub-package

子包 规范文件中。提示来自这一行:

# rpm -q --provides -p sub-package-1.1-455015.el7.x86_64.rpm 
sub-package
sub-package = 1.1-455015.el7
sub-package(x86-64) = 1.1-455015.el7

第一行输出告诉rpm我的分包版本满足所有版本