diff --git a/build.spec b/build.spec index 6417e967..2407ac18 100644 --- a/build.spec +++ b/build.spec @@ -14,6 +14,8 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # +# needsrootforbuild +# needsbinariesforbuild Name: build @@ -22,13 +24,15 @@ License: GPL-2.0+ and GPL-2.0 Group: Development/Tools/Building Version: 20150115 Release: 0 -#!BuildIgnore: build-mkbaselibs Source: obs-build-%{version}.tar.gz -Source1: baselibs.conf BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildArch: noarch # Manual requires to avoid hard require to bash-static AutoReqProv: off +%if 0%{?suse_version} > 1200 +# required for test suite +BuildRequires: build-mkbaselibs +%endif # Keep the following dependencies in sync with obs-worker package Requires: bash Requires: binutils @@ -139,9 +143,34 @@ cd $RPM_BUILD_ROOT/usr/lib/build/configs/ V=%suse_version ln -s sl${V:0:2}.${V:2:1}.conf default.conf %endif -test -e default.conf +test -e default.conf || exit 1 %endif +%check +if [ `whoami` != "root" ]; then + echo "WARNING: Not building as root, tests did not run!" + exit 0 +fi +# get back the default.conf link +cp -av $RPM_BUILD_ROOT/usr/lib/build/configs/default.conf configs/ +# do not get confused when building this already with build: +export BUILD_IGNORE_2ND_STAGE=1 +# use our own build code +export BUILD_DIR=$PWD +cd test +# target is autodetected +%if 0%{?sles_version} +echo "SLES config differs currently on purpose between OBS and build script." +echo "Skipping test case" +exit 0 +%endif +%if 0%{?qemu_user_space_build} +echo "test suite is not prepared to run using qemu linux user" +echo "Skipping test case" +exit 0 +%endif +./testbuild.sh /.build.binaries/ + %files %defattr(-,root,root) %doc README