containers-common/containers-common.spec

144 lines
7.2 KiB
RPMSpec
Raw Normal View History

# Below definitions are used to deliver config files from a particular branch
# of c/image, c/common, c/storage vendored in all of Buildah, Podman and Skopeo.
# These vendored components must have the same version. If it is not the case,
# pick the oldest version on c/image, c/common, c/storage vendored in
# Buildah/Podman/Skopeo.
%global skopeo_branch master
%global podman_branch master
%global image_branch master
%global common_branch master
%global storage_branch master
%global shortnames_branch master
%global github_containers https://raw.githubusercontent.com/containers
# non-rawhide only
%define built_tag v0.33.0
%define built_tag_strip %(b=%{built_tag}; echo ${b:1})
%define download_url %{git0}/archive/%{built_tag}.tar.gz
Epoch: 4
Name: containers-common
Version: 0.33.0
Release: 3%{?dist}
Summary: Common configuration and documentation for containers
License: ASL 2.0
BuildArch: noarch
BuildRequires: go-md2man
Recommends: fuse-overlayfs
Recommends: slirp4netns
Recommends: subscription-manager
Source1: %{github_containers}/storage/%{storage_branch}/storage.conf
Source2: %{github_containers}/storage/%{storage_branch}/docs/containers-storage.conf.5.md
Source3: %{github_containers}/common/%{common_branch}/pkg/subscriptions/mounts.conf
Source4: %{github_containers}/image/%{image_branch}/docs/containers-registries.conf.5.md
Source5: %{github_containers}/image/%{image_branch}/registries.conf
Source6: %{github_containers}/image/%{image_branch}/docs/containers-policy.json.5.md
Source7: %{github_containers}/common/%{common_branch}/pkg/seccomp/seccomp.json
Source8: %{github_containers}/podman/%{podman_branch}/docs/source/markdown/containers-mounts.conf.5.md
Source9: %{github_containers}/image/%{image_branch}/docs/containers-signature.5.md
Source10: %{github_containers}/image/%{image_branch}/docs/containers-transports.5.md
Source11: %{github_containers}/image/%{image_branch}/docs/containers-certs.d.5.md
Source12: %{github_containers}/image/%{image_branch}/docs/containers-registries.d.5.md
Source13: %{github_containers}/common/%{common_branch}/pkg/config/containers.conf
Source14: %{github_containers}/common/%{common_branch}/docs/containers.conf.5.md
Source15: %{github_containers}/image/%{image_branch}/docs/containers-auth.json.5.md
Source16: %{github_containers}/image/%{image_branch}/docs/containers-registries.conf.d.5.md
Source17: %{github_containers}/skopeo/%{skopeo_branch}/integration/fixtures/policy.json
Source18: %{github_containers}/skopeo/%{skopeo_branch}/default.yaml
Source19: %{github_containers}/shortnames/%{shortnames_branch}/shortnames.conf
%description
This package contains common configuration files and documentation for container
tools ecosystem, such as Podman, Buildah and Skopeo.
It is required because the most of configuration files and docs come from projects
which are vendored into Podman, Buildah, Skopeo, etc. but they are not packaged
separately.
%prep
cp %{_sourcedir}/{*.json,*.conf,*.5.md,*.yaml} .
sed -i -e 's/^driver.*=.*/driver = "overlay"/' -e 's/^mountopt.*=.*/mountopt = "nodev,metacopy=on"/' \
storage.conf
[ `grep "keyctl" seccomp.json | wc -l` == 0 ] && sed -i '/\"kill\",/i \
"keyctl",' seccomp.json
sed -i '/\"socketcall\",/i \
"socket",' seccomp.json
sed -i 's/^#.*unqualified-search-registries.*=.*/unqualified-search-registries = ["registry.fedoraproject.org", "registry.access.redhat.com", "registry.centos.org", "docker.io"]/g' \
registries.conf
%build
%install
# install config and policy files for registries
install -dp %{buildroot}%{_sysconfdir}/containers/{certs.d,oci/hooks.d,registries.conf.d,registries.d}
install -dp %{buildroot}%{_sharedstatedir}/containers/sigstore
install -m0644 default.yaml %{buildroot}%{_sysconfdir}/containers/registries.d/default.yaml
install -m0644 storage.conf %{buildroot}%{_sysconfdir}/containers/storage.conf
install -m0644 registries.conf %{buildroot}%{_sysconfdir}/containers/registries.conf
install -m0644 shortnames.conf %{buildroot}%{_sysconfdir}/containers/registries.conf.d/shortnames.conf
install -m0644 policy.json %{buildroot}%{_sysconfdir}/containers/policy.json
# install manpages
install -dp %{buildroot}%{_mandir}/man5
go-md2man -in containers-storage.conf.5.md -out %{buildroot}%{_mandir}/man5/containers-storage.conf.5
go-md2man -in containers-registries.conf.5.md -out %{buildroot}%{_mandir}/man5/containers-registries.conf.5
go-md2man -in containers-policy.json.5.md -out %{buildroot}%{_mandir}/man5/containers-policy.json.5
go-md2man -in containers-mounts.conf.5.md -out %{buildroot}%{_mandir}/man5/containers-mounts.conf.5
go-md2man -in containers-signature.5.md -out %{buildroot}%{_mandir}/man5/containers-signature.5
go-md2man -in containers-transports.5.md -out %{buildroot}%{_mandir}/man5/containers-transports.5
go-md2man -in containers-certs.d.5.md -out %{buildroot}%{_mandir}/man5/containers-certs.d.5
go-md2man -in containers-registries.d.5.md -out %{buildroot}%{_mandir}/man5/containers-registries.d.5
go-md2man -in containers.conf.5.md -out %{buildroot}%{_mandir}/man5/containers.conf.5
go-md2man -in containers-auth.json.5.md -out %{buildroot}%{_mandir}/man5/containers-auth.json.5
go-md2man -in containers-registries.conf.d.5.md -out %{buildroot}%{_mandir}/man5/containers-registries.conf.d.5
# install config files for mounts, containers and seccomp
install -dp %{buildroot}%{_datadir}/containers
install -m0644 mounts.conf %{buildroot}%{_datadir}/containers/mounts.conf
install -m0644 seccomp.json %{buildroot}%{_datadir}/containers/seccomp.json
install -m0644 containers.conf %{buildroot}%{_datadir}/containers/containers.conf
# install secrets patch directory
install -d -p -m 755 %{buildroot}/%{_datadir}/rhel/secrets
# rhbz#1110876 - update symlinks for subscription management
ln -s %{_sysconfdir}/pki/entitlement %{buildroot}%{_datadir}/rhel/secrets/etc-pki-entitlement
ln -s %{_sysconfdir}/rhsm %{buildroot}%{_datadir}/rhel/secrets/rhsm
ln -s %{_sysconfdir}/yum.repos.d/redhat.repo %{buildroot}%{_datadir}/rhel/secrets/redhat.repo
%files
%dir %{_sysconfdir}/containers
%dir %{_sysconfdir}/containers/certs.d
%dir %{_sysconfdir}/containers/registries.d
%dir %{_sysconfdir}/containers/oci
%dir %{_sysconfdir}/containers/oci/hooks.d
%config(noreplace) %{_sysconfdir}/containers/policy.json
%config(noreplace) %{_sysconfdir}/containers/registries.d/default.yaml
%config(noreplace) %{_sysconfdir}/containers/storage.conf
%config(noreplace) %{_sysconfdir}/containers/registries.conf
%config(noreplace) %{_sysconfdir}/containers/registries.conf.d/shortnames.conf
%ghost %{_sysconfdir}/containers/containers.conf
%dir %{_sharedstatedir}/containers/sigstore
%{_mandir}/man5/*
%dir %{_datadir}/containers
%{_datadir}/containers/mounts.conf
%{_datadir}/containers/seccomp.json
%{_datadir}/containers/containers.conf
%dir %{_datadir}/rhel/secrets
%{_datadir}/rhel/secrets/*
%changelog
* Wed Jan 13 2021 Lokesh Mandvekar <lsm5@fedoraproject.org> - 4:0.33.0-3
- copy source files into builddir and change them there before installation
* Tue Jan 12 2021 Lokesh Mandvekar <lsm5@fedoraproject.org> - 4:0.33.0-2
- move update.sh code to spec file itself
* Tue Jan 12 2021 Lokesh Mandvekar <lsm5@fedoraproject.org> - 4:0.33.0-1
- update registries.conf and other files
- source urls in update.sh
* Tue Dec 08 2020 Jindrich Novy <jnovy@redhat.com> - 3:1-1
- initial build