contrib/rpm: fix handling of --with test default

Seems rpmbuild does not honor the latest occurance with

  --with test --without test

to disable tests. Work around that.

Fixes: ad850c4f03
(cherry picked from commit cc8c207120)
This commit is contained in:
Thomas Haller 2018-09-14 14:22:06 +02:00
parent fd2e8179d3
commit d1fecaa2d3

View file

@ -41,10 +41,12 @@ IGNORE_DIRTY=0
GIT_CLEAN=0
QUICK=0
NO_DIST=0
WITH_LIST=(--with test)
WITH_LIST=()
SOURCE_FROM_GIT=0
SNAPSHOT="$NM_BUILD_SNAPSHOT"
ADD_WITH_TEST=1
NARGS=$#
while [[ $# -gt 0 ]]; do
@ -90,11 +92,17 @@ while [[ $# -gt 0 ]]; do
-w|--with)
[[ $# -gt 0 ]] || die "Missing argument to $A"
WITH_LIST=("${WITH_LIST[@]}" "--with" "$1")
if [[ "$1" == test ]]; then
ADD_WITH_TEST=0
fi
shift
;;
-W|--without)
[[ $# -gt 0 ]] || die "Missing argument to $A"
WITH_LIST=("${WITH_LIST[@]}" "--without" "$1")
if [[ "$1" == test ]]; then
ADD_WITH_TEST=0
fi
shift
;;
*)
@ -157,6 +165,10 @@ if [[ $NO_DIST != 1 ]]; then
fi
fi
if [[ "$ADD_WITH_TEST" == 1 ]]; then
WITH_LIST=("${WITH_LIST[@]}" "--with" "test")
fi
export SOURCE_FROM_GIT
export BUILDTYPE
export NM_RPMBUILD_ARGS="${WITH_LIST[@]}"