summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2022-02-17 13:46:51 -0500
committerDaniel J Walsh <dwalsh@redhat.com>2022-02-22 14:38:57 -0500
commit80c5962dba7f5ecd6b602aecd0df479bd04391b1 (patch)
treea1d7fada738182c2eb8cd6993f33625ae704ba94 /contrib
parentd3903a85910979d8212028cf814574047015db58 (diff)
downloadpodman-80c5962dba7f5ecd6b602aecd0df479bd04391b1.tar.gz
podman-80c5962dba7f5ecd6b602aecd0df479bd04391b1.tar.bz2
podman-80c5962dba7f5ecd6b602aecd0df479bd04391b1.zip
Add containers-common spec and command to podman
Since containers-common package is tied to specific versions of Podman, add tools to build the package into the contrib directory This should help other distributions to figure out which commont package to ship. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/containers-common/containers-common.sh56
-rw-r--r--contrib/containers-common/containers-common.spec.in175
2 files changed, 231 insertions, 0 deletions
diff --git a/contrib/containers-common/containers-common.sh b/contrib/containers-common/containers-common.sh
new file mode 100755
index 000000000..9e7b445eb
--- /dev/null
+++ b/contrib/containers-common/containers-common.sh
@@ -0,0 +1,56 @@
+#!/usr/bin/bash -e
+#
+# Script used for downloading man pages and config files from
+# github.com/containers libraries (storage, common, image)
+#
+# Must be run from directory containing input specfile
+#
+
+die() {
+ echo "$(basename $0): $*" >&2
+ exit 1
+}
+
+branchversion() {
+ gomod=$(git rev-parse --show-toplevel)/go.mod
+ v=$(awk -v X=github.com/containers/$1 '$1 ~ X { print $2 }' <$gomod)
+ hash=$(expr "$v" : "v.*-[0-9.]\+-\([0-9a-f]\+\)")
+ if [[ -n "$hash" ]]; then
+ v="$hash"
+ fi
+ echo "$v"
+}
+
+
+SPECFILE=containers-common.spec
+if [[ ! -e $SPECFILE.in ]]; then
+ die "Please run me from the same directory as $SPECFILE.in"
+fi
+
+declare -A moduleversion
+for module in common image storage; do
+ v=$(branchversion $module)
+ if [[ -z "$v" ]]; then
+ die "Could not find version for module '$v'"
+ fi
+ moduleversion[$module]=$v
+done
+
+builddir=containers-common-${moduleversion[common]}
+mkdir -p $builddir
+
+sed -e "s/COMMON_BRANCH/${moduleversion[common]}/g" \
+ -e "s/IMAGE_BRANCH/${moduleversion[image]}/g" \
+ -e "s/STORAGE_BRANCH/${moduleversion[storage]}/g" \
+ <$SPECFILE.in >$builddir/$SPECFILE
+
+cd $builddir
+spectool -fg $SPECFILE
+
+if [[ ! -e storage.conf ]]; then
+ die "spectool did not pull storage.conf"
+fi
+
+echo "Changing storage.conf..."
+sed -i -e 's/^driver.*=.*/driver = "overlay"/' -e 's/^mountopt.*=.*/mountopt = "nodev,metacopy=on"/' \
+ storage.conf
diff --git a/contrib/containers-common/containers-common.spec.in b/contrib/containers-common/containers-common.spec.in
new file mode 100644
index 000000000..634abf08d
--- /dev/null
+++ b/contrib/containers-common/containers-common.spec.in
@@ -0,0 +1,175 @@
+# 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 main
+%global image_branch IMAGE_BRANCH
+%global common_branch COMMON_BRANCH
+%global storage_branch STORAGE_BRANCH
+%global shortnames_branch main
+
+%global github_containers https://raw.githubusercontent.com/containers
+
+Epoch: 4
+Name: containers-common
+Version: COMMON_BRANCH
+Release: %autorelease
+Summary: Common configuration and documentation for containers
+License: ASL 2.0
+BuildArch: noarch
+BuildRequires: go-md2man
+Provides: skopeo-containers = %{epoch}:%{version}-%{release}
+Requires: (container-selinux >= 2:2.162.1 if selinux-policy)
+Requires: oci-runtime
+Requires: container-network-stack
+Recommends: netavark
+Recommends: fuse-overlayfs
+Recommends: slirp4netns
+Source1: %{github_containers}/common/%{common_branch}/docs/containers.conf.5.md
+Source2: %{github_containers}/common/%{common_branch}/pkg/config/containers.conf
+Source3: %{github_containers}/common/%{common_branch}/pkg/seccomp/seccomp.json
+Source4: %{github_containers}/common/%{common_branch}/pkg/subscriptions/mounts.conf
+Source5: %{github_containers}/image/%{image_branch}/docs/containers-auth.json.5.md
+Source6: %{github_containers}/image/%{image_branch}/docs/containers-certs.d.5.md
+Source7: %{github_containers}/image/%{image_branch}/docs/containers-policy.json.5.md
+Source8: %{github_containers}/image/%{image_branch}/docs/containers-registries.conf.5.md
+Source9: %{github_containers}/image/%{image_branch}/docs/containers-registries.conf.d.5.md
+Source10: %{github_containers}/image/%{image_branch}/docs/containers-registries.d.5.md
+Source11: %{github_containers}/image/%{image_branch}/docs/containers-signature.5.md
+Source12: %{github_containers}/image/%{image_branch}/docs/containers-transports.5.md
+Source13: %{github_containers}/image/%{image_branch}/registries.conf
+Source14: %{github_containers}/common/%{common_branch}/docs/containers-mounts.conf.5.md
+Source15: %{github_containers}/shortnames/%{shortnames_branch}/shortnames.conf
+Source16: %{github_containers}/skopeo/%{skopeo_branch}/default.yaml
+Source17: %{github_containers}/skopeo/%{skopeo_branch}/default-policy.json
+Source18: %{github_containers}/storage/%{storage_branch}/docs/containers-storage.conf.5.md
+Source19: %{github_containers}/storage/%{storage_branch}/storage.conf
+Source20: RPM-GPG-KEY-redhat-release
+Source21: registry.access.redhat.com.yaml
+Source22: registry.redhat.io.yaml
+Source23: %{github_containers}/common/%{common_branch}/docs/Containerfile.5.md
+Source24: %{github_containers}/common/%{common_branch}/docs/containerignore.5.md
+Source25: %{github_containers}/common/%{common_branch}/docs/links/.containerignore.5
+
+%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 %{SOURCE1} .
+cp %{SOURCE2} .
+cp %{SOURCE3} .
+cp %{SOURCE4} .
+cp %{SOURCE5} .
+cp %{SOURCE6} .
+cp %{SOURCE7} .
+cp %{SOURCE8} .
+cp %{SOURCE9} .
+cp %{SOURCE10} .
+cp %{SOURCE11} .
+cp %{SOURCE12} .
+cp %{SOURCE13} .
+cp %{SOURCE14} .
+cp %{SOURCE15} 000-shortnames.conf
+cp %{SOURCE16} .
+cp %{SOURCE17} policy.json
+cp %{SOURCE18} .
+cp %{SOURCE19} .
+cp %{SOURCE20} .
+cp %{SOURCE21} .
+cp %{SOURCE22} .
+cp %{SOURCE23} .
+cp %{SOURCE24} .
+cp %{SOURCE25} .
+
+%build
+mkdir -p man5
+for FILE in $(ls *.5.md); do
+ go-md2man -in $FILE -out man5/$(basename $FILE .md)
+done
+
+cp man5/containerignore.5 man5/.containerignore.5
+
+%install
+# install config and policy files for registries
+install -dp %{buildroot}%{_sysconfdir}/containers/{certs.d,oci/hooks.d}
+install -dp %{buildroot}%{_sharedstatedir}/containers/sigstore
+install -Dp -m0644 default.yaml -t %{buildroot}%{_sysconfdir}/containers/registries.d
+install -Dp -m0644 storage.conf -t %{buildroot}%{_datadir}/containers
+install -Dp -m0644 registries.conf -t %{buildroot}%{_sysconfdir}/containers
+install -Dp -m0644 000-shortnames.conf -t %{buildroot}%{_sysconfdir}/containers/registries.conf.d
+install -Dp -m0644 policy.json -t %{buildroot}%{_sysconfdir}/containers
+install -Dp -m0644 RPM-GPG-KEY-redhat-release -t %{buildroot}%{_sysconfdir}/pki/rpm-gpg
+install -Dp -m0644 registry.access.redhat.com.yaml -t %{buildroot}%{_sysconfdir}/containers/registries.d
+install -Dp -m0644 registry.redhat.io.yaml -t %{buildroot}%{_sysconfdir}/containers/registries.d
+
+# install manpages
+for FILE in $(ls -a man5 | grep 5); do
+ install -Dp -m0644 man5/$FILE -t %{buildroot}%{_mandir}/man5
+done
+
+# install config files for mounts, containers and seccomp
+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
+
+%post
+if [[ ! -f %{_mandir}/man5/Dockerfile.5.gz ]]; then
+ echo .so %{_mandir}/man5/Containerfile.5 > %{_mandir}/man5/Dockerfile.5
+ gzip %{_mandir}/man5/Dockerfile.5
+fi
+if [[ ! -f %{_mandir}/man5/dockerignore.5.gz ]]; then
+ echo .so %{_mandir}/man5/containerignore.5 > %{_mandir}/man5/dockerignore.5
+ gzip %{_mandir}/man5/dockerignore.5
+fi
+if [[ ! -f %{_mandir}/man5/.dockerignore.5.gz ]]; then
+ echo .so %{_mandir}/man5/containerignore.5 > %{_mandir}/man5/.dockerignore.5
+ gzip %{_mandir}/man5/.dockerignore.5
+fi
+
+%files
+%dir %{_sysconfdir}/containers
+%dir %{_sysconfdir}/containers/certs.d
+%dir %{_sysconfdir}/containers/oci
+%dir %{_sysconfdir}/containers/oci/hooks.d
+%dir %{_sysconfdir}/containers/registries.conf.d
+%dir %{_sysconfdir}/containers/registries.d
+%config(noreplace) %{_sysconfdir}/containers/policy.json
+%config(noreplace) %{_sysconfdir}/containers/registries.conf
+%config(noreplace) %{_sysconfdir}/containers/registries.conf.d/000-shortnames.conf
+%{_sysconfdir}/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
+%config(noreplace) %{_sysconfdir}/containers/registries.d/default.yaml
+%{_sysconfdir}/containers/registries.d/registry.redhat.io.yaml
+%{_sysconfdir}/containers/registries.d/registry.access.redhat.com.yaml
+%ghost %{_sysconfdir}/containers/storage.conf
+%ghost %{_sysconfdir}/containers/containers.conf
+%dir %{_sharedstatedir}/containers/sigstore
+%ghost %{_mandir}/man5/Dockerfile.5.gz
+%ghost %{_mandir}/man5/dockerignore.5.gz
+%ghost %{_mandir}/man5/.dockerignore.5.gz
+%{_mandir}/man5/Containerfile.5.gz
+%{_mandir}/man5/containerignore.5.gz
+%{_mandir}/man5/.containerignore.5.gz
+%{_mandir}/man5/containers*.5.gz
+%dir %{_datadir}/containers
+%{_datadir}/containers/storage.conf
+%{_datadir}/containers/containers.conf
+%{_datadir}/containers/mounts.conf
+%{_datadir}/containers/seccomp.json
+%dir %{_datadir}/rhel/secrets
+%{_datadir}/rhel/secrets/*
+
+%changelog
+%autochangelog