From 87012437ad29350c993deb110283702ca2959c30 Mon Sep 17 00:00:00 2001 From: Petr Stodulka Date: Tue, 2 Apr 2024 19:33:04 +0200 Subject: [PATCH] Packaging: Introduce EL 9 builds for IPU 9 -> 10 SPEC files has been updated and polished to be more friendly when keeping suppoer for building in EL 7, 8, and 9. Also Makefile contains some initial changes But keeping the full solution for a separate commit. Packit configuration has been updated to start building for epel-9-x86_64 buildroot. --- .packit.yaml | 3 ++ Makefile | 14 +++++-- packaging/leapp-repository.spec | 42 +++++++++++++------ .../other_specs/leapp-el7toel8-deps.spec | 6 ++- 4 files changed, 48 insertions(+), 17 deletions(-) diff --git a/.packit.yaml b/.packit.yaml index 7c3799cf74..d91a47e5f9 100644 --- a/.packit.yaml +++ b/.packit.yaml @@ -34,6 +34,7 @@ jobs: targets: - epel-7-x86_64 - epel-8-x86_64 + - epel-9-x86_64 actions: create-archive: - bash -c "rm -f packaging/deps-pkgs.tar.gz" @@ -54,6 +55,7 @@ jobs: targets: - epel-7-x86_64 - epel-8-x86_64 + - epel-9-x86_64 actions: create-archive: - bash -c "rm -f packaging/deps-pkgs.tar.gz" @@ -73,6 +75,7 @@ jobs: targets: - epel-7-x86_64 - epel-8-x86_64 + - epel-9-x86_64 actions: create-archive: - bash -c "rm -f packaging/deps-pkgs.tar.gz" diff --git a/Makefile b/Makefile index 0de2a86a90..a62d0ccc6c 100644 --- a/Makefile +++ b/Makefile @@ -189,8 +189,9 @@ source: prepare @git archive --prefix "$(PKGNAME)-$(VERSION)/" -o "packaging/sources/$(PKGNAME)-$(VERSION).tar.gz" HEAD @echo "--- PREPARE DEPS PKGS ---" mkdir -p packaging/tmp/ - @__TIMESTAMP=$(TIMESTAMP) $(MAKE) _build_subpkg - @__TIMESTAMP=$(TIMESTAMP) $(MAKE) DIST_VERSION=$$(($(DIST_VERSION) + 1)) _build_subpkg + @__TIMESTAMP=$(TIMESTAMP) $(MAKE) DIST_VERSION=7 _build_subpkg + @__TIMESTAMP=$(TIMESTAMP) $(MAKE) DIST_VERSION=8 _build_subpkg + @__TIMESTAMP=$(TIMESTAMP) $(MAKE) DIST_VERSION=9 _build_subpkg @tar -czf packaging/sources/deps-pkgs.tar.gz -C packaging/RPMS/noarch `ls -1 packaging/RPMS/noarch | grep -o "[^/]*rpm$$"` @rm -f packaging/RPMS/noarch/*.rpm @@ -389,11 +390,14 @@ _test_container_ipu: el8toel9) \ export REPOSITORIES="common,el8toel9"; \ ;; \ + el9toel10) \ + export REPOSITORIES="common,el9toel10"; \ + ;; \ "") \ echo "TEST_CONT_IPU must be set"; exit 1; \ ;; \ *) \ - echo "Only supported TEST_CONT_IPUs are el7toel8, el8toel9"; exit 1; \ + echo "Only supported TEST_CONT_IPUs are el7toel8, el8toel9, el9toel10"; exit 1; \ ;; \ esac && \ $(_CONTAINER_TOOL) exec -w /repocopy $$_CONT_NAME make clean && \ @@ -449,6 +453,10 @@ test_container: ;; \ python3.9) \ TEST_CONT_IPU=el8toel9 $(MAKE) _test_container_ipu; \ + TEST_CONT_IPU=el9toel10 $(MAKE) _test_container_ipu; \ + ;; \ + python3.12) \ + TEST_CONT_IPU=el9toel10 $(MAKE) _test_container_ipu; \ ;; \ *) \ TEST_CONT_IPU=el8toel9 $(MAKE) _test_container_ipu; \ diff --git a/packaging/leapp-repository.spec b/packaging/leapp-repository.spec index 7c3fe5c6f4..e813cf1403 100644 --- a/packaging/leapp-repository.spec +++ b/packaging/leapp-repository.spec @@ -7,9 +7,19 @@ %if 0%{?rhel} == 7 %define leapp_python_sitelib %{python2_sitelib} %define lpr_name leapp-upgrade-el7toel8 + %define repo_shortname el7toel8 + %define next_major_ver 8 %else %define leapp_python_sitelib %{python3_sitelib} - %define lpr_name leapp-upgrade-el8toel9 + %if 0%{?rhel} == 8 + %define lpr_name leapp-upgrade-el8toel9 + %define repo_shortname el8toel9 + %define next_major_ver 9 + %else + %define lpr_name leapp-upgrade-el9toel10 + %define repo_shortname el9toel10 + %define next_major_ver 10 + %endif # This drops autogenerated deps on # - /usr/libexec/platform-python (rhel-8 buildroot) @@ -84,14 +94,24 @@ Obsoletes: leapp-repository-sos-plugin <= 0.9.0 Conflicts: leapp-upgrade-el8toel9 %else -######### RHEL 8 ############ +######### RHEL 8+ (and newer) ############ BuildRequires: python3-devel Requires: python3-leapp +# NOTE(pstodulk): else if / elif has been implemented quite late. as we still +# want to build on RHEL 7 too, go in the old way. Ref: +# https://github.com/rpm-software-management/rpm/issues/311 +%if 0%{?rhel} == 8 +######### RHEL 8 ############ + # Same as the conflict above - we want to be sure our packages are untouched # during the whole IPU process Conflicts: leapp-upgrade-el7toel8 - +Conflicts: leapp-upgrade-el9toel10 +%else +######### RHEL 9 ############ +Conflicts: leapp-upgrade-el8toel9 +%endif %endif # IMPORTANT: every time the requirements are changed, increment number by one @@ -210,11 +230,7 @@ Requires: python3-gobject-base %build -%if 0%{?rhel} == 7 -cp -a leapp*deps*el8.noarch.rpm repos/system_upgrade/el7toel8/files/bundled-rpms/ -%else -cp -a leapp*deps*el9.noarch.rpm repos/system_upgrade/el8toel9/files/bundled-rpms/ -%endif +cp -a leapp*deps*el%{next_major_ver}.noarch.rpm repos/system_upgrade/%{repo_shortname}/files/bundled-rpms/ %install @@ -222,6 +238,7 @@ install -m 0755 -d %{buildroot}%{custom_repositorydir} install -m 0755 -d %{buildroot}%{repositorydir} cp -r repos/* %{buildroot}%{repositorydir}/ install -m 0755 -d %{buildroot}%{_sysconfdir}/leapp/repos.d/ +# NOTE(pstodulk): drop transaction dir and its content if replaced by config files before RHEL 10 install -m 0755 -d %{buildroot}%{_sysconfdir}/leapp/transaction/ install -m 0755 -d %{buildroot}%{_sysconfdir}/leapp/files/ install -m 0644 etc/leapp/transaction/* %{buildroot}%{_sysconfdir}/leapp/transaction @@ -234,11 +251,10 @@ rm -rf %{buildroot}%{leapp_python_sitelib}/leapp/cli/commands/tests # Remove irrelevant repositories - We don't want to ship them for the particular # RHEL version -%if 0%{?rhel} == 7 -rm -rf %{buildroot}%{repositorydir}/system_upgrade/el8toel9 -%else -rm -rf %{buildroot}%{repositorydir}/system_upgrade/el7toel8 -%endif +for i in el7toel8 el8toel9 el9toel10; +do + [ "$i" != "%{repo_shortname}" ] && rm -rf %{buildroot}%{repositorydir}/system_upgrade/$i +done # remove component/unit tests, Makefiles, ... stuff that related to testing only rm -rf %{buildroot}%{repositorydir}/common/actors/testactor diff --git a/packaging/other_specs/leapp-el7toel8-deps.spec b/packaging/other_specs/leapp-el7toel8-deps.spec index c4e0dd90b8..d9e94faa55 100644 --- a/packaging/other_specs/leapp-el7toel8-deps.spec +++ b/packaging/other_specs/leapp-el7toel8-deps.spec @@ -5,7 +5,11 @@ %if 0%{?rhel} == 8 %define lpr_name_src leapp-upgrade-el7toel8-deps %else - %define lpr_name_src leapp-upgrade-el8toel9-deps + %if 0%{?rhel} == 9 + %define lpr_name_src leapp-upgrade-el8toel9-deps + %else + %define lpr_name_src leapp-upgrade-el9toel10-deps + %endif %endif