File macros.apache-rex of Package apache-rex.15223

%__rex_examples    %{_docdir}/apache-rex/

%__rex_run_dir     ./apache-rex
%__rex_logfile     %{__rex_run_dir}/run_log
%__rex_verbosity   1

#
# 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}
#                   -m module_path    coma separated list; path(s) to additional modules (to be tested)
#                                     default: ''
#                   -b binary_path    coma separated list; path(s) to additional binaries (to be tested)
#                                     default: ''
#
%apache_rex_check(r:,v:,m:,b:) \
  EXAMPLE_DIRS="%{*}" \
  if [ -z "$EXAMPLE_DIRS" ]; then \
    echo "ERROR: no example dir provided" \
    exit 1 \
  fi \
  EDS= \
  for EXAMPLE_DIR in $EXAMPLE_DIRS; do \
    if [ ! -d "$EXAMPLE_DIR" ]; then \
      EXAMPLE_DIR="%{__rex_examples}$EXAMPLE_DIR" \
      if [ ! -d "$EXAMPLE_DIR" ]; then \
        echo "ERROR: example $EXAMPLE_DIR not found" \
        exit 1 \
      fi \
    fi \
    EDS="$EDS $EXAMPLE_DIR" \
  done \
  EXAMPLE_DIRS="$EDS" \
  REX_RUN_DIR_BASE="%{-r:%{-r*}}" \
  if [ -z "$REX_RUN_DIR" ]; then \
    REX_RUN_DIR_BASE='%{__rex_run_dir}' \
  fi \
  mkdir -p $REX_RUN_DIR_BASE \
  REX_VERBOSITY="%{-v:%{-v*}}" \
  if [ -z "$REX_VERBOSITY" ]; then \
    REX_VERBOSITY='%{__rex_verbosity}' \
  fi \
  REX_MODULE_PATH="%{-m:%{-m*}}" \
  REX_BINARY_PATH="%{-b:%{-b*}}" \
  VERBOSITY=$REX_VERBOSITY RUN_DIR_BASE=$REX_RUN_DIR_BASE MODULE_PATH=$REX_MODULE_PATH BINARY_PATH=$REX_BINARY_PATH run-rex $EXAMPLE_DIRS | tee %{__rex_logfile} \
  %nil

#
# macro: core requires for apache-rex
#

%apache_rex_deps        \
BuildRequires: binutils \
BuildRequires: curl     \
BuildRequires: lsof     \
%nil