SHA256
1
0
forked from pool/podman
podman/podman.spec

178 lines
5.9 KiB
RPMSpec

#
# spec file for package podman
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%define project github.com/containers/libpod
%define conmon_project github.com/kubernetes-sigs/cri-o
%define conmon_commit 4cd5a7c60349be0678d9f1b0657683324c1a2726
# Build with libostree-devel in Tumbleweed, Leap 15 and SLES 15
%if 0%{?suse_version} >= 1500
%define with_libostree 1
%endif
Name: podman
Version: 0.11.1.1
Release: 0
Summary: Debugging tool for pods and images
License: Apache-2.0
Group: System/Management
Url: https://github.com/containers/libpod
Source0: %{name}-%{version}.tar.xz
Source1: conmon-git.%{conmon_commit}.tar.xz
Source2: libpod.conf
Source3: %{name}-rpmlintrc
BuildRequires: bash-completion
BuildRequires: cni
BuildRequires: device-mapper-devel
BuildRequires: fdupes
BuildRequires: git-core
BuildRequires: glib2-devel-static
BuildRequires: glibc-devel-static
BuildRequires: go-go-md2man
BuildRequires: golang-packaging
BuildRequires: libapparmor-devel
BuildRequires: libassuan-devel
BuildRequires: libbtrfs-devel
BuildRequires: libcontainers-common
BuildRequires: libgpgme-devel
BuildRequires: libseccomp-devel
BuildRequires: golang(API) >= 1.10
Requires: cni
Requires: cni-plugins
Requires: libcontainers-common
Requires: libcontainers-image
Requires: libcontainers-storage
Requires: runc >= 1.0.0~rc4
Requires: slirp4netns
Recommends: %{name}-cni-config = %{version}
%{go_nostrip}
%if 0%{?with_libostree}
BuildRequires: libostree-devel
%endif
%description
podman is a simple client only tool to help with debugging issues when daemons
such as CRI runtime and the kubelet are not responding or failing. A shared API
layer could be created to share code between the daemon and podman. podman does
not require any daemon running. podman utilizes the same underlying components
that crio uses i.e. containers/image, container/storage,
oci-runtime-tool/generate, runc or any other OCI compatible runtime. podman
shares state with crio and so has the capability to debug pods/images created
by crio.
%prep
%setup -q
# unpack conmon into the unpacked podman source
%setup -T -D -a 1
mkdir -pv $HOME/go/src/%{conmon_project}
mv conmon-git.%{conmon_commit}/* $HOME/go/src/%{conmon_project}
rm -r conmon-git.%{conmon_commit}
%package cni-config
Summary: Basic CNI configuration for podman
Group: System/Management
Requires: %{name} = %{version}
# Our Kubernetes configuration uses a different CNI setup, and if we included
# this (basic) CNI setup in that configuration it can break networking for all
# of the containers. So we only allow installing this on non-Kubic setups.
Conflicts: kubernetes-kubelet
BuildArch: noarch
%description cni-config
A "basic" CNI configuration for podman that makes networking usable for basic
setups. In more complicated setups, users are recommended to write their own
CNI configurations.
%build
# We can't use symlinks here because go-list gets confused by symlinks, so we
# have to copy the source to $HOME/go and then use that as the GOPATH.
export GOPATH=$HOME/go
mkdir -pv $HOME/go/src/%{project}
rm -rf $HOME/go/src/%{project}/*
cp -avr * $HOME/go/src/%{project}
cd $HOME/go/src/%{project}
%if 0%{?with_libostree}
echo "Compiling with libostree support"
export BUILDTAGS="seccomp apparmor varlink"
%else
echo "Compiling without libostree support"
export BUILDTAGS="seccomp apparmor varlink containers_image_ostree_stub"
%endif
# Build podman
go generate ./cmd/podman/varlink/...
go build -tags "$BUILDTAGS" \
-buildmode=pie \
-ldflags '-s -w -X main.podmanVersion=%{version}' \
-o bin/podman \
%{project}/cmd/podman
# Build manpages
make %{?_smp_mflags} docs
# Build conmon
cd $HOME/go/src/%{conmon_project}
make -C conmon
%check
# Too many tests fail due to the restricted permissions in the build enviroment.
# Updates must be tested manually.
%install
# libpod
cd $HOME/go/src/%{project}
install -D -m 0755 bin/podman %{buildroot}/%{_bindir}/podman
install -d %{buildroot}/%{_mandir}/man1
install -m 0644 docs/podman*.1 %{buildroot}/%{_mandir}/man1
install -d %{buildroot}/%{_mandir}/man5
install -m 0644 docs/libpod*.5 %{buildroot}/%{_mandir}/man5
install -D -m 0644 cni/87-podman-bridge.conflist %{buildroot}/%{_sysconfdir}/cni/net.d/87-podman-bridge.conflist
install -D -m 0644 %{SOURCE2} %{buildroot}/%{_sysconfdir}/containers/libpod.conf
install -D -m 0644 %{SOURCE2} %{buildroot}/%{_datadir}/containers/libpod.conf
install -D -m 0644 completions/bash/podman %{buildroot}/%{_datadir}/bash-completion/completions/podman
# conmon
cd $HOME/go/src/%{conmon_project}
install -D -m 0755 bin/conmon %{buildroot}/%{_libexecdir}/podman/bin/conmon
%fdupes %{buildroot}/%{_prefix}
%files
# Binaries
%{_bindir}/podman
%dir %{_libexecdir}/podman
%dir %{_libexecdir}/podman/bin
%{_libexecdir}/podman/bin/conmon
# Manpages
%{_mandir}/man1/podman*.1*
%{_mandir}/man5/libpod*.5*
# Configs
%config(noreplace) %{_sysconfdir}/containers/libpod.conf
%dir %{_datadir}/containers
%{_datadir}/containers/libpod.conf
# Completion
%{_datadir}/bash-completion/completions/podman
%license LICENSE
%files cni-config
%config %{_sysconfdir}/cni/net.d/87-podman-bridge.conflist
%license LICENSE
%changelog