# # spec file for package containerd # # Copyright (c) 2017 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_tool go %define GO_BUILD_FLAGS -buildmode=pie # MANUAL: Update the git_version and git_revision %define git_version 422e31c # How to get the git_revision # git clone https://github.com/docker/containerd.git containerd-upstream # cd containerd # git checkout $git_version # git_revision=r$(git rev-list HEAD | wc -l) %define git_revision r639 %define version_unconverted %{git_version} Name: containerd Version: 0.2.5+git%{git_revision}_%{git_version} Release: 0 Summary: Standalone OCI Container Daemon License: Apache-2.0 Group: System/Management Url: https://containerd.tools Source: %{name}-git.%{git_version}.tar.xz Source1: %{name}.service Source2: %{name}.socket Source3: sysconfig.%{name} # Make sure we require go 1.7 BuildRequires: golang(API) = 1.7 BuildRoot: %{_tmppath}/%{name}-%{version}-build # Currently runC is the only supported runtime for containerd. NOTE: # This version pinning is done to follow (as well as we can) upstream's # Dockerfile. However, for some reason the Dockerfile for containerd # diverges from the one for Docker. As such, this cannot be a hard # requirement (that would break Docker). Requires: docker-runc = 0.1.1+gitr2947_9c2d8d1 Requires(post): %fillup_prereq %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} # Make sure we require go 1.7 BuildRequires: golang(API) = 1.7 %description ctr Standalone client for containerd, which allows management of containerd containers separately from Docker. %package test Summary: Test package for containerd # Make sure we require go 1.7 Group: System/Management BuildRequires: golang(API) = 1.7 BuildArch: noarch %description test Test package for containerd. It contains the source code and the tests. %prep %setup -q -n %{name}-git.%{git_version} %build # 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:${HOME}/go/src/github.com/docker/containerd/vendor mkdir -pv $HOME/go/src/github.com/docker/containerd rm -rf $HOME/go/src/github.com/docker/containerd/* cp -avr * $HOME/go/src/github.com/docker/containerd # Build daemon. %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} %check export GOPATH=$HOME/go/src/github.com/docker/containerd/vendor:$GOPATH cd $HOME/go/src/github.com/docker/containerd %go_tool test %GO_BUILD_FLAGS -v $(%go_tool list ./... | grep github.com/docker/containerd | grep -v /integration-test) %install install -D -m755 %{daemon}-%{version} %{buildroot}/%{_sbindir}/%{daemon} install -D -m755 %{shim}-%{version} %{buildroot}/%{_sbindir}/%{shim} install -D -m755 %{client}-%{version} %{buildroot}/%{_sbindir}/%{name}-%{client} # Add service and sysconfig. install -D -m644 %SOURCE1 %{buildroot}/%{_unitdir}/%{name}.service install -D -m644 %SOURCE2 %{buildroot}/%{_unitdir}/%{name}.socket ln -sf %{_sbindir}/service %{buildroot}/%{_sbindir}/rccontainerd install -D -m644 %SOURCE3 %{buildroot}/var/adm/fillup-templates/sysconfig.%{name} install -d -m755 %{buildroot}/usr/src/containerd/ cp -avr $HOME/go/src/github.com/docker/containerd/* %{buildroot}/usr/src/containerd/ %pre %service_add_pre %{name}.service %{name}.socket %post %service_add_post %{name}.service %{name}.socket %{fillup_only -n containerd} %preun %service_del_preun %{name}.service %{name}.socket %postun %service_del_postun %{name}.service %{name}.socket %files %defattr(-,root,root) %doc LICENSE.code LICENSE.docs README.md %{_sbindir}/%{daemon} %{_sbindir}/%{shim} %{_unitdir}/%{name}.service %{_unitdir}/%{name}.socket /var/adm/fillup-templates/sysconfig.%{name} %{_sbindir}/rccontainerd %files ctr %{_sbindir}/%{name}-%{client} %files test %defattr(-,root,root) /usr/src/containerd/ %exclude /usr/src/containerd/bin %changelog