Related: #1979488 Replace hard-coded list of .el8_N => N with lua string.match

Taken from thunderbird

    commit 6108038596daf9c370968afbc125582661bb112f
    Author:     Owen W. Taylor <otaylor@fishsoup.net>
    AuthorDate: Fri Dec 11 00:13:26 2020 -0500
    Commit:     Owen W. Taylor <otaylor@fishsoup.net>
    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
This commit is contained in:
Eike Rathke 2021-07-08 13:41:11 +02:00
parent c6d1de95fa
commit d924ddc3a9

View File

@ -7,37 +7,26 @@
%global debug_package %{nil} %global debug_package %{nil}
%endif %endif
%global rhel_minor_version -1 %{lua:
%if 0%{?flatpak:1} function dist_to_rhel_minor(str, start)
%global rhel_minor_version 4 match = string.match(str, ".module%+el8.%d+")
%endif if match then
%if "%{?dist}" == ".el8" return string.sub(match, 13)
%global rhel_minor_version 5 end
%endif match = string.match(str, ".el8_%d+")
%if "%{?dist}" == ".el8_4" if match then
%global rhel_minor_version 4 return string.sub(match, 6)
%endif end
%if "%{?dist}" == ".el8_3" return -1
%global rhel_minor_version 3 end}
%endif
%if "%{?dist}" == ".el8_2" %global rhel_minor_version %{lua:print(dist_to_rhel_minor(rpm.expand("%dist")))}
%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
%global system_nss 1 %global system_nss 1
%global bundle_nss 0 %global bundle_nss 0
%if 0%{?rhel} >= 8 %if 0%{?rhel} >= 8
%if 0%{?rhel_minor_version} < 2 %if %{rhel_minor_version} < 2
%global bundle_nss 1 %global bundle_nss 1
%endif %endif
%endif %endif
@ -160,7 +149,7 @@
%define use_bundled_yasm 0 %define use_bundled_yasm 0
%if 0%{?rhel} >= 8 %if 0%{?rhel} >= 8
%if 0%{?rhel_minor_version} <= 2 %if %{rhel_minor_version} <= 2
%define use_bundled_nodejs 1 %define use_bundled_nodejs 1
%endif %endif
%endif %endif
@ -383,7 +372,7 @@ BuildRequires: openssl-devel
%endif %endif
%if 0%{?rhel} >= 8 %if 0%{?rhel} >= 8
%if 0%{?rhel_minor_version} >= 3 %if %{rhel_minor_version} >= 3
BuildRequires: pkgconfig(libpipewire-0.3) BuildRequires: pkgconfig(libpipewire-0.3)
%else %else
BuildRequires: pipewire-devel BuildRequires: pipewire-devel
@ -608,7 +597,7 @@ https://extensions.gnome.org.
%prep %prep
echo "Build environment" echo "Build environment"
echo "dist %{?dist}" 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_ffi %{?use_bundled_ffi}"
echo "use_bundled_python_2 %{?use_bundled_python_2}" echo "use_bundled_python_2 %{?use_bundled_python_2}"
echo "use_bundled_python_3 %{?use_bundled_python_3}" 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 %endif
%if 0%{?rhel} >= 8 %if 0%{?rhel} >= 8
%if 0%{?rhel_minor_version} >= 3 %if %{rhel_minor_version} >= 3
%patch235 -p1 -b .pipewire-0-3 %patch235 -p1 -b .pipewire-0-3
%else %else