
On Sat, Jul 11, 2020 at 8:03 AM Christian Boltz <opensuse@cboltz.de> wrote:
Hello,
Am Freitag, 10. Juli 2020, 19:46:37 CEST schrieb Andrei Borzenkov:
10.07.2020 19:35, Michael Schroeder пишет:
How can I prefer Nginx, if the user did not specify one nor has one installed?
With a recommends or a suggests.
[...]
OBS has Prefer: which can be used to break ties. Is there anything that can be set on end-user sytem to tell zypper to prefer specific package?
The following should do what you want:
Requires: httpd Suggests: nginx
"Suggests" is the soft version of "Recommends", and the difference (assuming the default zypp/zypper configuration) that recommended packages get installed by default (can be changed in the zypp configuration), while suggested packages don't get installed by default.
The combination of Requires and Suggests should[1] prefer the suggested package (nginx) if there are multiple options, and none of them is installed yet.
This will not work on Red Hat-ish systems. In the Red Hat-ish family (RHEL/CentOS, Fedora, Mageia, OpenMandriva), all webservers have "Provides: webserver". With RHEL 7 and older, Recommends and Suggests are not supported. With RHEL 8 and newer (as well as Fedora, Mageia, and OpenMandriva), Recommends and Suggests are supported, and Suggests works in DNF the same way it does in Zypper (because both use libsolv). So for Red Hat-ish distros, it'd be this: Requires: webserver %if ! (0%{?rhel} && 0%{?rhel} < 8) Suggests: nginx %endif -- 真実はいつも一つ!/ Always, there's only one truth! -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org