SPEC: take c10s and el10 into consideration for repo installation

Previously, the SPEC file was written in the way that c9s and el9 were
the latest major releases of the respective distributions and as such,
they could build images for all previous major versions of the same
distro. With c10s and el10, this is no longer true. Amend the section
which installs repository definitions.

The idea is that:
 - c10s / el10 are the latest major version and can build any previous
   major version of the same distro.
 - Any cs and el distro version can build images for the same major
   version.
 - c9s can build also c8s / el9 can build also el8 images.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
Tomáš Hozza 2024-05-31 11:07:30 +02:00 committed by Tomáš Hozza
parent cdf0a5b8cc
commit c8e8bffd99

View file

@ -147,28 +147,43 @@ install -m 0755 -vp _bin/osbuild-jobsite-builder %{buildroot}%
# Only include repositories for the distribution and release
install -m 0755 -vd %{buildroot}%{_datadir}/osbuild-composer/repositories
# CentOS also defines rhel so we check for centos first
%if 0%{?centos}
# CentOS 9 supports building for CentOS 8 and later
%if 0%{?centos} >= 9
# Latest CentOS supports building all CentOS versions
%if 0%{?centos} >= 10
install -m 0644 -vp repositories/centos-* %{buildroot}%{_datadir}/osbuild-composer/repositories/
%else
# CentOS 8 only supports building for CentOS 8
# All other CentOS versions support building for the same version
install -m 0644 -vp repositories/centos-%{centos}* %{buildroot}%{_datadir}/osbuild-composer/repositories/
install -m 0644 -vp repositories/centos-stream-%{centos}* %{buildroot}%{_datadir}/osbuild-composer/repositories/
# CentOS 9 supports building also for CentOS 8
%if 0%{?centos} == 9
install -m 0644 -vp repositories/centos-8* %{buildroot}%{_datadir}/osbuild-composer/repositories/
install -m 0644 -vp repositories/centos-stream-8* %{buildroot}%{_datadir}/osbuild-composer/repositories/
%endif
%endif
%else
%if 0%{?rhel}
# RHEL 9 supports building for RHEL 8 and later
%if 0%{?rhel} >= 9
# RHEL 10 supports building all RHEL versions
%if 0%{?rhel} >= 10
install -m 0644 -vp repositories/rhel-* %{buildroot}%{_datadir}/osbuild-composer/repositories/
%else
# RHEL 8 only supports building for 8
# All other RHEL versions support building for the same version
install -m 0644 -vp repositories/rhel-%{rhel}* %{buildroot}%{_datadir}/osbuild-composer/repositories/
# RHEL 9 supports building also for RHEL 8
%if 0%{?rhel} == 9
install -m 0644 -vp repositories/rhel-8* %{buildroot}%{_datadir}/osbuild-composer/repositories/
%endif
%endif
%endif
%endif