我正在编写 spec 文件,用我们自己的存储库中的软件包替换 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
有没有办法将包标记为与原始包冲突(即不能同时安装)同时提供原始包(即可插入替换),而不会遇到此问题?
答案1
在 RPM 语言中,冲突也适用于虚拟提供程序,因此您的软件包与自身发生冲突。要解决此问题,您需要使用版本宏来限定您的Provides
and 。Conflicts
Provides: vncsnapshot = %{version}
Conflicts: vncsnapshot < %{version}
我经常这样做IUS 项目。您可以通过查看我们的一些规范文件来查看更多示例。