|
| 1 | +# Below definitions are used to deliver config files from a particular branch |
| 2 | +# of c/image, c/storage and c/shortnames vendored in all of Buildah, Podman and Skopeo. |
| 3 | +# These vendored components must have the same version. If it is not the case, |
| 4 | +# pick the oldest version on c/image, c/storage and c/shortnames vendored in |
| 5 | +# Buildah/Podman/Skopeo. |
| 6 | + |
| 7 | +# Packit will automatically update the image and storage versions on Fedora and |
| 8 | +# CentOS Stream dist-git PRs. |
| 9 | +%global image_branch main |
| 10 | +%global storage_branch main |
| 11 | +%global shortnames_branch main |
| 12 | + |
| 13 | +%global github_containers https://raw.githubusercontent.com/containers |
| 14 | + |
| 15 | +%if %{defined copr_username} |
| 16 | +%define copr_build 1 |
| 17 | +%endif |
| 18 | + |
| 19 | +Name: containers-common |
| 20 | +%if %{defined copr_build} |
| 21 | +Epoch: 102 |
| 22 | +%else |
| 23 | +Epoch: 5 |
| 24 | +%endif |
| 25 | +# DO NOT TOUCH the Version string! |
| 26 | +# The TRUE source of this specfile is: |
| 27 | +# https://github.com/containers/common/blob/main/rpm/containers-common.spec |
| 28 | +# If that's what you're reading, Version must be 0, and will be updated by Packit for |
| 29 | +# copr and koji builds. |
| 30 | +# If you're reading this on dist-git, the version is automatically filled in by Packit. |
| 31 | +Version: 0 |
| 32 | +Release: %autorelease |
| 33 | +License: Apache-2.0 |
| 34 | +BuildArch: noarch |
| 35 | +# for BuildRequires: go-md2man |
| 36 | +ExclusiveArch: %{golang_arches} noarch |
| 37 | +Summary: Common configuration and documentation for containers |
| 38 | +BuildRequires: git-core |
| 39 | +BuildRequires: go-md2man |
| 40 | +Provides: skopeo-containers = %{epoch}:%{version}-%{release} |
| 41 | +Requires: (container-selinux >= 2:2.162.1 if selinux-policy) |
| 42 | +Suggests: fuse-overlayfs |
| 43 | +Source0: %{git0}/archive/v%{version_no_tilde}.tar.gz |
| 44 | +Source1: %{github_containers}/image/%{image_branch}/docs/containers-auth.json.5.md |
| 45 | +Source2: %{github_containers}/image/%{image_branch}/docs/containers-certs.d.5.md |
| 46 | +Source3: %{github_containers}/image/%{image_branch}/docs/containers-policy.json.5.md |
| 47 | +Source4: %{github_containers}/image/%{image_branch}/docs/containers-registries.conf.5.md |
| 48 | +Source5: %{github_containers}/image/%{image_branch}/docs/containers-registries.conf.d.5.md |
| 49 | +Source6: %{github_containers}/image/%{image_branch}/docs/containers-registries.d.5.md |
| 50 | +Source7: %{github_containers}/image/%{image_branch}/docs/containers-signature.5.md |
| 51 | +Source8: %{github_containers}/image/%{image_branch}/docs/containers-transports.5.md |
| 52 | +Source9: %{github_containers}/storage/%{storage_branch}/docs/containers-storage.conf.5.md |
| 53 | +Source10: %{github_containers}/shortnames/%{shortnames_branch}/shortnames.conf |
| 54 | +Source11: %{github_containers}/image/%{image_branch}/default.yaml |
| 55 | +Source12: %{github_containers}/image/%{image_branch}/default-policy.json |
| 56 | +Source13: %{github_containers}/image/%{image_branch}/registries.conf |
| 57 | +Source14: %{github_containers}/storage/%{storage_branch}/storage.conf |
| 58 | +# Fetch RPM-GPG-KEY-redhat-release from the authoritative source instead of storing |
| 59 | +# a copy in repo or dist-git. Depending on distribution-gpg-keys rpm is also |
| 60 | +# not an option because that package doesn't exist on CentOS Stream. |
| 61 | +Source15: https://access.redhat.com/security/data/fd431d51.txt |
| 62 | + |
| 63 | +%description |
| 64 | +This package contains common configuration files and documentation for container |
| 65 | +tools ecosystem, such as Podman, Buildah and Skopeo. |
| 66 | + |
| 67 | +It is required because the most of configuration files and docs come from projects |
| 68 | +which are vendored into Podman, Buildah, Skopeo, etc. but they are not packaged |
| 69 | +separately. |
| 70 | + |
| 71 | +%package extra |
| 72 | +Summary: Extra dependencies for Podman and Buildah |
| 73 | +Requires: %{name} = %{epoch}:%{version}-%{release} |
| 74 | +Requires: container-network-stack |
| 75 | +Requires: oci-runtime |
| 76 | +Conflicts: podman < 5:5.0.0~rc4-1 |
| 77 | +Recommends: composefs |
| 78 | +Recommends: crun |
| 79 | +Requires: (crun if fedora-release-identity-server) |
| 80 | +Requires: netavark >= 1.10.3-1 |
| 81 | +Suggests: slirp4netns |
| 82 | +Requires: passt |
| 83 | +Requires: iptables |
| 84 | +Requires: nftables |
| 85 | +Recommends: qemu-user-static |
| 86 | +Requires: (qemu-user-static-aarch64 if fedora-release-identity-server) |
| 87 | +Requires: (qemu-user-static-arm if fedora-release-identity-server) |
| 88 | +Requires: (qemu-user-static-x86 if fedora-release-identity-server) |
| 89 | + |
| 90 | +%description extra |
| 91 | +This subpackage will handle dependencies common to Podman and Buildah which are |
| 92 | +not required by Skopeo. |
| 93 | + |
| 94 | +%prep |
| 95 | +%autosetup -Sgit %{name}-%{version_no_tilde} |
| 96 | + |
| 97 | +# Fine-grain distro- and release-specific tuning of config files, |
| 98 | +# e.g., seccomp, composefs, registries on different RHEL/Fedora versions |
| 99 | +bash rpm/update-config-files.sh |
| 100 | + |
| 101 | +%build |
| 102 | +mv %{SOURCE1} docs/. |
| 103 | +mv %{SOURCE2} docs/. |
| 104 | +mv %{SOURCE3} docs/. |
| 105 | +mv %{SOURCE4} docs/. |
| 106 | +mv %{SOURCE5} docs/. |
| 107 | +mv %{SOURCE6} docs/. |
| 108 | +mv %{SOURCE7} docs/. |
| 109 | +mv %{SOURCE8} docs/. |
| 110 | +mv %{SOURCE9} docs/. |
| 111 | + |
| 112 | +mkdir -p man5 |
| 113 | +for i in docs/*.5.md; do |
| 114 | + go-md2man -in $i -out man5/$(basename $i .md) |
| 115 | +done |
| 116 | + |
| 117 | +%install |
| 118 | +# install config and policy files for registries |
| 119 | +install -dp %{buildroot}%{_sysconfdir}/containers/{certs.d,oci/hooks.d,systemd} |
| 120 | +install -dp %{buildroot}%{_sharedstatedir}/containers/sigstore |
| 121 | +install -dp %{buildroot}%{_datadir}/containers/systemd |
| 122 | +install -dp %{buildroot}%{_prefix}/lib/containers/storage |
| 123 | +install -dp -m 700 %{buildroot}%{_prefix}/lib/containers/storage/overlay-images |
| 124 | +touch %{buildroot}%{_prefix}/lib/containers/storage/overlay-images/images.lock |
| 125 | +install -dp -m 700 %{buildroot}%{_prefix}/lib/containers/storage/overlay-layers |
| 126 | +touch %{buildroot}%{_prefix}/lib/containers/storage/overlay-layers/layers.lock |
| 127 | + |
| 128 | +install -Dp -m0644 %{SOURCE10} %{buildroot}%{_sysconfdir}/containers/registries.conf.d/000-shortnames.conf |
| 129 | +install -Dp -m0644 %{SOURCE11} %{buildroot}%{_sysconfdir}/containers/registries.d/default.yaml |
| 130 | +install -Dp -m0644 %{SOURCE12} %{buildroot}%{_sysconfdir}/containers/policy.json |
| 131 | +install -Dp -m0644 %{SOURCE13} %{buildroot}%{_sysconfdir}/containers/registries.conf |
| 132 | +install -Dp -m0644 %{SOURCE14} %{buildroot}%{_datadir}/containers/storage.conf |
| 133 | + |
| 134 | +# RPM-GPG-KEY-redhat-release already exists on rhel envs, install only on |
| 135 | +# fedora and centos |
| 136 | +%if %{defined fedora} || %{defined centos} |
| 137 | +install -Dp -m0644 %{SOURCE15} %{buildroot}%{_sysconfdir}/pki/rpm-gpg/RPM-GPG-KEY-redhat-release |
| 138 | +%endif |
| 139 | + |
| 140 | +install -Dp -m0644 contrib/redhat/registry.access.redhat.com.yaml -t %{buildroot}%{_sysconfdir}/containers/registries.d |
| 141 | +install -Dp -m0644 contrib/redhat/registry.redhat.io.yaml -t %{buildroot}%{_sysconfdir}/containers/registries.d |
| 142 | + |
| 143 | +# install manpages |
| 144 | +install -dp %{buildroot}%{_mandir}/man5 |
| 145 | +for i in man5/*.5; do |
| 146 | + install -Dp -m0644 $i -t %{buildroot}%{_mandir}/man5 |
| 147 | +done |
| 148 | +ln -s containerignore.5 %{buildroot}%{_mandir}/man5/.containerignore.5 |
| 149 | + |
| 150 | +# install config files for mounts, containers and seccomp |
| 151 | +install -m0644 pkg/subscriptions/mounts.conf %{buildroot}%{_datadir}/containers/mounts.conf |
| 152 | +install -m0644 pkg/seccomp/seccomp.json %{buildroot}%{_datadir}/containers/seccomp.json |
| 153 | +install -m0644 pkg/config/containers.conf %{buildroot}%{_datadir}/containers/containers.conf |
| 154 | + |
| 155 | +# install secrets patch directory |
| 156 | +install -d -p -m 755 %{buildroot}/%{_datadir}/rhel/secrets |
| 157 | +# rhbz#1110876 - update symlinks for subscription management |
| 158 | +ln -s ../../../..%{_sysconfdir}/pki/entitlement %{buildroot}%{_datadir}/rhel/secrets/etc-pki-entitlement |
| 159 | +ln -s ../../../..%{_sysconfdir}/rhsm %{buildroot}%{_datadir}/rhel/secrets/rhsm |
| 160 | +ln -s ../../../..%{_sysconfdir}/yum.repos.d/redhat.repo %{buildroot}%{_datadir}/rhel/secrets/redhat.repo |
| 161 | + |
| 162 | +%files |
| 163 | +%dir %{_sysconfdir}/containers |
| 164 | +%dir %{_sysconfdir}/containers/certs.d |
| 165 | +%dir %{_sysconfdir}/containers/oci |
| 166 | +%dir %{_sysconfdir}/containers/oci/hooks.d |
| 167 | +%dir %{_sysconfdir}/containers/registries.conf.d |
| 168 | +%dir %{_sysconfdir}/containers/registries.d |
| 169 | +%dir %{_sysconfdir}/containers/systemd |
| 170 | +%dir %{_prefix}/lib/containers/storage |
| 171 | +%dir %{_prefix}/lib/containers/storage/overlay-images |
| 172 | +%dir %{_prefix}/lib/containers/storage/overlay-layers |
| 173 | +%{_prefix}/lib/containers/storage/overlay-images/images.lock |
| 174 | +%{_prefix}/lib/containers/storage/overlay-layers/layers.lock |
| 175 | + |
| 176 | +%config(noreplace) %{_sysconfdir}/containers/policy.json |
| 177 | +%config(noreplace) %{_sysconfdir}/containers/registries.conf |
| 178 | +%config(noreplace) %{_sysconfdir}/containers/registries.conf.d/000-shortnames.conf |
| 179 | +%if 0%{?fedora} || 0%{?centos} |
| 180 | +%{_sysconfdir}/pki/rpm-gpg/RPM-GPG-KEY-redhat-release |
| 181 | +%endif |
| 182 | +%config(noreplace) %{_sysconfdir}/containers/registries.d/default.yaml |
| 183 | +%{_sysconfdir}/containers/registries.d/registry.redhat.io.yaml |
| 184 | +%{_sysconfdir}/containers/registries.d/registry.access.redhat.com.yaml |
| 185 | +%ghost %{_sysconfdir}/containers/storage.conf |
| 186 | +%ghost %{_sysconfdir}/containers/containers.conf |
| 187 | +%dir %{_sharedstatedir}/containers/sigstore |
| 188 | +%{_mandir}/man5/Containerfile.5.gz |
| 189 | +%{_mandir}/man5/containerignore.5.gz |
| 190 | +%{_mandir}/man5/.containerignore.5.gz |
| 191 | +%{_mandir}/man5/containers*.5.gz |
| 192 | +%dir %{_datadir}/containers |
| 193 | +%dir %{_datadir}/containers/systemd |
| 194 | +%{_datadir}/containers/storage.conf |
| 195 | +%{_datadir}/containers/containers.conf |
| 196 | +%{_datadir}/containers/mounts.conf |
| 197 | +%{_datadir}/containers/seccomp.json |
| 198 | +%dir %{_datadir}/rhel/secrets |
| 199 | +%{_datadir}/rhel/secrets/* |
| 200 | + |
| 201 | +%files extra |
| 202 | + |
| 203 | +%changelog |
| 204 | +%autochangelog |
0 commit comments