0

Let's say I'm packaging an RPM which requires one of the following,

Foo
Bar
Baz

Does RPM support the functionality to put that into a spec file?

3
  • Examples spec file : Requires: /usr/bin/gs or Requires: perl(CGI) ... If the any installed or available package provides /usr/bin/gs, then "Requires" is fulfilled. – Knud Larsen Apr 2 '20 at 15:28
  • Yea, but what if you need /usr/bin/sed or /usr/bin/perl, but you need one of the two? – Evan Carroll Apr 2 '20 at 15:30
  • 1
    Starting with rpm 4.13.0, rpm supports boolean expressions in all dependencies. For example: Requires: (pkgA or (pkgB and pkgC)) rpm.org/user_doc/more_dependencies.html – Knud Larsen Apr 2 '20 at 15:37
1

I am going to convert Larsen comment into an answer:

Starting with rpm 4.13.0, rpm supports boolean expressions in all dependencies. https://rpm.org/user_doc/more_dependencies.html

For example:

Requires: (pkgA or (pkgB and pkgC))

In your case that would be:

Requires: Foo or Bar or Baz

Availability in rpm-4.13+ means that it is available in RHEL 8 and all recent Fedoras.

If you want this in RHEL 7 then you can workaround it using virtual provides. You can specify:

Requires: some-server-capability

and then in packages Foo, Bar, Baz you have to put there:

Provides: some-server-capability

This, unfortunately, requires modification of packages Foo, Bar, and Baz. If they are not under your control and you are on RHEL 7 or older, then you are doomed.

Note that some packages already use this virtual provides. E.g., you can:

Requires: smtp-server
Requires: webserver

And e.g., webserver is provided by httpd, nginx, or lightttpd packages.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.