Use %rpmversion to check if we are on RPM 4.19+

This commit is contained in:
Miro Hrončok 2023-08-21 15:20:26 +02:00 committed by churchyard
parent 5ffc27bdf7
commit 4b32bbb939
2 changed files with 3 additions and 5 deletions

View File

@ -106,12 +106,10 @@ fi
# Escaping an actual percentage sign in path by 8 signs has been verified in RPM 4.16 and 4.17.
# See this thread http://lists.rpm.org/pipermail/rpm-list/2021-June/002048.html
# Since RPM 4.19, 2 signs are needed instead.
# Since RPM 4.19, 2 signs are needed instead. 4.18.90+ is a pre-release of RPM 4.19.
# On the CI, we build tests/escape_percentages.spec to verify the assumptions.
# We should check RPM version here instead of Fedora/RHEL, but it's hard;
# see https://github.com/rpm-software-management/rpm/issues/2523
%pyproject_save_files() %{expand:\\\
%{expr:0%{?fedora} >= 39 || 0%{?rhel} >= 10 ? "RPM_PERCENTAGES_COUNT=2" : "RPM_PERCENTAGES_COUNT=8" } \\
%{expr:v"0%{?rpmversion}" >= v"4.18.90" ? "RPM_PERCENTAGES_COUNT=2" : "RPM_PERCENTAGES_COUNT=8" } \\
%{__python3} %{_rpmconfigdir}/redhat/pyproject_save_files.py \\
--output-files "%{pyproject_files}" \\
--output-modules "%{_pyproject_modules}" \\

View File

@ -58,7 +58,7 @@ grep '/escape_percentages/one' %{pyproject_files}
%files -f %{pyproject_files}
%if 0%{?fedora} >= 39 || 0%{?rhel} >= 10
%if v"0%{?rpmversion}" >= v"4.18.90"
/two%%version
%else
/two%%%%%%%%version