Issue
I'm working on a piece of software just now that needs to run on a newer version of Redhat. It currently works fine on 6 and 7 but now needs to install and run on Redhat 8.
There is nothing really specific in the software that will stop it running on the newer OS version but i'm having a problem with the dependency requirements. The script that runs the software needs access to semanage (/usr/sbin/semanage). On Redhat 6 and 7 this was supplied by policycoreutils-python package and was given as a requirement argument when the rpm was built. From Redhat 8 onwards, the package has been renamed to policycoreutils-python-utils (see this link, section 8.6.2).
From rpm 4.13, there is support for boolean dependencies (see here) which would make this an easy fix as I could just do something like -R (policycoreutils-python or policycoreutils-python-utils)
but changing the rpm-build package from its current 4.8 version is a major pain as it's used by another team for another piece of software. I also need to keep it a distro independent rpm so can't have different versions of the rpm for newer versions of the OS.
So, my questions:
1) Is there some other way to have a conditional requirement in the spec file with the older rpm 4.8 version?
2) If I was to get approval to upgrade rpm to latest 4.15, is there likely to be any issue on target systems that have older rpm installed e.g. not understanding the conditional?
Update: The rpm will be built once on a RH 6 box and should work on RH 7 & 8.
Solution
if you build one rpm for all platforms
You can depend on semanage
itself:
Requires: /usr/sbin/semanage
yum
, dnf
or rpm
should be smart enough to work that out.
if you build each rpm on the corresponding target:
you can use the %rhel_version
macros, see https://en.opensuse.org/openSUSE:Build_Service_cross_distribution_howto :
%if 0%{?rhel_version} < 800
Requires: policycoreutils-python
%else
Requires: policycoreutils-python-utils
%endif
Answered By - Chris Maes