Centos
我應該如何為 yum 中的包提供替代品?
我正在編寫一個規範文件,用我們自己的儲存庫中的一個替換 yum 包。新包裝將成為原始包裝的直接替代品。
我認為最好的方法是給 spec 文件一個相同的文件
Conflicts
,Provides
就像使用典型的 Arch Linux 軟體包一樣:Name: vncsnapshot-png Provides: vncsnapshot Conflicts: vncsnapshot
這似乎可行,並且可以毫無問題地安裝/降級/升級該軟體包。但是,重新安裝失敗:
Loaded plugins: security Setting up Reinstall Process Resolving Dependencies --> Running transaction check ---> Package vncsnapshot-png.x86_64 0:1.3-1.el6 will be reinstalled --> Finished Dependency Resolution Dependencies Resolved =============================================================================================================================================================== Package Arch Version Repository Size =============================================================================================================================================================== Reinstalling: vncsnapshot-png x86_64 1.3-1.el6 sv.repo 35 k Transaction Summary =============================================================================================================================================================== Reinstall 1 Package(s) Total download size: 35 k Installed size: 72 k Is this ok [y/N]: y Downloading Packages: vncsnapshot-png-1.3-1.el6.x86_64.rpm | 35 kB 00:00 Running rpm_check_debug ERROR with rpm_check_debug vs depsolve: vncsnapshot conflicts with vncsnapshot-png-1.3-1.el6.x86_64 vncsnapshot conflicts with vncsnapshot-png-1.3-1.el6.x86_64 ** Found 1 pre-existing rpmdb problem(s), 'yum check' output follows: vncsnapshot-png-1.3-1.el6.x86_64 has installed conflicts vncsnapshot: vncsnapshot-png-1.3-1.el6.x86_64 Your transaction was saved, rerun it with: yum load-transaction /tmp/yum_save_tx-2016-02-18-12-18dAjmpb.yumtx
有沒有辦法在提供原始包(即直接替換)的同時將包標記為與原始包衝突(即不能同時安裝),而不會遇到這個問題?
在 RPM 語言中,衝突也適用於虛擬提供,因此您的包與自身發生衝突。要解決此問題,您需要使用版本宏限定您的
Provides
和。Conflicts
Provides: vncsnapshot = %{version} Conflicts: vncsnapshot < %{version}
我經常為IUS 項目做這件事。通過查看我們的一些規範文件,您可以看到更多範例。