[opensuse-packaging] Boolean dependencies problem
What I'm trying to archive is quite simple and on a Debian/Ubuntu it would be: Requires: nginx || apache2 Require either Nginx or Apache, prefer Nginx unless user already have one of them installed or specified together with my package. Obviously that can only work on newer RPM distributions supporting boolean dependencies (not CentOS 7 or SLE12 for example). What I tried so far: Requires: (nginx >= 1.14 or apache2 >= 2.4) With and without Recommends or Suggests: nginx I also tried: Requires: (nginx >= 1.14 without apache or apache2 >= 2.4 without nginx) Again with or without recommending or suggesting nginx. I done more extensive tests on openSUSE Leap 15.1: - independent of the order in requires, Apache is always preferred (maybe because it's the first in alphabet ...) - recommending Nginx or specifying it together in with package causes both Apache and Nginx to be installed - an already installed Nginx would always install Apache too Is there a way with rpm / openSUSE or CentOS to archive what I need? The package is: https://build.opensuse.org/package/view_file/server:eGroupWare:trunk/egroupw... I know I could create own conflicting Nginx and Apache packages doing nothing else as requiring the original packages ... Thanks for any input :) Ralf -- Ralf Becker EGroupware GmbH [www.egroupware.org] Handelsregister HRB Kaiserslautern 3587 Geschäftsführer Birgit und Ralf Becker Leibnizstr. 17, 67663 Kaiserslautern, Germany Telefon +49 631 31657-0
10.07.2020 16:34, Ralf Becker пишет:
What I'm trying to archive is quite simple and on a Debian/Ubuntu it would be:
Requires: nginx || apache2
Require either Nginx or Apache, prefer Nginx unless user already have one of them installed or specified together with my package.
Obviously that can only work on newer RPM distributions supporting boolean dependencies (not CentOS 7 or SLE12 for example).
What I tried so far:
Requires: (nginx >= 1.14 or apache2 >= 2.4)
With and without Recommends or Suggests: nginx
I also tried:
Requires: (nginx >= 1.14 without apache or apache2 >= 2.4 without nginx)
Again with or without recommending or suggesting nginx.
I done more extensive tests on openSUSE Leap 15.1:
- independent of the order in requires, Apache is always preferred (maybe because it's the first in alphabet ...) - recommending Nginx or specifying it together in with package causes both Apache and Nginx to be installed - an already installed Nginx would always install Apache too
Is there a way with rpm / openSUSE or CentOS to archive what I need?
ngnix Provides: http-server apache Provides: http-server Your package Requires: http-server
The package is: https://build.opensuse.org/package/view_file/server:eGroupWare:trunk/egroupw...
I know I could create own conflicting Nginx and Apache packages doing nothing else as requiring the original packages ...
Thanks for any input :)
Ralf
Thanks Andrei, Am 10.07.20 um 17:07 schrieb Andrei Borzenkov:
10.07.2020 16:34, Ralf Becker пишет:
What I'm trying to archive is quite simple and on a Debian/Ubuntu it would be:
Requires: nginx || apache2
Require either Nginx or Apache, prefer Nginx unless user already have one of them installed or specified together with my package.
Obviously that can only work on newer RPM distributions supporting boolean dependencies (not CentOS 7 or SLE12 for example).
What I tried so far:
Requires: (nginx >= 1.14 or apache2 >= 2.4)
With and without Recommends or Suggests: nginx
I also tried:
Requires: (nginx >= 1.14 without apache or apache2 >= 2.4 without nginx)
Again with or without recommending or suggesting nginx.
I done more extensive tests on openSUSE Leap 15.1:
- independent of the order in requires, Apache is always preferred (maybe because it's the first in alphabet ...) - recommending Nginx or specifying it together in with package causes both Apache and Nginx to be installed - an already installed Nginx would always install Apache too
Is there a way with rpm / openSUSE or CentOS to archive what I need?
ngnix Provides: http-server
apache Provides: http-server
Your package Requires: http-server
It seems to be httpd, in case anyone run into this: zypper search --provides --match-exact httpd S | Name | Summary | Type --+----------+---------------------------------------------------------+-------- | apache2 | The Apache Web Server Version 2.4 | package | lighttpd | A Secure, Fast, Compliant, and Very Flexible Web Server | package | nginx | A HTTP server and IMAP/POP3 proxy server | package How can I prefer Nginx, if the user did not specify one nor has one installed? Ralf
The package is: https://build.opensuse.org/package/view_file/server:eGroupWare:trunk/egroupw...
I know I could create own conflicting Nginx and Apache packages doing nothing else as requiring the original packages ...
Thanks for any input :)
Ralf
-- Ralf Becker EGroupware GmbH [www.egroupware.org] Handelsregister HRB Kaiserslautern 3587 Geschäftsführer Birgit und Ralf Becker Leibnizstr. 17, 67663 Kaiserslautern, Germany Telefon +49 631 31657-0
How can I prefer Nginx, if the user did not specify one nor has one installed?
With a recommends or a suggests. If you still get nginx, some other package drags it in. If you create a solver testcase (--debug-solver) and make it available somwhere I can try to find out what's going on. Cheers, Michael. -- Michael Schroeder SUSE Software Solutions Germany GmbH mls@suse.de GF: Felix Imendoerffer HRB 36809, AG Nuernberg main(_){while(_=~getchar())putchar(~_-1/(~(_|32)/13*2-11)*13);} -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
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.
But that defeats the idea of having virtual provide. If I know what implementation I want, I can just as well request it directly. 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?
If you still get nginx, some other package drags it in. If you create a solver testcase (--debug-solver) and make it available somwhere I can try to find out what's going on.
Cheers, Michael.
-- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
Hi Andrei and Michael, thanks for your answers :) Am 10.07.20 um 19:46 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. But that defeats the idea of having virtual provide. If I know what implementation I want, I can just as well request it directly.
I prefer Nginx, but that does not help if the user already has Apache installed. So I want/need a preference, if user does not specify what he wants nor has a webserver already installed. The default preference for "httpd" (or "webserver" for RHEL/CentOS) seems to be Apache. Under opensuse httpd would also allow for Lighttpd, which we don't support. Therefore again the questions about boolean dependencies: are they generally not advicable, or am I understanding something wrong?
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?
If you still get nginx, some other package drags it in. If you create a solver testcase (--debug-solver) and make it available somwhere I can try to find out what's going on.
Thanks for the offer, I will, if I dont find an alternative solution. Ralf -- Ralf Becker EGroupware GmbH [www.egroupware.org] Handelsregister HRB Kaiserslautern 3587 Geschäftsführer Birgit und Ralf Becker Leibnizstr. 17, 67663 Kaiserslautern, Germany Telefon +49 631 31657-0
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. Regards, Christian Boltz [1] I'm not sure if I ever tested that myself ;-) -- [...] sollte für einen Ortskundigen also kinderleicht zu finden sein. Wir sind die Leute, die den dicken weißgrünen Europcar Lastwagen so bescheuert mitten auf der Straße geparkt haben. [Kristian Köhntopp zieht um] -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
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
Hello Michael, I tried as suggested here: Requires: httpd Suggests: nginx But unfortunate this behavies exactly like "Requires: (nginx OR apache2)": # zypper install egroupware-docker Repository-Daten werden geladen... Installierte Pakete werden gelesen... Paketabhängigkeiten werden aufgelöst... Die folgenden 10 NEUEN Pakete werden installiert: apache2 apache2-mod_php7 apache2-prefork apache2-utils docker docker-bash-completion docker-compose egroupware-collabora-key egroupware-docker patch Das folgende empfohlene Paket wurde automatisch gewählt: egroupware-collabora-key Das folgende Paket wird vorgeschlagen, wird aber nicht installiert: nginx I created as solverTestCase, thought looking at it nothing easily points why apache2 get pulled in instead of nginx: https://testbox.egroupware.org/zypper.solverTestCase/ I really appreciate your help :) Ralf Am 10.07.20 um 18:35 schrieb Michael Schroeder:
How can I prefer Nginx, if the user did not specify one nor has one installed? With a recommends or a suggests. If you still get nginx, some other package drags it in. If you create a solver testcase (--debug-solver) and make it available somwhere I can try to find out what's going on.
Cheers, Michael.
-- Ralf Becker EGroupware GmbH [www.egroupware.org] Handelsregister HRB Kaiserslautern 3587 Geschäftsführer Birgit und Ralf Becker Leibnizstr. 17, 67663 Kaiserslautern, Germany Telefon +49 631 31657-0
Am 2020-07-13 09:47, schrieb Ralf Becker:
Hello Michael,
I tried as suggested here:
Requires: httpd Suggests: nginx
But unfortunate this behavies exactly like "Requires: (nginx OR apache2)":
Requires: http_daemon that should let you choose between nginx or apache2, with no preference to either one. Cheers MH -- Mathias Homann Mathias.Homann@openSUSE.org telegram: https://telegram.me/lemmy98 irc: [lemmy] on freenode and ircnet obs: lemmy04 gpg key fingerprint: 8029 2240 F4DD 7776 E7D2 C042 6B8E 029E 13F2 C102
Found it, one of the recommended packages, required apache2 :( Sorry for the noise Ralf Am 13.07.20 um 09:47 schrieb Ralf Becker:
Hello Michael,
I tried as suggested here:
Requires: httpd Suggests: nginx
But unfortunate this behavies exactly like "Requires: (nginx OR apache2)":
# zypper install egroupware-docker Repository-Daten werden geladen... Installierte Pakete werden gelesen... Paketabhängigkeiten werden aufgelöst...
Die folgenden 10 NEUEN Pakete werden installiert: apache2 apache2-mod_php7 apache2-prefork apache2-utils docker docker-bash-completion docker-compose egroupware-collabora-key egroupware-docker patch
Das folgende empfohlene Paket wurde automatisch gewählt: egroupware-collabora-key
Das folgende Paket wird vorgeschlagen, wird aber nicht installiert: nginx
I created as solverTestCase, thought looking at it nothing easily points why apache2 get pulled in instead of nginx:
https://testbox.egroupware.org/zypper.solverTestCase/
I really appreciate your help :)
Ralf
Am 10.07.20 um 18:35 schrieb Michael Schroeder:
How can I prefer Nginx, if the user did not specify one nor has one installed? With a recommends or a suggests. If you still get nginx, some other package drags it in. If you create a solver testcase (--debug-solver) and make it available somwhere I can try to find out what's going on.
Cheers, Michael.
-- Ralf Becker EGroupware GmbH [www.egroupware.org] Handelsregister HRB Kaiserslautern 3587 Geschäftsführer Birgit und Ralf Becker Leibnizstr. 17, 67663 Kaiserslautern, Germany Telefon +49 631 31657-0
participants (6)
-
Andrei Borzenkov
-
Christian Boltz
-
Mathias Homann
-
Michael Schroeder
-
Neal Gompa
-
Ralf Becker