2016-03-27 12:27:18 +02:00
|
|
|
#
|
|
|
|
# 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/
|
|
|
|
#
|
|
|
|
|
2016-06-17 16:40:17 +02:00
|
|
|
|
2016-08-24 14:33:46 +02:00
|
|
|
# Check if go_arches is defined in the project configuration
|
|
|
|
# Otherwise, define it here
|
2016-08-25 15:46:50 +02:00
|
|
|
# In order to define it in the project configuration, see
|
2016-08-24 14:33:46 +02:00
|
|
|
#
|
2016-08-25 15:46:50 +02:00
|
|
|
# https://en.opensuse.org/openSUSE:Build%20Service%20prjconf#Macros
|
2016-08-24 14:33:46 +02:00
|
|
|
#
|
2016-08-25 15:46:50 +02:00
|
|
|
# The Macros tag is the one that defines the go_arches variable to be used
|
2016-08-24 14:33:46 +02:00
|
|
|
# in the spec file.
|
|
|
|
# The "define" one is to help the specfile parser of the buildservice
|
|
|
|
# to see what packages are being built. You also want to define it here
|
|
|
|
# for keeping things consistent.
|
|
|
|
|
2016-09-19 14:08:41 +02:00
|
|
|
%{!?go_arches: %global go_arches %ix86 x86_64 aarch64 ppc64le}
|
2016-03-27 12:27:18 +02:00
|
|
|
|
|
|
|
%ifarch %go_arches
|
|
|
|
%define go_tool go
|
|
|
|
%define GO_BUILD_FLAGS %{nil}
|
|
|
|
%else
|
2016-08-23 17:13:07 +02:00
|
|
|
%define go_tool go-6
|
2016-03-27 13:14:42 +02:00
|
|
|
%define GO_BUILD_FLAGS "-gccgoflags=-Wl,--add-needed -Wl,--no-as-needed -static-libgo -ldl"
|
2016-03-27 12:27:18 +02:00
|
|
|
%endif
|
|
|
|
|
2016-10-24 12:56:09 +02:00
|
|
|
%define git_version 0366d7e
|
|
|
|
%define version_unconverted %{git_version}
|
2016-08-23 18:06:44 +02:00
|
|
|
|
2016-03-27 12:27:18 +02:00
|
|
|
Name: containerd
|
2016-10-24 12:56:09 +02:00
|
|
|
Version: 0.2.4+git%{git_version}
|
2016-03-27 12:27:18 +02:00
|
|
|
Release: 0
|
|
|
|
Summary: Standalone OCI Container Daemon
|
2016-06-17 16:40:17 +02:00
|
|
|
License: Apache-2.0
|
2016-03-27 12:27:18 +02:00
|
|
|
Group: System/Management
|
2016-06-17 16:40:17 +02:00
|
|
|
Url: https://containerd.tools
|
2016-10-24 12:56:09 +02:00
|
|
|
Source: %{name}-git.%{git_version}.tar.xz
|
2016-03-27 13:14:42 +02:00
|
|
|
Source1: %{name}.service
|
2016-04-01 14:49:25 +02:00
|
|
|
Source2: %{name}.socket
|
|
|
|
Source3: sysconfig.%{name}
|
2016-03-27 12:27:18 +02:00
|
|
|
%ifarch %go_arches
|
|
|
|
BuildRequires: go >= 1.5
|
|
|
|
%else
|
2016-08-23 17:13:07 +02:00
|
|
|
BuildRequires: gcc6-go >= 6.1
|
2016-03-27 12:27:18 +02:00
|
|
|
%endif
|
|
|
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
2016-08-16 12:57:22 +02:00
|
|
|
# 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).
|
2016-10-25 10:32:28 +02:00
|
|
|
Requires: runc = 0.1.1+git02f8fa7
|
2016-08-23 18:06:44 +02:00
|
|
|
|
2016-03-27 12:27:18 +02:00
|
|
|
%define client ctr
|
|
|
|
%define daemon %{name}
|
|
|
|
%define shim %{name}-shim
|
|
|
|
|
|
|
|
%description
|
2016-04-01 14:49:25 +02:00
|
|
|
Containerd is a daemon with an API and a command line client, to manage
|
2016-03-27 12:27:18 +02:00
|
|
|
containers on one machine. It uses runC to run containers according to the OCI
|
2016-04-01 14:49:25 +02:00
|
|
|
specification. Containerd has advanced features such as seccomp and user
|
2016-03-27 12:27:18 +02:00
|
|
|
namespace support as well as checkpoint and restore for cloning and live
|
|
|
|
migration of containers.
|
|
|
|
|
2016-03-27 13:20:12 +02:00
|
|
|
%package ctr
|
2016-03-27 13:14:42 +02:00
|
|
|
Summary: Client for %{name}
|
|
|
|
Group: System/Management
|
|
|
|
Requires: %{name} = %{version}
|
|
|
|
%ifarch %go_arches
|
|
|
|
BuildRequires: go >= 1.5
|
|
|
|
%else
|
2016-08-23 17:13:07 +02:00
|
|
|
BuildRequires: gcc6-go >= 6.1
|
2016-03-27 13:14:42 +02:00
|
|
|
%endif
|
|
|
|
|
2016-03-27 13:20:12 +02:00
|
|
|
%description ctr
|
2016-03-27 13:14:42 +02:00
|
|
|
Standalone client for containerd, which allows management of containerd containers
|
|
|
|
separately from Docker.
|
|
|
|
|
2016-08-18 11:49:59 +02:00
|
|
|
%package test
|
|
|
|
Summary: Test package for containerd
|
|
|
|
Group: System/Management
|
|
|
|
%ifarch %go_arches
|
|
|
|
Requires: go >= 1.5
|
|
|
|
%else
|
|
|
|
Requires: gcc5-go >= 5.0
|
|
|
|
%endif
|
|
|
|
BuildArch: noarch
|
|
|
|
|
|
|
|
%description test
|
|
|
|
Test package for containerd. It contains the source code and the tests.
|
|
|
|
|
2016-03-27 12:27:18 +02:00
|
|
|
%prep
|
2016-10-24 12:56:09 +02:00
|
|
|
%setup -q -n %{name}-git.%{git_version}
|
2016-03-27 12:27:18 +02:00
|
|
|
|
|
|
|
%build
|
2016-08-18 11:49:59 +02:00
|
|
|
# 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.
|
2016-08-25 18:01:25 +02:00
|
|
|
export GOPATH=${HOME}/go:${HOME}/go/src/github.com/docker/containerd/vendor
|
2016-08-18 11:49:59 +02:00
|
|
|
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
|
2016-03-27 12:27:18 +02:00
|
|
|
|
2016-08-23 17:13:07 +02:00
|
|
|
# Build daemon.
|
2016-03-27 12:27:18 +02:00
|
|
|
%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}
|
|
|
|
|
2016-08-23 17:13:07 +02:00
|
|
|
%ifarch %go_arches
|
|
|
|
%check
|
|
|
|
export GOPATH=$HOME/go/src/github.com/docker/containerd/vendor:$GOPATH
|
|
|
|
cd $HOME/go/src/github.com/docker/containerd
|
|
|
|
go test -v $(go list ./... | grep github.com/docker/containerd | grep -v /integration-test)
|
|
|
|
%endif
|
|
|
|
|
2016-03-27 12:27:18 +02:00
|
|
|
%install
|
2016-03-30 16:20:26 +02:00
|
|
|
%{__install} -D -m755 %{daemon}-%{version} %{buildroot}/%{_sbindir}/%{daemon}
|
|
|
|
%{__install} -D -m755 %{shim}-%{version} %{buildroot}/%{_sbindir}/%{shim}
|
2016-03-30 16:29:23 +02:00
|
|
|
%{__install} -D -m755 %{client}-%{version} %{buildroot}/%{_sbindir}/%{name}-%{client}
|
2016-03-27 12:27:18 +02:00
|
|
|
|
2016-03-27 13:14:42 +02:00
|
|
|
# Add service and sysconfig.
|
|
|
|
%{__install} -D -m644 %SOURCE1 %{buildroot}/%{_unitdir}/%{name}.service
|
2016-04-01 14:49:25 +02:00
|
|
|
%{__install} -D -m644 %SOURCE2 %{buildroot}/%{_unitdir}/%{name}.socket
|
2016-04-29 12:06:39 +02:00
|
|
|
ln -sf %{_sbindir}/service %{buildroot}/%{_sbindir}/rccontainerd
|
2016-04-01 14:49:25 +02:00
|
|
|
%{__install} -D -m644 %SOURCE3 %{buildroot}/var/adm/fillup-templates/sysconfig.%{name}
|
2016-03-27 13:14:42 +02:00
|
|
|
|
2016-08-18 11:49:59 +02:00
|
|
|
install -d -m755 %{buildroot}/usr/src/containerd/
|
|
|
|
cp -avr $HOME/go/src/github.com/docker/containerd/* %{buildroot}/usr/src/containerd/
|
|
|
|
|
2016-03-27 13:14:42 +02:00
|
|
|
%pre
|
2016-04-01 14:49:25 +02:00
|
|
|
%service_add_pre %{name}.service %{name}.socket
|
2016-03-27 13:14:42 +02:00
|
|
|
|
2016-03-27 12:27:18 +02:00
|
|
|
%post
|
2016-04-01 14:49:25 +02:00
|
|
|
%service_add_post %{name}.service %{name}.socket
|
2016-03-27 13:14:42 +02:00
|
|
|
%{fillup_only -n containerd}
|
|
|
|
|
|
|
|
%preun
|
2016-04-01 14:49:25 +02:00
|
|
|
%service_del_preun %{name}.service %{name}.socket
|
2016-03-27 12:27:18 +02:00
|
|
|
|
|
|
|
%postun
|
2016-04-01 14:49:25 +02:00
|
|
|
%service_del_postun %{name}.service %{name}.socket
|
2016-03-27 12:27:18 +02:00
|
|
|
|
|
|
|
%files
|
|
|
|
%defattr(-,root,root)
|
|
|
|
%doc LICENSE.code LICENSE.docs README.md
|
2016-03-30 16:20:26 +02:00
|
|
|
%{_sbindir}/%{daemon}
|
|
|
|
%{_sbindir}/%{shim}
|
2016-03-27 13:14:42 +02:00
|
|
|
%{_unitdir}/%{name}.service
|
2016-04-01 14:49:25 +02:00
|
|
|
%{_unitdir}/%{name}.socket
|
2016-03-27 13:14:42 +02:00
|
|
|
/var/adm/fillup-templates/sysconfig.%{name}
|
2016-04-29 12:06:39 +02:00
|
|
|
%{_sbindir}/rccontainerd
|
2016-03-27 13:14:42 +02:00
|
|
|
|
2016-03-27 13:20:12 +02:00
|
|
|
%files ctr
|
2016-03-30 16:29:23 +02:00
|
|
|
%{_sbindir}/%{name}-%{client}
|
2016-06-17 16:40:17 +02:00
|
|
|
|
2016-08-18 11:49:59 +02:00
|
|
|
%files test
|
|
|
|
%defattr(-,root,root)
|
|
|
|
/usr/src/containerd/
|
|
|
|
%exclude /usr/src/containerd/bin
|
|
|
|
|
2016-06-17 16:40:17 +02:00
|
|
|
%changelog
|