Avoid grep -q being always true if there is a trailing space

This commit is contained in:
Mikhail Novosyolov 2020-04-01 05:05:08 +03:00
parent f35ca17b1f
commit 050040fe56

View file

@ -15,7 +15,7 @@ NOCLANG_OPTFLAGS="${NOCLANG_OPTFLAGS:-}"
# set custom REMOVE_CFLAGS in %build or redefine %noclang_optflags # set custom REMOVE_CFLAGS in %build or redefine %noclang_optflags
REMOVE_CFLAGS="${REMOVE_CFLAGS:-}" REMOVE_CFLAGS="${REMOVE_CFLAGS:-}"
# convert flags list to regexp # convert flags list to regexp
REMOVE="$(echo "$NOCLANG_OPTFLAGS $REMOVE_CFLAGS" | sed -e 's, ,|,g')" REMOVE="$(echo "$NOCLANG_OPTFLAGS $REMOVE_CFLAGS" | sed -e 's, ,|,g' -e 's,|$,,g')"
# _CLANG_ must be changed to /usr/bin/clang++ and then to /usr/bin/clang in another copy of this wrapper # _CLANG_ must be changed to /usr/bin/clang++ and then to /usr/bin/clang in another copy of this wrapper
if echo "$@" | grep -qE -- "${REMOVE}" if echo "$@" | grep -qE -- "${REMOVE}"