- added macros.apache-rex

OBS-URL: https://build.opensuse.org/package/show/Apache/apache-rex?expand=0&rev=6
This commit is contained in:
Petr Gajdos 2017-11-16 12:58:57 +00:00 committed by Git OBS Bridge
parent 2d3f9a1633
commit 4565129e0c
3 changed files with 66 additions and 2 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Nov 15 14:05:51 UTC 2017 - pgajdos@suse.com
- added macros.apache-rex
-------------------------------------------------------------------
Wed Oct 4 09:35:08 UTC 2017 - pgajdos@suse.com

View File

@ -1,7 +1,7 @@
#
# spec file for package apache-rex
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2017 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
@ -15,6 +15,15 @@
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
#
%if 0%{?suse_version} > 1230
%define macros_dir %{_libexecdir}/rpm/macros.d
%else
%define macros_dir %{_sysconfdir}/rpm
%endif
%define macros_file macros.apache-rex
Name: apache-rex
Version: 20170912
Release: 0
@ -24,6 +33,7 @@ Group: Documentation/Howto
Url: https://github.com/pgajdos/apache-rex
Source0: %{name}.tar.bz2
Source1: apache-rex-rpmlintrc
Source2: %{macros_file}
Requires: apache2-devel
Requires: curl
Requires: lsof
@ -46,11 +56,13 @@ mkdir -p %{buildroot}%{_bindir}
cp run-rex %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_docdir}/%{name}
cp -r */ LICENSE README.md contents %{buildroot}%{_docdir}/%{name}
mkdir -p %{buildroot}%{macros_dir}
install -m 644 %{SOURCE2} %{buildroot}%{macros_dir}/%{macros_file}
%files
%defattr(-,root,root)
%{_bindir}/run-rex
%{macros_dir}/%{macros_file}
%{_docdir}/%{name}
%changelog

47
macros.apache-rex Normal file
View File

@ -0,0 +1,47 @@
%__rex_examples %{_docdir}/apache-rex/
%__rex_run_dir ./apache-rex
%__rex_logfile %{__rex_run_dir}/run_log
%__rex_verbosity 0
#
# macro: run supplied apache runnable example
#
# usage: %apache_rex_check [parameters] example_dir
#
# parameters: -r run_base_dir where to write examples output, logs, etc.
# default: see %{__rex_run_dir}
# -v verbosity verbosity of the output [0, 1, 2]
# default: see %{__rex_verbosity}
#
%apache_rex_check(r:) \
EXAMPLE_DIR="%1" \
if [ -z "%1" ]; then \
echo "ERROR: no example dir provided" \
exit 1 \
fi \
if [ ! -d "$EXAMPLE_DIR" ]; then \
EXAMPLE_DIR="%{__rex_examples}%1" \
if [ ! -d "$EXAMPLE_DIR" ]; then \
echo "ERROR: example %1 not found" \
exit 1 \
fi \
fi \
REX_RUN_DIR="%{-r:%{-r*}}" \
if [ -z "$REX_RUN_DIR" ]; then \
REX_RUN_DIR='%{__rex_run_dir}' \
fi \
REX_VERBOSITY="%{-v:%{-v*}}" \
if [ -z "$REX_VERBOSITY" ]; then \
REX_VERBOSITY='%{__rex_verbosity}' \
fi \
echo "HERE $PWD, creating $REX_RUN_DIR" \
mkdir -p $REX_RUN_DIR \
ls -ld $PWD/$REX_RUN_DIR \
VERBOSITY=%{__rex_verbosity} RUN_DIR_BASE=$PWD/$REX_RUN_DIR run-rex $EXAMPLE_DIR | tee %{__rex_logfile} \
if grep -q 'FAILED RUNS:' %{__rex_logfile}; then \
echo "ERROR: example %1 failed, see %{__rex_logfile}" \
exit 1 \
fi \
%nil