rpmbuild: Simplify cmdline checks

Signed-off-by: Michal Berger <michal.berger@intel.com>
Change-Id: I7b7e4118e3573d3d1ad83a50d4a980bd69c8c0f4
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14480
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: <sebastian.brzezinka@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
This commit is contained in:
Michal Berger 2022-09-12 19:16:08 +02:00 committed by Tomasz Zawadzki
parent 307b8c112f
commit 3915135275

View File

@ -21,10 +21,11 @@ fi
get_config() {
# Intercept part of the ./configure's cmdline we are interested in
configure_opts=($(getopt -l "$1::" -o "" -- $configure 2> /dev/null))
# Drop "--"
configure_opts=("${configure_opts[@]::${#configure_opts[@]}-1}")
((${#configure_opts[@]} > 0)) || return 1
configure_opts=($(getopt -l "$1::" -o "" -- $configure 2> /dev/null)) || true
# If "--" is the first argument then either the cmdline is empty or doesn't
# match on what we are looking for. In either case simply return as there
# is nothing to check.
[[ ${configure_opts[0]} == "--" ]] && return 1
if [[ $2 == has-arg ]]; then
[[ -n ${configure_opts[1]} && ${configure_opts[1]} != "''" ]]