|
| 1 | +%global goproject github.com/containerd |
| 2 | +%global gorepo containerd |
| 3 | +%global goimport %{goproject}/%{gorepo} |
| 4 | + |
| 5 | +%global gover 2.1.4 |
| 6 | +%global rpmver %{gover} |
| 7 | +%global gitrev 75cb2b7193e4e490e9fbdc236c0e811ccaba3376 |
| 8 | + |
| 9 | +%global package_priority_epoch 0 |
| 10 | +%global _dwz_low_mem_die_limit 0 |
| 11 | + |
| 12 | +Name: %{_cross_os}%{gorepo}-2.1 |
| 13 | +Version: %{rpmver} |
| 14 | +Release: 1%{?dist} |
| 15 | +Summary: An industry-standard container runtime |
| 16 | +License: Apache-2.0 |
| 17 | +URL: https://%{goimport} |
| 18 | +Source0: https://%{goimport}/archive/v%{gover}/%{gorepo}-%{gover}.tar.gz |
| 19 | +Source1: containerd.service |
| 20 | +Source2: containerd-config-toml_k8s_containerd_sock |
| 21 | +Source3: containerd-config-toml_basic |
| 22 | +Source4: containerd-config-toml_k8s_nvidia_containerd_sock |
| 23 | +Source5: containerd-tmpfiles.conf |
| 24 | +Source6: containerd-cri-base-json |
| 25 | +Source7: snapshotter-toml |
| 26 | + |
| 27 | +# Mount for writing containerd configuration |
| 28 | +Source100: etc-containerd.mount |
| 29 | + |
| 30 | +# Create container storage mount point. |
| 31 | +Source110: prepare-var-lib-containerd.service |
| 32 | + |
| 33 | +# Drop-ins to disable igzip or pigz if the other implementation is preferred. |
| 34 | +Source200: containerd-disable-igzip.conf |
| 35 | +Source201: containerd-disable-pigz.conf |
| 36 | + |
| 37 | +Source1000: clarify.toml |
| 38 | + |
| 39 | +# Patch to support moving from containerd-1.7 to 2.x |
| 40 | +Patch1001: 1001-Revert-Don-t-allow-io_uring-related-syscalls-in-the-.patch |
| 41 | + |
| 42 | +BuildRequires: git |
| 43 | +BuildRequires: %{_cross_os}glibc-devel |
| 44 | +Requires: %{_cross_os}runc |
| 45 | +Requires: %{name}(optimized-gunzip) |
| 46 | +Requires: %{name}(binaries) |
| 47 | + |
| 48 | +Provides: %{_cross_os}%{gorepo} = %{package_priority_epoch}: |
| 49 | +Conflicts: %{_cross_os}%{gorepo} |
| 50 | + |
| 51 | +%description |
| 52 | +%{summary}. |
| 53 | + |
| 54 | +%package bin |
| 55 | +Summary: An industry-standard container runtime's binaries |
| 56 | +Provides: %{name}(binaries) |
| 57 | +Requires: (%{_cross_os}image-feature(no-fips) and %{name}) |
| 58 | +Conflicts: (%{_cross_os}image-feature(fips) or %{name}-fips-bin) |
| 59 | + |
| 60 | +%description bin |
| 61 | +%{summary}. |
| 62 | + |
| 63 | +%package fips-bin |
| 64 | +Summary: An industry-standard container runtime's binaries, FIPS edition |
| 65 | +Provides: %{name}(binaries) |
| 66 | +Requires: (%{_cross_os}image-feature(fips) and %{name}) |
| 67 | +Conflicts: (%{_cross_os}image-feature(no-fips) or %{name}-bin) |
| 68 | + |
| 69 | +%description fips-bin |
| 70 | +%{summary}. |
| 71 | + |
| 72 | +%package pigz |
| 73 | +Summary: Prefer pigz for gzip decompression |
| 74 | +Requires: %{_cross_os}pigz |
| 75 | +Requires: %{name} |
| 76 | +Provides: %{_cross_os}%{gorepo}-pigz = %{package_priority_epoch}: |
| 77 | +Conflicts: %{name}-igzip |
| 78 | +Provides: %{name}(optimized-gunzip) = 1: |
| 79 | + |
| 80 | +%description pigz |
| 81 | +%{summary}. |
| 82 | + |
| 83 | +%package igzip |
| 84 | +Summary: Prefer igzip for gzip decompression |
| 85 | +Requires: %{_cross_os}igzip |
| 86 | +Requires: %{name} |
| 87 | +Provides: %{_cross_os}%{gorepo}-igzip = %{package_priority_epoch}: |
| 88 | +Conflicts: %{name}-pigz |
| 89 | +%if "%{_cross_arch}" == "x86_64" |
| 90 | +Provides: %{name}(optimized-gunzip) = 2: |
| 91 | +%else |
| 92 | +Provides: %{name}(optimized-gunzip) = 0: |
| 93 | +%endif |
| 94 | + |
| 95 | +%description igzip |
| 96 | +%{summary}. |
| 97 | + |
| 98 | +%prep |
| 99 | +%autosetup -Sgit -n %{gorepo}-%{gover} -p1 |
| 100 | + |
| 101 | +%build |
| 102 | +%set_cross_go_flags |
| 103 | + |
| 104 | +export BUILDTAGS="no_btrfs selinux" |
| 105 | +export LD_VERSION="-X github.com/containerd/containerd/v2/version.Version=%{gover}+bottlerocket" |
| 106 | +export LD_REVISION="-X github.com/containerd/containerd/v2/version.Revision=%{gitrev}" |
| 107 | + |
| 108 | +declare -a BUILD_ARGS |
| 109 | +BUILD_ARGS=( |
| 110 | + -tags="${BUILDTAGS}" |
| 111 | + -ldflags="${GOLDFLAGS} ${LD_VERSION} ${LD_REVISION}" |
| 112 | +) |
| 113 | + |
| 114 | +for bin in \ |
| 115 | + containerd \ |
| 116 | + containerd-shim-runc-v2 \ |
| 117 | + ctr ; |
| 118 | +do |
| 119 | + go build "${BUILD_ARGS[@]}" -o ${bin} ./cmd/${bin} |
| 120 | + gofips build "${BUILD_ARGS[@]}" -o fips/${bin} ./cmd/${bin} |
| 121 | +done |
| 122 | + |
| 123 | +%install |
| 124 | +install -d %{buildroot}{%{_cross_bindir},%{_cross_fips_bindir}} |
| 125 | +for bin in \ |
| 126 | + containerd \ |
| 127 | + containerd-shim-runc-v2 \ |
| 128 | + ctr ; |
| 129 | +do |
| 130 | + install -p -m 0755 ${bin} %{buildroot}%{_cross_bindir} |
| 131 | + install -p -m 0755 fips/${bin} %{buildroot}%{_cross_fips_bindir} |
| 132 | +done |
| 133 | + |
| 134 | +install -d %{buildroot}%{_cross_unitdir} |
| 135 | +install -p -m 0644 %{S:1} %{S:100} %{S:110} %{buildroot}%{_cross_unitdir} |
| 136 | + |
| 137 | +install -d %{buildroot}%{_cross_templatedir} |
| 138 | +install -d %{buildroot}%{_cross_factorydir}%{_cross_sysconfdir}/containerd |
| 139 | +install -p -m 0644 %{S:2} %{S:3} %{S:4} %{S:6} %{S:7} %{buildroot}%{_cross_templatedir} |
| 140 | + |
| 141 | +install -d %{buildroot}%{_cross_tmpfilesdir} |
| 142 | +install -p -m 0644 %{S:5} %{buildroot}%{_cross_tmpfilesdir}/containerd.conf |
| 143 | + |
| 144 | +install -d %{buildroot}%{_cross_unitdir}/containerd.service.d |
| 145 | +install -p -m 0644 %{S:200} %{buildroot}%{_cross_unitdir}/containerd.service.d/005-disable-igzip.conf |
| 146 | +install -p -m 0644 %{S:201} %{buildroot}%{_cross_unitdir}/containerd.service.d/005-disable-pigz.conf |
| 147 | + |
| 148 | +%cross_scan_attribution --clarify %{S:1000} go-vendor vendor |
| 149 | + |
| 150 | +%files |
| 151 | +%license LICENSE NOTICE |
| 152 | +%{_cross_attribution_file} |
| 153 | +%{_cross_attribution_vendor_dir} |
| 154 | +%{_cross_unitdir}/containerd.service |
| 155 | +%{_cross_unitdir}/etc-containerd.mount |
| 156 | +%{_cross_unitdir}/prepare-var-lib-containerd.service |
| 157 | +%dir %{_cross_factorydir}%{_cross_sysconfdir}/containerd |
| 158 | +%{_cross_templatedir}/containerd-config-toml* |
| 159 | +%{_cross_templatedir}/containerd-cri-base-json |
| 160 | +%{_cross_templatedir}/snapshotter-toml |
| 161 | +%{_cross_tmpfilesdir}/containerd.conf |
| 162 | + |
| 163 | +%files bin |
| 164 | +%{_cross_bindir}/containerd |
| 165 | +%{_cross_bindir}/containerd-shim-runc-v2 |
| 166 | +%{_cross_bindir}/ctr |
| 167 | + |
| 168 | +%files fips-bin |
| 169 | +%{_cross_fips_bindir}/containerd |
| 170 | +%{_cross_fips_bindir}/containerd-shim-runc-v2 |
| 171 | +%{_cross_fips_bindir}/ctr |
| 172 | + |
| 173 | +%files pigz |
| 174 | +%{_cross_unitdir}/containerd.service.d/005-disable-igzip.conf |
| 175 | + |
| 176 | +%files igzip |
| 177 | +%{_cross_unitdir}/containerd.service.d/005-disable-pigz.conf |
| 178 | + |
| 179 | +%changelog |
0 commit comments