简体   繁体   English

rpm 条件依赖要求

[英]rpm conditional dependency requirements

I'm working on a piece of software just now that needs to run on a newer version of Redhat.我现在正在开发一个需要在较新版本的 Redhat 上运行的软件。 It currently works fine on 6 and 7 but now needs to install and run on Redhat 8.它目前在 6 和 7 上运行良好,但现在需要在 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).运行软件的脚本需要访问 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.在 Redhat 6 和 7 上,这是由 policycoreutils-python 包提供的,并在构建 rpm 时作为需求参数给出。 From Redhat 8 onwards, the package has been renamed to policycoreutils-python-utils (see this link , section 8.6.2).从 Redhat 8 开始,该包已重命名为 policycoreutils-python-utils(请参阅此链接,第 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.从 rpm 4.13 开始,支持布尔依赖项(请参阅此处),这将使其成为一个简单的修复程序,因为我可以执行诸如-R (policycoreutils-python or policycoreutils-python-utils)但是从其更改 rpm-build 包当前的 4.8 版本是一个主要的痛苦,因为它被另一个团队用于另一个软件。 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.我还需要将它保持为独立于发行版的 rpm,因此不能为较新版本的操作系统使用不同版本的 rpm。

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? 1) 是否有其他方法可以在较旧的 rpm 4.8 版本的规范文件中设置条件要求?

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 eg not understanding the conditional? 2) 如果我要获得将 rpm 升级到最新 4.15 的批准,在安装了较旧 rpm 的目标系统上是否可能存在任何问题,例如不理解条件?

Update: The rpm will be built once on a RH 6 box and should work on RH 7 & 8.更新:rpm 将在 RH 6 机器上构建一次,应该适用于 RH 7 和 8。

if you build one rpm for all platforms如果您为所有平台构建一个 rpm

You can depend on semanage itself:您可以依赖semanage本身:

Requires: /usr/sbin/semanage

yum , dnf or rpm should be smart enough to work that out. yumdnfrpm应该足够聪明来解决这个问题。

if you build each rpm on the corresponding target:如果您在相应的目标上构建每个 rpm:

you can use the %rhel_version macros, see https://en.opensuse.org/openSUSE:Build_Service_cross_distribution_howto :您可以使用%rhel_version宏,请参阅https://en.opensuse.org/openSUSE:Build_Service_cross_distribution_howto

%if 0%{?rhel_version} < 800
Requires: policycoreutils-python
%else
Requires: policycoreutils-python-utils
%endif

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM