From 4b32bbb939bec94340df0ebdc4e49ff1cd05a254 Mon Sep 17 00:00:00 2001 From: Miro HronĨok Date: Aug 31 2023 09:28:36 +0000 Subject: Use %rpmversion to check if we are on RPM 4.19+ --- diff --git a/macros.pyproject b/macros.pyproject index dfb3e2d..12c7a64 100644 --- a/macros.pyproject +++ b/macros.pyproject @@ -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}" \\ diff --git a/tests/escape_percentages.spec b/tests/escape_percentages.spec index be64156..6466b2f 100644 --- a/tests/escape_percentages.spec +++ b/tests/escape_percentages.spec @@ -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