2016-03-21 09:36:29 +01:00
|
|
|
#
|
|
|
|
# spec file for package runc
|
|
|
|
#
|
2017-01-13 18:01:54 +01:00
|
|
|
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
|
2016-03-21 09:36:29 +01:00
|
|
|
#
|
|
|
|
# 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-08-17 12:45:55 +02:00
|
|
|
|
2016-08-24 14:34:21 +02:00
|
|
|
# Check if go_arches is defined in the project configuration
|
|
|
|
# Otherwise, define it here
|
2016-08-25 15:46:46 +02:00
|
|
|
# In order to define it in the project configuration, see
|
2016-08-24 14:34:21 +02:00
|
|
|
#
|
2016-08-25 15:46:46 +02:00
|
|
|
# https://en.opensuse.org/openSUSE:Build%20Service%20prjconf#Macros
|
2016-08-24 14:34:21 +02:00
|
|
|
#
|
2016-08-25 15:46:46 +02:00
|
|
|
# The Macros tag is the one that defines the go_arches variable to be used
|
2016-08-24 14:34:21 +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:36 +02:00
|
|
|
%{!?go_arches: %global go_arches %ix86 x86_64 aarch64 ppc64le}
|
2016-08-24 14:34:21 +02:00
|
|
|
|
2016-03-21 13:15:39 +01:00
|
|
|
%ifarch %go_arches
|
|
|
|
%define go_tool go
|
|
|
|
%else
|
2016-08-23 17:12:47 +02:00
|
|
|
%define go_tool go-6
|
2016-03-21 13:15:39 +01:00
|
|
|
%endif
|
|
|
|
|
2016-11-24 13:49:13 +01:00
|
|
|
# MANUAL: Update the git_version and git_revision
|
2016-12-19 15:01:37 +01:00
|
|
|
# FIX-OPENSUSE: This will be removed as soon as we move Docker's runC fork into
|
|
|
|
# a separate package. This whole versioning mess is caused by
|
|
|
|
# Docker vendoring non-releases of runC.
|
2017-01-13 18:01:54 +01:00
|
|
|
%define git_version 50a19c6
|
2016-11-24 13:49:13 +01:00
|
|
|
# How to get the git_revision
|
|
|
|
# git clone ${url}.git runc-upstream
|
|
|
|
# cd runc-upstream
|
|
|
|
# git checkout $git_version
|
|
|
|
# git_revision=r$(git rev-list HEAD | wc -l)
|
2017-01-13 18:01:54 +01:00
|
|
|
%define git_revision r2819
|
2016-08-24 17:03:48 +02:00
|
|
|
%define version_unconverted %{git_version}
|
2016-03-21 09:36:29 +01:00
|
|
|
|
|
|
|
Name: runc
|
2016-12-19 18:41:49 +01:00
|
|
|
Version: 0.1.1+git%{git_revision}_%{git_version}
|
2016-03-21 09:36:29 +01:00
|
|
|
Release: 0
|
|
|
|
Summary: Tool for spawning and running OCI containers
|
|
|
|
License: Apache-2.0
|
|
|
|
Group: System/Management
|
|
|
|
Url: https://github.com/opencontainers/runc
|
2016-08-23 17:12:47 +02:00
|
|
|
Source: %{name}-git.%{git_version}.tar.xz
|
2017-01-13 18:01:54 +01:00
|
|
|
Patch0: CVE-2016-8649.patch
|
2016-09-23 16:37:04 +02:00
|
|
|
BuildRequires: fdupes
|
2016-03-21 13:15:39 +01:00
|
|
|
%ifarch %go_arches
|
2016-03-21 09:36:29 +01:00
|
|
|
BuildRequires: go >= 1.5
|
2016-03-27 17:19:30 +02:00
|
|
|
BuildRequires: go-go-md2man
|
2016-03-21 13:15:39 +01:00
|
|
|
%else
|
2016-08-23 17:12:47 +02:00
|
|
|
BuildRequires: gcc6-go >= 6.1
|
2016-03-21 13:15:39 +01:00
|
|
|
%endif
|
2016-03-21 09:36:29 +01:00
|
|
|
BuildRequires: libapparmor-devel
|
2016-04-15 12:47:01 +02:00
|
|
|
# Seccomp isn't supported on aarch64.
|
|
|
|
%ifnarch aarch64
|
2016-03-21 09:36:29 +01:00
|
|
|
BuildRequires: libseccomp-devel
|
2016-04-15 12:47:01 +02:00
|
|
|
%endif
|
2016-03-21 09:36:29 +01:00
|
|
|
BuildRequires: libselinux-devel
|
2016-03-27 17:19:30 +02:00
|
|
|
Recommends: criu
|
2016-03-21 09:36:29 +01:00
|
|
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
|
|
|
|
|
|
|
%description
|
|
|
|
runc is a CLI tool for spawning and running containers according to the OCI
|
|
|
|
specification. It is designed to be as minimal as possible, and is the workhorse
|
|
|
|
of Docker. It was originally designed to be a replacement for LXC within Docker,
|
|
|
|
and has grown to become a separate project entirely.
|
|
|
|
|
2016-08-17 12:45:55 +02:00
|
|
|
%package test
|
|
|
|
Summary: Test package for runc
|
|
|
|
Group: System/Management
|
|
|
|
%ifarch %go_arches
|
|
|
|
Requires: go >= 1.5
|
|
|
|
Requires: go-go-md2man
|
|
|
|
%else
|
2016-08-23 17:12:47 +02:00
|
|
|
Requires: gcc6-go >= 6.1
|
2016-08-17 12:45:55 +02:00
|
|
|
%endif
|
|
|
|
Requires: libapparmor-devel
|
|
|
|
# Seccomp isn't supported on aarch64.
|
|
|
|
%ifnarch aarch64
|
|
|
|
Requires: libseccomp-devel
|
|
|
|
%endif
|
|
|
|
Requires: libselinux-devel
|
|
|
|
Recommends: criu
|
|
|
|
BuildArch: noarch
|
|
|
|
|
|
|
|
%description test
|
|
|
|
Test package for runc. It contains the source code and the tests.
|
|
|
|
|
2016-03-21 09:36:29 +01:00
|
|
|
%prep
|
2016-08-23 17:12:47 +02:00
|
|
|
%setup -q -n %{name}-git.%{git_version}
|
2017-01-13 18:01:54 +01:00
|
|
|
%patch0 -p1
|
2016-03-21 09:36:29 +01:00
|
|
|
|
|
|
|
%build
|
2016-08-17 12:45:55 +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:03 +02:00
|
|
|
export GOPATH=${HOME}/go:${HOME}/go/src/github.com/opencontainers/runc/Godeps/_workspace
|
2016-08-17 12:45:55 +02:00
|
|
|
mkdir -pv $HOME/go/src/github.com/opencontainers/runc
|
|
|
|
rm -rf $HOME/go/src/github.com/opencontainers/runc/*
|
|
|
|
cp -avr * $HOME/go/src/github.com/opencontainers/runc
|
2016-03-21 13:15:39 +01:00
|
|
|
|
2016-08-23 17:12:47 +02:00
|
|
|
export BUILDFLAGS="-gccgoflags=-Wl,--add-needed -Wl,--no-as-needed -static-libgo -ldl -lselinux -lapparmor"
|
2016-03-21 13:15:39 +01:00
|
|
|
# Build all features.
|
2016-03-27 12:15:05 +02:00
|
|
|
export BUILDTAGS="apparmor selinux"
|
|
|
|
|
|
|
|
# Seccomp isn't supported on aarch64.
|
|
|
|
%ifnarch aarch64
|
|
|
|
export BUILDTAGS="$BUILDTAGS seccomp"
|
2016-08-23 17:12:47 +02:00
|
|
|
export BUILDFLAGS="$BUILDFLAGS -lseccomp"
|
2016-03-27 12:15:05 +02:00
|
|
|
%endif
|
|
|
|
|
|
|
|
# Build runc.
|
2016-08-23 17:12:47 +02:00
|
|
|
%go_tool build "$BUILDFLAGS" -tags "$BUILDTAGS" -x -o %{name}-%{version} github.com/opencontainers/%{name}
|
2016-03-21 09:36:29 +01:00
|
|
|
|
2016-03-27 17:19:30 +02:00
|
|
|
# Build man pages, this can only be done on arches where we can build go-md2man.
|
|
|
|
%ifarch %go_arches
|
|
|
|
man/md2man-all.sh
|
|
|
|
%endif
|
|
|
|
|
2016-08-23 17:12:47 +02:00
|
|
|
%ifarch %go_arches
|
|
|
|
%check
|
|
|
|
export GOPATH=$HOME/go/src/github.com/opencontainers/runc/Godeps/_workspace:$GOPATH
|
|
|
|
cd $HOME/go/src/github.com/opencontainers/runc
|
|
|
|
PKG_LIST=$(go list ./... \
|
|
|
|
| grep -v 'github.com/opencontainers/runc/libcontainer/cgroups/fs$' \
|
|
|
|
| grep -v 'github.com/opencontainers/runc/libcontainer$' \
|
|
|
|
| grep -v 'github.com/opencontainers/runc/libcontainer/integration$' \
|
|
|
|
| grep -v 'github.com/opencontainers/runc/libcontainer/nsenter$' \
|
|
|
|
| grep -v 'github.com/opencontainers/runc/libcontainer/user$' \
|
|
|
|
| grep -v 'github.com/opencontainers/runc/libcontainer/xattr$')
|
|
|
|
go test -timeout 3m -tags "$BUILDTAGS" -v $PKG_LIST
|
|
|
|
%endif
|
|
|
|
|
2016-03-21 09:36:29 +01:00
|
|
|
%install
|
2016-03-30 16:18:58 +02:00
|
|
|
%{__install} -D -m755 %{name}-%{version} %{buildroot}%{_sbindir}/%{name}
|
2016-08-17 12:45:55 +02:00
|
|
|
install -d -m755 %{buildroot}/usr/src/runc/
|
|
|
|
cp -avr $HOME/go/src/github.com/opencontainers/runc/* %{buildroot}/usr/src/runc/
|
2016-03-21 09:36:29 +01:00
|
|
|
|
2016-12-28 11:08:10 +01:00
|
|
|
# symlink runc as docker-runc. bsc#1015661
|
|
|
|
install -d -m755 %{buildroot}/%{_bindir}
|
|
|
|
ln -s /usr/sbin/runc %{buildroot}/%{_bindir}/docker-runc
|
|
|
|
|
2016-03-27 17:19:30 +02:00
|
|
|
%ifarch %go_arches
|
|
|
|
%{__install} -d -m755 %{buildroot}%{_mandir}/man8
|
|
|
|
%{__install} -m644 man/man8/runc*.8 %{buildroot}%{_mandir}/man8
|
|
|
|
%endif
|
|
|
|
|
2016-09-23 16:37:04 +02:00
|
|
|
%fdupes %{buildroot}/%{_prefix}
|
|
|
|
|
2016-12-21 17:38:17 +01:00
|
|
|
%post
|
|
|
|
|
2016-03-21 09:36:29 +01:00
|
|
|
%files
|
|
|
|
%defattr(-,root,root)
|
|
|
|
%doc README.md LICENSE
|
2016-03-30 16:18:58 +02:00
|
|
|
%{_sbindir}/%{name}
|
2016-12-28 11:08:10 +01:00
|
|
|
%{_bindir}/docker-runc
|
2016-03-27 17:19:30 +02:00
|
|
|
|
|
|
|
%ifarch %go_arches
|
|
|
|
%{_mandir}/man8/runc*.8.gz
|
|
|
|
%endif
|
2016-08-17 12:45:55 +02:00
|
|
|
|
|
|
|
%files test
|
|
|
|
%defattr(-,root,root)
|
|
|
|
/usr/src/runc/
|
|
|
|
%exclude /usr/src/runc/runc
|
|
|
|
%exclude /usr/src/runc/runc/Godeps/_workspace/pkg
|
|
|
|
|
|
|
|
%changelog
|