Problem: dpkg-query might fail in CI build and fail the build

Solution: rework the bash test to avoid build failures as intended
and make it an easier one-liner
This commit is contained in:
Luca Boccassi 2016-12-27 14:45:45 +01:00
parent b2a2bb8609
commit bbae5d0f9a
4 changed files with 8 additions and 40 deletions

View File

@ -23,16 +23,8 @@ if [ -z $CURVE ]; then
elif [ $CURVE == "libsodium" ]; then
CMAKE_OPTS+=("-DWITH_LIBSODIUM=ON")
if command -v dpkg-query >/dev/null 2>&1; then
dpkg-query --list libsodium-dev >/dev/null 2>&1
HAVE_SODIUM=$?
elif command -v brew >/dev/null 2>&1; then
brew ls --versions libsodium >/dev/null 2>&1
HAVE_SODIUM=$?
else
HAVE_SODIUM=1
fi
if [ $HAVE_SODIUM -ne 0 ]; then
if ! ((command -v dpkg-query >/dev/null 2>&1 && dpkg-query --list libsodium-dev >/dev/null 2>&1) || \
(command -v brew >/dev/null 2>&1 && brew ls --versions libsodium >/dev/null 2>&1)); then
git clone --depth 1 -b stable git://github.com/jedisct1/libsodium.git
( cd libsodium; ./autogen.sh; ./configure --prefix=$BUILD_PREFIX; make check; make install)
fi

View File

@ -19,16 +19,8 @@ if [ -z $CURVE ]; then
elif [ $CURVE == "libsodium" ]; then
CMAKE_OPTS+=("-DWITH_LIBSODIUM=ON")
if command -v dpkg-query >/dev/null 2>&1; then
dpkg-query --list libsodium-dev >/dev/null 2>&1
HAVE_SODIUM=$?
elif command -v brew >/dev/null 2>&1; then
brew ls --versions libsodium >/dev/null 2>&1
HAVE_SODIUM=$?
else
HAVE_SODIUM=1
fi
if [ $HAVE_SODIUM -ne 0 ]; then
if ! ((command -v dpkg-query >/dev/null 2>&1 && dpkg-query --list libsodium-dev >/dev/null 2>&1) || \
(command -v brew >/dev/null 2>&1 && brew ls --versions libsodium >/dev/null 2>&1)); then
git clone --depth 1 -b stable git://github.com/jedisct1/libsodium.git
( cd libsodium; ./autogen.sh; ./configure --prefix=$BUILD_PREFIX; make check; make install)
fi

View File

@ -19,16 +19,8 @@ if [ -z $CURVE ]; then
elif [ $CURVE == "libsodium" ]; then
CONFIG_OPTS+=("--with-libsodium=yes")
if command -v dpkg-query >/dev/null 2>&1; then
dpkg-query --list libsodium-dev >/dev/null 2>&1
HAVE_SODIUM=$?
elif command -v brew >/dev/null 2>&1; then
brew ls --versions libsodium >/dev/null 2>&1
HAVE_SODIUM=$?
else
HAVE_SODIUM=1
fi
if [ $HAVE_SODIUM -ne 0 ]; then
if ! ((command -v dpkg-query >/dev/null 2>&1 && dpkg-query --list libsodium-dev >/dev/null 2>&1) || \
(command -v brew >/dev/null 2>&1 && brew ls --versions libsodium >/dev/null 2>&1)); then
git clone --depth 1 -b stable git://github.com/jedisct1/libsodium.git
( cd libsodium; ./autogen.sh; ./configure --prefix=$BUILD_PREFIX; make check; make install)
fi

View File

@ -20,16 +20,8 @@ if [ $BUILD_TYPE == "default" ]; then
elif [ $CURVE == "libsodium" ]; then
CONFIG_OPTS+=("--with-libsodium=yes")
if command -v dpkg-query >/dev/null 2>&1; then
dpkg-query --list libsodium-dev >/dev/null 2>&1
HAVE_SODIUM=$?
elif command -v brew >/dev/null 2>&1; then
brew ls --versions libsodium >/dev/null 2>&1
HAVE_SODIUM=$?
else
HAVE_SODIUM=1
fi
if [ $HAVE_SODIUM -ne 0 ]; then
if ! ((command -v dpkg-query >/dev/null 2>&1 && dpkg-query --list libsodium-dev >/dev/null 2>&1) || \
(command -v brew >/dev/null 2>&1 && brew ls --versions libsodium >/dev/null 2>&1)); then
git clone --depth 1 -b stable git://github.com/jedisct1/libsodium.git
( cd libsodium; ./autogen.sh; ./configure --prefix=$BUILD_PREFIX; make check; make install)
fi