containerd/containerd.spec

123 lines
3.5 KiB
RPMSpec

#
# spec file for package containerd
#
# Copyright (c) 2016 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 go_arches %ix86 x86_64
%ifarch %go_arches
%define go_tool go
%define GO_BUILD_FLAGS %{nil}
%else
%define go_tool go-5
%define GO_BUILD_FLAGS "-gccgoflags=-Wl,--add-needed -Wl,--no-as-needed -static-libgo -ldl"
%endif
%define version_unconverted 0.0.5
Name: containerd
Version: 0.0.5
Release: 0
License: Apache-2.0
Summary: Standalone OCI Container Daemon
Url: https://containerd.tools
Group: System/Management
Source: %{name}-%{version}.tar.xz
Source1: %{name}.service
Source2: sysconfig.%{name}
%ifarch %go_arches
BuildRequires: go >= 1.5
%else
BuildRequires: gcc5-go >= 5.0
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Requires: runc
%define client ctr
%define daemon %{name}
%define shim %{name}-shim
%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}
%ifarch %go_arches
BuildRequires: go >= 1.5
%else
BuildRequires: gcc5-go >= 5.0
%endif
%description ctr
Standalone client for containerd, which allows management of containerd containers
separately from Docker.
%prep
%setup -q
%build
# Create buildir,
export GOPATH=$PWD/vendor
mkdir -pv $GOPATH/src/github.com/docker/
ln -svfn $PWD $GOPATH/src/github.com/docker/containerd
# Build deamon.
%go_tool build %GO_BUILD_FLAGS -x -o %{daemon}-%{version} github.com/docker/%{name}/%{daemon}
# Build shim.
%go_tool build %GO_BUILD_FLAGS -x -o %{shim}-%{version} github.com/docker/%{name}/%{shim}
# Build client.
%go_tool build %GO_BUILD_FLAGS -x -o %{client}-%{version} github.com/docker/%{name}/%{client}
%install
%{__install} -D -m755 %{daemon}-%{version} %{buildroot}/%{_bindir}/%{daemon}
%{__install} -D -m755 %{shim}-%{version} %{buildroot}/%{_bindir}/%{shim}
%{__install} -D -m755 %{client}-%{version} %{buildroot}/%{_bindir}/%{client}
# Add service and sysconfig.
%{__install} -D -m644 %SOURCE1 %{buildroot}/%{_unitdir}/%{name}.service
%{__install} -D -m644 %SOURCE2 %{buildroot}/var/adm/fillup-templates/sysconfig.%{name}
%pre
%service_add_pre %{name}.service
%post
%service_add_post %{name}.service
%{fillup_only -n containerd}
%preun
%service_del_preun %{name}.service
%postun
%service_del_postun %{name}.service
%files
%defattr(-,root,root)
%doc LICENSE.code LICENSE.docs README.md
%{_bindir}/%{daemon}
%{_bindir}/%{shim}
%{_unitdir}/%{name}.service
/var/adm/fillup-templates/sysconfig.%{name}
%files ctr
%{_bindir}/%{client}