Accepting request 447147 from home:cyphar:containers

Add %check tests to umoci package building.

OBS-URL: https://build.opensuse.org/request/show/447147
OBS-URL: https://build.opensuse.org/package/show/Virtualization:containers/umoci?expand=0&rev=5
This commit is contained in:
Jordi Massaguer
2016-12-20 10:14:26 +00:00
committed by Git OBS Bridge
parent 44d3dbe7c9
commit a824efe877
3 changed files with 104 additions and 3 deletions

View File

@@ -22,6 +22,9 @@
# Remove stripping of Go binaries.
%define __arch_install_post export NO_BRP_STRIP_DEBUG=true
# Project name when using go tooling.
%define project github.com/cyphar/umoci
Name: umoci
Version: 0.0.0~rc3
Release: 0
@@ -30,6 +33,8 @@ License: Apache-2.0
Group: System/Management
Url: https://github.com/cyphar/umoci
Source: %{name}-%{version}.tar.xz
# PATCH-FIX-UPSTREAM: Backport of cyphar/umoci#65, which is already upstream.
Patch100: make-local-unit-tests-work-as-non-root.patch
%ifarch %{go_arches}
BuildRequires: go >= 1.6
BuildRequires: go-go-md2man
@@ -53,12 +58,18 @@ the Open Container Initiative community.
%prep
%setup -q
# cyphar/umoci#65
%patch100 -p1
%build
mkdir -p .gopath/src/github.com/cyphar
ln -s $PWD .gopath/src/github.com/cyphar/umoci
export GOPATH=$PWD/.gopath
# We can't use symlinks here because go-list gets confused by symlinks, so we
# have to copy the source to $HOME/go and then use that as the GOPATH.
export GOPATH=$HOME/go
mkdir -pv $HOME/go/src/%{project}
rm -rf $HOME/go/src/%{project}/*
cp -avr * $HOME/go/src/%{project}
export VERSION="$(cat ./VERSION)"
if [ "$VERSION" != "%{version}" ]; then
VERSION+="-%{version}"
@@ -86,6 +97,10 @@ done
%fdupes %{buildroot}
%check
export GOPATH=$HOME/go
go test -cover %{project}/...
%files
%defattr(-,root,root)
%doc COPYING README.md man/*.md