File docker-runc.spec of Package docker-runc.6033
#
# spec file for package docker-runc
#
# Copyright (c) 2018 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/
#
# nodebuginfo
# MANUAL: Update the git_version, git_short, and git_revision
%define git_version 3f2f8b84a77f73d38244dd690525642a72156c64
%define git_short 3f2f8b84a77f
# 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)
%define git_revision r3338
%define go_tool go
%define _name runc
%define project github.com/opencontainers/%{_name}
# enable libseccomp for sle >= sle12sp2
%if 0%{?sle_version} >= 120200
%define with_libseccomp 1
%endif
# enable libseccomp for leap >= 42.2
%if 0%{?leap_version} >= 420200
%define with_libseccomp 1
%endif
# enable libseccomp for Factory
%if 0%{?suse_version} > 1320
%define with_libseccomp 1
%endif
Name: docker-runc
Version: 1.0.0rc4+git%{git_revision}_%{git_short}
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
# SUSE-FIX-UPSTREAM: Backport of https://github.com/opencontainers/runc/pull/1555. bsc#1053532
Patch100: bsc1053532-0001-makefile-drop-usage-of-install.patch
BuildRequires: fdupes
BuildRequires: go-go-md2man
BuildRequires: libapparmor-devel
BuildRequires: golang(API) = 1.7
%if 0%{?with_libseccomp}
BuildRequires: libseccomp-devel
%endif
BuildRequires: libselinux-devel
Recommends: criu
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Obsoletes: runc <= 1.0
# We provide a git revision so that Docker can require it properly.
Provides: %{name}-git = %{git_version}
ExcludeArch: s390
%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
BuildRequires: golang(API) = 1.7
Requires: go-go-md2man
Requires: libapparmor-devel
%if 0%{?with_libseccomp}
BuildRequires: libseccomp-devel
%endif
Requires: libselinux-devel
Recommends: criu
BuildArch: noarch
Obsoletes: runc-test <= 1.0
%description test
Test package for runc. It contains the source code and the tests.
%prep
%setup -q -n %{name}-git.%{git_version}
# bsc#1053532
%patch100 -p1
%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
export PROJECT=${HOME}/go/src/%project
mkdir -pv $PROJECT
rm -rf $PROJECT/*
cp -av * $PROJECT
# Additionally enable seccomp.
%if 0%{?with_libseccomp}
export EXTRA_BUILDTAGS+="seccomp"
export EXTRA_GCCFLAGS+="-lseccomp"
%endif
# Build all features.
export BUILDTAGS="apparmor selinux $EXTRA_BUILDTAGS"
export BUILDFLAGS="-buildmode=pie -gccgoflags='-Wl,--add-needed -Wl,--no-as-needed -static-libgo -ldl -lselinux -lapparmor $EXTRA_GCCFLAGS'"
(cat <<EOF
export GOPATH="$GOPATH"
export BUILDTAGS="$BUILDTAGS"
export BUILDFLAGS="$BUILDFLAGS"
EOF
) >./.runc_build_env
source ./.runc_build_env
# Build runc.
make -C $PROJECT EXTRA_FLAGS="-x $BUILDFLAGS" BUILDTAGS="$BUILDTAGS" COMMIT_NO=%{git_version} runc
cp $PROJECT/runc %{name}-%{version}
# Build man pages, this can only be done on arches where we can build go-md2man.
man/md2man-all.sh
%check
source ./.runc_build_env
cd $HOME/go/src/%project
PKG_LIST=$(go list ./... \
| grep -v '%{project}/libcontainer/cgroups/fs$' \
| grep -v '%{project}/libcontainer$' \
| grep -v '%{project}/libcontainer/integration$' \
| grep -v '%{project}/libcontainer/label$' \
| grep -v '%{project}/libcontainer/nsenter$' \
| grep -v '%{project}/libcontainer/user$' \
| grep -v '%{project}/libcontainer/xattr$' \
%if ! 0%{?with_libseccomp}
| grep -v '%{project}/libcontainer/seccomp$' \
| grep -v 'github.com/seccomp/libseccomp-golang$' \
%endif
)
%go_tool test -buildmode=pie -tags "$BUILDTAGS" -timeout 3m -v $PKG_LIST
%install
source ./.runc_build_env
# Make sure we install in /usr/sbin/docker-runc
install -D -m755 %{name}-%{version} %{buildroot}%{_sbindir}/%{name}
install -d -m755 %{buildroot}/usr/src/%{name}/
cp -av $HOME/go/src/%{project}/* %{buildroot}/usr/src/%{name}/
rm -rf %{buildroot}/usr/src/docker-runc/runc
# We have to rename the man pages to docker-runc.
install -d -m755 %{buildroot}%{_mandir}/man8
cd man/man8
for mp in $(ls runc*.8); do
install -m644 ${mp} %{buildroot}%{_mandir}/man8/docker-${mp}
done
%fdupes %{buildroot}
%files
%defattr(-,root,root)
%doc README.md LICENSE
%{_sbindir}/docker-runc
%{_mandir}/man8/docker-runc*.8.gz
%files test
%defattr(-,root,root)
/usr/src/docker-runc/
%changelog