How can I make an RPM depend on package a OR package b?

倾然丶 夕夏残阳落幕 提交于 2019-12-01 00:15:38

问题


This seems like a simple question, but the docs don't seem to have anything to say on the subject. I would like to do something like Requires: vim or emacs but when I do that, I in fact depend on vim, or and emacs. What is the syntax for depending on one or another of two packages?


回答1:


The standard way to do this is via virtual provides: the providing RPMs each state that they provide a virtual package, and the dependent RPM requires that virtual package. So, in your example, vim and emacs both Provides: text-editor, and your package would Requires: text-editor.

If the packages that you're depending on don't provide an appropriate virtual package, you could probably hack around this by making up your own. Make dummy my-package-vim-mode and my-package-emacs-mode RPMs that Requires: vim and Requires: emacs, respectively, and Provides: my-package-text-editor, then have your package Requires: my-package-text-editor.




回答2:


If packages don't have common Provide, and you don't want to rebuild and maintain forks of that packages, but they both do provide same file, you can depend on a file. For example:

Requires: /usr/bin/pear

That way your package won't matter if pear binary is provided by php-pear or php53-pear.




回答3:


There is no such capability in rpm. Require a virtual provides that the packages have in common, if there is one.



来源:https://stackoverflow.com/questions/2139621/how-can-i-make-an-rpm-depend-on-package-a-or-package-b

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!