SHA256
1
0
forked from pool/runc
runc/runc.spec
Christian Brauner a8cdc9e7c2 Accepting request 421318 from Virtualization:containers:1.12-RC
- use gcc6-go instead of gcc5-go (bsc#988408) 
- build ppc64le with gc-go because this version builds with gc-go 1.6

- bump git commit id to the one required by docker v1.12.0 (bsc#995058)
- run unit tests during package build
- remove seccomp-use-pkg-config.patch
  The patch is now upstream.
- remove GO_BUILD_FLAGS macro and substitute with BUILDFLAGS env variable to
  allow for easier string appending.
- only run unit test on architectures that provide the go list and go test tools

OBS-URL: https://build.opensuse.org/request/show/421318
OBS-URL: https://build.opensuse.org/package/show/Virtualization:containers/runc?expand=0&rev=16
2016-08-23 15:12:47 +00:00

149 lines
4.6 KiB
RPMSpec

#
# spec file for package runc
#
# 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 aarch64 ppc64le
%ifarch %go_arches
%define go_tool go
%else
%define go_tool go-6
%endif
%define git_version cc29e3d
Name: runc
Version: 0.1.1+git%{git_version}
Release: 0
Summary: Tool for spawning and running OCI containers
License: Apache-2.0
Group: System/Management
Url: https://github.com/opencontainers/runc
Source: %{name}-git.%{git_version}.tar.xz
%ifarch %go_arches
BuildRequires: go >= 1.5
BuildRequires: go-go-md2man
%else
BuildRequires: gcc6-go >= 6.1
%endif
BuildRequires: libapparmor-devel
# Seccomp isn't supported on aarch64.
%ifnarch aarch64
BuildRequires: libseccomp-devel
%endif
BuildRequires: libselinux-devel
Recommends: criu
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.
%package test
Summary: Test package for runc
Group: System/Management
%ifarch %go_arches
Requires: go >= 1.5
Requires: go-go-md2man
%else
Requires: gcc6-go >= 6.1
%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.
%prep
%setup -q -n %{name}-git.%{git_version}
# Apply the vendor'd patch to the right subdirectory.
%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/opencontainers/runc/Godeps/_workspace:${GOPATH}
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
export BUILDFLAGS="-gccgoflags=-Wl,--add-needed -Wl,--no-as-needed -static-libgo -ldl -lselinux -lapparmor"
# Build all features.
export BUILDTAGS="apparmor selinux"
# Seccomp isn't supported on aarch64.
%ifnarch aarch64
export BUILDTAGS="$BUILDTAGS seccomp"
export BUILDFLAGS="$BUILDFLAGS -lseccomp"
%endif
# Build runc.
%go_tool build "$BUILDFLAGS" -tags "$BUILDTAGS" -x -o %{name}-%{version} github.com/opencontainers/%{name}
# Build man pages, this can only be done on arches where we can build go-md2man.
%ifarch %go_arches
man/md2man-all.sh
%endif
%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
%install
%{__install} -D -m755 %{name}-%{version} %{buildroot}%{_sbindir}/%{name}
install -d -m755 %{buildroot}/usr/src/runc/
cp -avr $HOME/go/src/github.com/opencontainers/runc/* %{buildroot}/usr/src/runc/
%ifarch %go_arches
%{__install} -d -m755 %{buildroot}%{_mandir}/man8
%{__install} -m644 man/man8/runc*.8 %{buildroot}%{_mandir}/man8
%endif
%files
%defattr(-,root,root)
%doc README.md LICENSE
%{_sbindir}/%{name}
%ifarch %go_arches
%{_mandir}/man8/runc*.8.gz
%endif
%files test
%defattr(-,root,root)
/usr/src/runc/
%exclude /usr/src/runc/runc
%exclude /usr/src/runc/runc/Godeps/_workspace/pkg
%changelog