containerd/containerd.spec
Aleksa Sarai 3f240ab735 Accepting request 868230 from home:cyphar:docker
- Install the containerd-shim* binaries and stop creating
  docker-containerd-shim because that isn't used by Docker anymore.

OBS-URL: https://build.opensuse.org/request/show/868230
OBS-URL: https://build.opensuse.org/package/show/Virtualization:containers/containerd?expand=0&rev=110
2021-02-01 01:07:51 +00:00

196 lines
6.8 KiB
RPMSpec

#
# spec file for package containerd
#
# Copyright (c) 2021 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#
# nodebuginfo
#Compat macro for new _fillupdir macro introduced in Nov 2017
%if ! %{defined _fillupdir}
%define _fillupdir /var/adm/fillup-templates
%endif
# Handle _multibuild magic.
%define flavour @BUILD_FLAVOR@%{nil}
# We split the Name: into "realname" and "name_suffix".
%define realname containerd
%if "%flavour" == ""
%define name_suffix %{nil}
%else
%define name_suffix -%{flavour}
%endif
# MANUAL: Update the git_version.
%define git_version 269548fa27e0089a8b8278fc4fc781d7f65a939b
%define git_short 269548fa27e0
Name: %{realname}%{name_suffix}
Version: 1.4.3
Release: 0
Summary: Standalone OCI Container Daemon
License: Apache-2.0
Group: System/Management
URL: https://containerd.tools
Source: %{realname}-%{version}_%{git_short}.tar.xz
Source1: %{realname}-rpmlintrc
# OPENSUSE-FIX-UPSTREAM: Backport of https://github.com/containerd/containerd/pull/2764.
Patch1: 0001-makefile-remove-emoji.patch
BuildRequires: fdupes
BuildRequires: glibc-devel-static
BuildRequires: go-go-md2man
BuildRequires: libbtrfs-devel >= 3.8
BuildRequires: libseccomp-devel >= 2.2
BuildRequires: pkg-config
# Due to a limitation in openSUSE's Go packaging we cannot have a BuildRequires
# for 'golang(API) >= 1.13' here, so just require 1.13 exactly. bsc#1172608
BuildRequires: go1.13
# We provide a git revision so that Docker can require it properly.
Provides: %{name}-git = %{git_version}
# Currently runc is the only supported runtime for containerd. We pin the same
# flavour as us, to avoid mixing (the version pinning is done by docker.spec).
Requires: docker-runc%{name_suffix}
Requires(post): %fillup_prereq
ExcludeArch: s390
# KUBIC-SPECIFIC: This was required when upgrading from the original kubic
# packaging, when everything was renamed to -kubic. It also is
# used to ensure that nothing complains too much when using
# -kubic packages. Hopfully it can be removed one day.
%if "%flavour" == "kubic"
# Obsolete older package without -kubic suffix: v2 -> v3
Obsoletes: %{realname} = 0.2.5+gitr569_2a5e70c
Obsoletes: %{realname}_2a5e70c
# Conflict with non-kubic package, and provide equivalent
Conflicts: %{realname} > 0.2.5+gitr569_2a5e70c
Provides: %{realname} = %{version}
# Disable leap based builds for kubic flavor (bsc#1121412)
%if 0%{?suse_version} == 1500 && 0%{?is_opensuse}
ExclusiveArch: do_not_build
%endif
%endif
%description
Containerd is a daemon with an API and a command line client, to manage
containers on one machine. It uses runC to run containers according to the OCI
specification. Containerd has advanced features such as seccomp and user
namespace support as well as checkpoint and restore for cloning and live
migration of containers.
%package ctr
Summary: Client for %{name}
Group: System/Management
Requires: %{name} = %{version}
# KUBIC-SPECIFIC: This was required when upgrading from the original kubic
# packaging, when everything was renamed to -kubic. It also is
# used to ensure that nothing complains too much when using
# -kubic packages. Hopfully it can be removed one day.
%if "%flavour" == "kubic"
# Obsolete older package without -kubic suffix: v2 -> v3
Obsoletes: %{realname}-ctr = 0.2.5+gitr569_2a5e70c
# Conflict with non-kubic package, and provide equivalent
Conflicts: %{realname}-ctr > 0.2.5+gitr569_2a5e70c
Provides: %{realname}-ctr = %{version}
%endif
%description ctr
Standalone client for containerd, which allows management of containerd containers
separately from Docker.
%prep
%setup -q -n %{realname}-%{version}_%{git_short}
%patch1 -p1
%build
# NOTE: containerd will switch to go.mod in 1.5.x so this can be removed after
# we update to that version.
# Do not use symlinks. If you want to run the unit tests for this package at
# some point during the build and you need to directly use go list directly it
# will get confused by symlinks.
export GOPATH=$HOME/go
export PROJECT=$HOME/go/src/github.com/containerd/containerd
mkdir -p $PROJECT
rm -rf $PROJECT/*
cp -ar * $PROJECT
BUILDTAGS="apparmor selinux seccomp"
make -C "$PROJECT"\
BUILDTAGS="$BUILDTAGS" \
VERSION="v%{version}" \
REVISION="%{git_version}"
# TODO: Fix man-page generation.
#make man
cp -r "$PROJECT/bin" bin
%check
# We used to run 'go test' here, however we found that this actually didn't
# catch any issues that were caught by smoke testing, and %check would
# continually cause package builds to fail due to flaky tests. If you ever need
# to know how the testing was done, you can always look in the package history.
# boo#1095817
%install
# Install binaries.
pushd bin/
for bin in containerd{,-shim*}
do
install -D -m755 "$bin" "%{buildroot}/%{_sbindir}/$bin"
done
# "ctr" is a bit too generic.
install -D -m755 ctr %{buildroot}/%{_sbindir}/%{realname}-ctr
popd
# Install docker-containerd symlink so Docker can find the containerd binary.
# FIXME: This is no longer necessary since Docker has adopted the upstream
# binary pathnames, but we need to resolve the docker-runc/runc split
# before we can clean up containerd as well.
ln -s %{_sbindir}/containerd %{buildroot}/%{_sbindir}/docker-containerd
# Set up dummy configuration.
install -d -m755 %{buildroot}/%{_sysconfdir}/%{realname}
echo "# See containerd-config.toml(5) for documentation." >%{buildroot}/%{_sysconfdir}/%{realname}/config.toml
# Man pages.
# TODO: Fix man page generation.
#for file in man/*
#do
# section="${file##*.}"
# install -D -m644 "$file" "%{buildroot}/%{_mandir}/man$section/$(basename "$file")"
#done
#ln -s ctr.1 %{buildroot}/%{_mandir}/man1/%{realname}-ctr.1
%fdupes %{buildroot}
%files
%defattr(-,root,root)
%doc README.md
%license LICENSE
%dir %{_sysconfdir}/%{realname}
%config %{_sysconfdir}/%{realname}/config.toml
%{_sbindir}/containerd
%{_sbindir}/containerd-shim*
%{_sbindir}/docker-containerd
# TODO: Fix man page generation.
#%{_mandir}/man*/%{realname}*
#%exclude %{_mandir}/man1/*ctr.1*
%files ctr
%{_sbindir}/containerd-ctr
# TODO: Fix man page generation.
#%{_mandir}/man1/*ctr.1*
%changelog