RPM仕様ファイルのRequiresセクションをOSごとに作成します。

RPM仕様ファイルのRequiresセクションをOSごとに作成します。

状態

インストール後およびアンインストール前の手順では、semanage(SELinuxポリシー管理ツール)と(SELinuxコンテキスト設定ツール)を使用するRPMがあります。restorecon

残念ながら、RHEL 6/7と8の間でこれらのツールを含むパッケージpolicycoreutils-pythonの名前がpolicycoreutils-python-utils

RHEL8 RPMの作業仕様ファイルは次のとおりです。

Requires(post): policycoreutils-python-utils
Requires(preun): policycoreutils-python-utils

RHEL6/7 RPMの作業仕様ファイルは次のとおりです。

Requires(post): policycoreutils-python
Requires(preun): policycoreutils-python

私が達成したいこと

できる2つの仕様ファイル/ 2つのRPM(各OSタイプごとに1つ)を使用していますが、怠惰で誰にでも役立つ1つの仕様が必要です。

私が試したこと

%{rhel}OSバージョンを含むOS条件について読みました。次のようなしなければならないRPMのマニュアルに従って動作します。

%if %{rhel} < 8
Requires(post): policycoreutils-python
Requires(preun): policycoreutils-python
%endif 

%if %{rhel} == 8
Requires(post): policycoreutils-python-utils
Requires(preun): policycoreutils-python-utils
%endif

%{rhel}ターゲットシステムで変数の値を確認すると、期待した結果が得られます。

centos7-system» rpm --eval '%{rhel}'
7

centos8-system» rpm --eval '%{rhel}'
8

CentOS 6/7 インスタンスにこの RPM をインストールすると正常に動作します。ただし、CentOS 8インスタンスにOS独立RPMをインストールした後、次の結果が表示されます。

centos8-system» dnf install my-1.26-0.x86_64.rpm
<...>
Error:
 Problem: conflicting requests
  - nothing provides policycoreutils-python needed by my-1.26-0.x86_64

デバッグ出力:

centos8-system» rpm -ivvvh my-1.26-0.x86_64.rpm 2>&1 | grep Requires
D:  Requires: /bin/bash                                     YES (db files)
D:  Requires: /bin/sh                                       YES (db files)
D:  Requires: /bin/sh                                       YES (cached)
D:  Requires: /bin/sh                                       YES (cached)
D:  Requires: /usr/bin/env                                  YES (db files)
D:  Requires: /usr/bin/perl                                 YES (db files)
D:  Requires: /usr/bin/php                                  YES (db files)
D:  Requires: nagios-plugins                                NO
D:  Requires: perl(Getopt::Long)                            YES (db provides)
D:  Requires: perl(strict)                                  YES (db provides)
D:  Requires: policycoreutils-python                        NO
D:  Requires: policycoreutils-python                        NO  (cached)
D:  Requires: policycoreutils-python                        NO
D:  Requires: rpmlib(CompressedFileNames) <= 3.0.4-1        YES (rpmlib provides)
D:  Requires: rpmlib(FileDigests) <= 4.6.0-1                YES (rpmlib provides)
D:  Requires: rpmlib(PayloadFilesHavePrefix) <= 4.0-1       YES (rpmlib provides)
D:  Requires: rpmlib(PayloadIsXz) <= 5.2-1                  YES (rpmlib provides)

RequiresCentOS 8シナリオではなくCentOS 6/7シナリオを使用したようです。

ここで私が見ていないものは何ですか?これをデバッグするために私ができることはありますか?

関連コンテンツとソース

ベストアンサー1

条件を省略し、policycoreutils-pythonパッケージの代わりにsemanage実行可能ファイルを使用できます。

Requires(post): %{_sbindir}/semanage
Requires(post): %{_sbindir}/restorecon

Fedoraをご覧くださいdokuwiki.spec例えば。パッケージによる例は次のとおりです。bdii仕様

おすすめ記事