Yum

Yum 未能遵守軟體包的版本要求

  • November 28, 2019

我在使用 yum 解決我的項目的依賴項時遇到問題,該項目由我們自己建構的多個 RPM 組成。我已經建立了一個 RPM:

Requires: Database-devel = 1.0.0

但是當我執行時:

$ yum deplist Release/ConfigLoader-devel-4.0.1-0.191128.123053.g83eb.b.d.el7.x86_64.rpm
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* epel: epel.besthosting.ua
package: ConfigLoader-devel.x86_64 4.0.1-0.191128.123053.g83eb.b.d.el7
 dependency: /bin/sh
  provider: bash.x86_64 4.2.46-31.el7
 dependency: Database-devel = 1.0.0
  provider: Database-devel.x86_64 2.0.0-0.191126.123742.gb769.r

它表示該依賴項的提供者(最後一行)的版本為 2.0.0。以下附加資訊確認 Database-devel 軟體包的版本在 yum 儲存庫中設置正確,並且有 1.0.0 版本可供 yum 選擇:

$ yum info Database-devel
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* epel: epel.besthosting.ua
Available Packages
Name        : Database-devel
Arch        : x86_64
Version     : 2.0.0
Release     : 0.191126.123742.gb769.r
Size        : 13 k
Repo        : localrepo-oel7


$ yum info Database-devel-1.0.0-1
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* epel: epel.besthosting.ua
Available Packages
Name        : Database-devel
Arch        : x86_64
Version     : 1.0.0
Release     : 1
Size        : 13 k
Repo        : localrepo-oel7

問題是當我嘗試安裝 ConfigLoader-devel RPM 時,它會嘗試拉下 Database-devel 2.0.0 包並安裝它,這會破壞我的建構。

我的百勝版本是:

$ yum --version
3.4.3
 Installed: rpm-4.11.3-35.el7.x86_64 at 2019-05-21 13:14
 Built    : CentOS BuildSystem <http://bugs.centos.org> at 2018-10-30 19:27
 Committed: Pavlina Moravcova Varekova &lt;pmoravco@redhat.com&gt; at 2018-06-19

 Installed: yum-3.4.3-161.0.1.el7.noarch at 2019-06-05 11:27
 Built    : None at 2018-11-01 10:10
 Committed: EL Errata &lt;el-errata_ww@oracle.com&gt; at 2018-10-31

 Installed: yum-plugin-fastestmirror-1.1.31-50.el7.noarch at 2019-05-21 13:15
 Built    : CentOS BuildSystem <http://bugs.centos.org> at 2018-10-30 22:58
 Committed: Michal Domonkos &lt;mdomonko@redhat.com&gt; at 2018-08-24

我該如何進一步診斷?

可能您的包裹Database-devel提供Database-devel. 你可以這樣檢查:

rpm -q Database-devel --provides

它應該這樣說:

Database-devel = 2.0.0-0

如果它還說:

Database-devel

沒有版本號,那麼這意味著rpmyum提供了所有版本Database-devel,包括版本 1.0.0。

您應該刪除該行

Provides: Database-devel

從您的規範文件中。每個包都會自動提供自己的名稱和版本。

引用自:https://unix.stackexchange.com/questions/554610