From 2b348f65d86c5674863d98b660d6d7bf99849133 Mon Sep 17 00:00:00 2001 From: Romain Geissler Date: Mon, 7 Mar 2022 09:32:40 +0000 Subject: [PATCH] Also build for CentOS 9. Signed-off-by: Romain Geissler --- dockerfiles/rpm.dockerfile | 4 +++- rpm/containerd.spec | 12 +++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/dockerfiles/rpm.dockerfile b/dockerfiles/rpm.dockerfile index 8d469770..b4904e80 100644 --- a/dockerfiles/rpm.dockerfile +++ b/dockerfiles/rpm.dockerfile @@ -105,6 +105,7 @@ RUN chown -R ${UID}:${GID} /archive /build # # NOTE: Installation of source-packages is not currently tested here. FROM distro-image AS verify-packages +ARG BASE COPY scripts/.rpm-helpers /root/ RUN . /root/.rpm-helpers; install_package createrepo RUN if [ -d "/etc/zypp/repos.d/" ]; then ln -s "/etc/zypp/repos.d" "/etc/yum.repos.d"; fi \ @@ -116,7 +117,8 @@ RUN createrepo /build \ && rm -rf /build/repodata RUN containerd --version RUN ctr --version -RUN runc --version +# Don't try to run runc on RHEL/CentOS as we don't package it anymore. +RUN if [ "${BASE}" != "rhel" ] && [ "${BASE}" != "centos" ]; then runc --version; fi FROM scratch AS packages COPY --from=build-packages /archive /archive diff --git a/rpm/containerd.spec b/rpm/containerd.spec index cdb259d2..1eebd4f9 100644 --- a/rpm/containerd.spec +++ b/rpm/containerd.spec @@ -30,18 +30,22 @@ AutoReq: no Name: containerd.io Provides: containerd -# For some reason on rhel >= 8 if we "provide" runc then it makes this package unsearchable +# On RHEL >= 8 OS, runc is packaged by Red Hat so it won't be provided by this package. %if 0%{?rhel} <= 7 Provides: runc %endif # Obsolete packages Obsoletes: containerd +%if 0%{?rhel} <= 7 Obsoletes: runc +%endif # Conflicting packages Conflicts: containerd +%if 0%{?rhel} <= 7 Conflicts: runc +%endif Version: %{getenv:RPM_VERSION} Release: %{getenv:RPM_RELEASE_VERSION}%{?dist} @@ -51,7 +55,9 @@ URL: https://containerd.io Source0: containerd Source1: containerd.service Source2: containerd.toml +%if 0%{?rhel} <= 7 Source3: runc +%endif # container-selinux isn't a thing in suse flavors %if %{undefined suse_version} # amazonlinux2 doesn't have container-selinux either @@ -88,10 +94,12 @@ fi # symlink the go source path to our build directory ln -s /go/src/%{import_path} %{_topdir}/BUILD +%if 0%{?rhel} <= 7 if [ ! -d %{_topdir}/SOURCES/runc ]; then # Copy over our source code from our gopath to our source directory cp -rf /go/src/github.com/opencontainers/runc %{_topdir}/SOURCES/runc fi +%endif cd %{_topdir}/BUILD/ @@ -108,7 +116,9 @@ rm -f bin/containerd-stress bin/containerd --version bin/ctr --version +%if 0%{?rhel} <= 7 GO111MODULE=auto make -C /go/src/github.com/opencontainers/runc BINDIR=%{_topdir}/BUILD/bin BUILDTAGS='seccomp apparmor selinux %{runc_nokmem}' runc install +%endif %install