From d924ddc3a9b3d9c367a12a6b577801148e3e290f Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Thu, 8 Jul 2021 13:41:11 +0200 Subject: [PATCH] Related: #1979488 Replace hard-coded list of .el8_N => N with lua string.match Taken from thunderbird commit 6108038596daf9c370968afbc125582661bb112f Author: Owen W. Taylor AuthorDate: Fri Dec 11 00:13:26 2020 -0500 Commit: Owen W. Taylor CommitDate: Wed Dec 16 11:47:55 2020 -0500 Handle module-build-service tags when detecting minor version Instead of a hard-coded list of .el8_N => N, use a bit of lua to pattern match both .el8_N and also something like .module+el8.Y.Z+2+3b9e7ff5 This way we also don't have to handle future rhel-8.6.0 manually (and forget to do so). Adopted from rhel-8.4.0 (cherry picked from commit 12c098da208a24b1af0f8e8f6b6e103b29aaedab) Conflicts: firefox.spec --- firefox.spec | 49 +++++++++++++++++++------------------------------ 1 file changed, 19 insertions(+), 30 deletions(-) diff --git a/firefox.spec b/firefox.spec index cce344e..7f57caf 100644 --- a/firefox.spec +++ b/firefox.spec @@ -7,37 +7,26 @@ %global debug_package %{nil} %endif -%global rhel_minor_version -1 -%if 0%{?flatpak:1} -%global rhel_minor_version 4 -%endif -%if "%{?dist}" == ".el8" -%global rhel_minor_version 5 -%endif -%if "%{?dist}" == ".el8_4" -%global rhel_minor_version 4 -%endif -%if "%{?dist}" == ".el8_3" -%global rhel_minor_version 3 -%endif -%if "%{?dist}" == ".el8_2" -%global rhel_minor_version 2 -%endif -%if "%{?dist}" == ".el8_1" -%global rhel_minor_version 1 -%endif -%if "%{?dist}" == ".el8_0" -%global rhel_minor_version 0 -%endif -%if "%{?dist}" == ".el9" -%global rhel_minor_version 4 -%endif +%{lua: +function dist_to_rhel_minor(str, start) + match = string.match(str, ".module%+el8.%d+") + if match then + return string.sub(match, 13) + end + match = string.match(str, ".el8_%d+") + if match then + return string.sub(match, 6) + end + return -1 +end} + +%global rhel_minor_version %{lua:print(dist_to_rhel_minor(rpm.expand("%dist")))} %global system_nss 1 %global bundle_nss 0 %if 0%{?rhel} >= 8 - %if 0%{?rhel_minor_version} < 2 + %if %{rhel_minor_version} < 2 %global bundle_nss 1 %endif %endif @@ -160,7 +149,7 @@ %define use_bundled_yasm 0 %if 0%{?rhel} >= 8 - %if 0%{?rhel_minor_version} <= 2 + %if %{rhel_minor_version} <= 2 %define use_bundled_nodejs 1 %endif %endif @@ -383,7 +372,7 @@ BuildRequires: openssl-devel %endif %if 0%{?rhel} >= 8 - %if 0%{?rhel_minor_version} >= 3 + %if %{rhel_minor_version} >= 3 BuildRequires: pkgconfig(libpipewire-0.3) %else BuildRequires: pipewire-devel @@ -608,7 +597,7 @@ https://extensions.gnome.org. %prep echo "Build environment" echo "dist %{?dist}" -echo "RHEL 8 minor version: %{?rhel_minor_version}" +echo "RHEL 8 minor version: %{rhel_minor_version}" echo "use_bundled_ffi %{?use_bundled_ffi}" echo "use_bundled_python_2 %{?use_bundled_python_2}" echo "use_bundled_python_3 %{?use_bundled_python_3}" @@ -651,7 +640,7 @@ sed -ie 's|/usr/include|/app/include|' %_sourcedir/firefox-pipewire-0-3.patch %endif %if 0%{?rhel} >= 8 - %if 0%{?rhel_minor_version} >= 3 + %if %{rhel_minor_version} >= 3 %patch235 -p1 -b .pipewire-0-3 %else