Skip to content

Commit 64aebf4

Browse files
committed
build-script: use more terse checks
This uses the bash extension of regex based comparison rather than the more portable shell approach which is a bit more terse.
1 parent 3322f6d commit 64aebf4

File tree

1 file changed

+13
-28
lines changed

1 file changed

+13
-28
lines changed

utils/build-script-impl

Lines changed: 13 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -854,34 +854,19 @@ if [[ "${SKIP_RECONFIGURE}" ]]; then
854854
RECONFIGURE=""
855855
fi
856856

857-
# WORKSPACE, BUILD_DIR and INSTALLABLE_PACKAGE must be absolute paths
858-
case "${WORKSPACE}" in
859-
/*) ;;
860-
*)
861-
echo "workspace must be an absolute path (was '${WORKSPACE}')"
862-
exit 1
863-
;;
864-
esac
865-
case "${BUILD_DIR}" in
866-
/*) ;;
867-
"")
868-
echo "the --build-dir option is required"
869-
usage
870-
exit 1
871-
;;
872-
*)
873-
echo "build-dir must be an absolute path (was '${BUILD_DIR}')"
874-
exit 1
875-
;;
876-
esac
877-
case "${INSTALLABLE_PACKAGE}" in
878-
/*) ;;
879-
"") ;;
880-
*)
881-
echo "installable-package must be an absolute path (was '${INSTALLABLE_PACKAGE}')"
882-
exit 1
883-
;;
884-
esac
857+
# WORKSPACE, BUILD_DIR, and INSTALLABLE_PACKAGE must be absolute paths
858+
if ! [[ ${WORKSPACE} =~ ^/ ]] ; then
859+
echo "workspace must be an absolute path (was '${WORKSPACE}')"
860+
exit 1
861+
fi
862+
if ! [[ ${BUILD_DIR} =~ ^/ ]] ; then
863+
echo "build-dir must be an absolute path (was '${BUILD_DIR}')"
864+
exit 1
865+
fi
866+
if ! [[ ${INSTALLABLE_PACKAGE:-/} =~ ^/ ]] ; then
867+
echo "installable-package must be an absolute path (was '${INSTALLABLE_PACKAGE}')"
868+
exit 1
869+
fi
885870

886871
# WORKSPACE must exist
887872
if [ ! -e "${WORKSPACE}" ] ; then

0 commit comments

Comments
 (0)