-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make all shell scripts nounset-clean, enable "strict mode" (#427)
* Enable stricter shell options everywhere * Move 'create packages and repos' to its own script * Use Bash instead of sh * Update README for new script
- Loading branch information
1 parent
c107fc6
commit 867b979
Showing
13 changed files
with
124 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,7 @@ | |
# static analyzer. | ||
# | ||
|
||
set -o xtrace | ||
set -o errexit | ||
set -euxo pipefail | ||
|
||
echo "Begin compile process" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#!/bin/bash | ||
|
||
set -euxo pipefail | ||
|
||
: "${WORKDIR:="$PWD"}" | ||
|
||
# Generate an error if these are unset: | ||
: "$PACKAGER_DISTRO" "$PACKAGER_ARCH" | ||
|
||
. "$WORKDIR/libmongocrypt/.evergreen/setup-env.sh" | ||
|
||
|
||
if [ "$OS" = "Windows_NT" ]; then | ||
CMAKE="/cygdrive/c/cmake/bin/cmake" | ||
else | ||
IGNORE_SYSTEM_CMAKE=1 . "$WORKDIR/libmongocrypt/.evergreen/find-cmake.sh" | ||
fi | ||
|
||
# Get current version of libmongocrypt. | ||
pushd "$WORKDIR/libmongocrypt" | ||
mongocrypt_version="$("$CMAKE" -DRELEASE_BRANCH_REF=origin/r1.5 -P ./cmake/GetVersion.cmake 2>&1)" | ||
popd | ||
|
||
if ! "${HAS_PACKAGES:-false}"; then | ||
echo "'HAS_PACKAGES' is not 'true': Skipping package build" | ||
exit 0 | ||
fi | ||
|
||
if test -d "$WORKDIR/venv"; then | ||
if test "$OS" = "Windows_NT"; then | ||
# Need to quote the path on Windows to preserve the separator. | ||
. "$WORKDIR/venv/Scripts/activate" 2> /tmp/activate_error.log | ||
else | ||
. "$WORKDIR/venv/bin/activate" 2> /tmp/activate_error.log | ||
fi | ||
if test $? -ne 0; then | ||
echo "Failed to activate virtualenv: $(cat /tmp/activate_error.log)" | ||
fi | ||
python=python | ||
else | ||
python="${PYTHON:-/opt/mongodbtoolchain/v3/bin/python3}" | ||
fi | ||
|
||
export PYTHONPATH | ||
: "${PYTHONPATH:=}" | ||
if test "$OS" = "Windows_NT"; then | ||
PYTHONPATH="$PYTHONPATH;$(cygpath -w "$WORKDIR/src")" | ||
else | ||
PYTHONPATH="$PYTHONPATH:$WORKDIR/src" | ||
fi | ||
|
||
PPA_BUILD_ONLY=1 ./libmongocrypt/.evergreen/build_all.sh | ||
pkg_version=$mongocrypt_version | ||
tar -zcv -C install \ | ||
--transform="s|^libmongocrypt/|libmongocrypt-$pkg_version/|" \ | ||
--exclude=nocrypto \ | ||
--exclude=sharedbson \ | ||
-f "libmongocrypt-$pkg_version.tar.gz" \ | ||
libmongocrypt | ||
pushd libmongocrypt/etc/ | ||
# The files from libmongocrypt/debian/ are the official maintainer scripts, | ||
# but libmongocrypt/etc/debian/ contains a few custom scripts that are | ||
# meant to support the packager.py workflow. This step "fills in" around | ||
# those custom scripts. | ||
cp -nr ../debian/* debian/ | ||
command "$python" ./packager.py \ | ||
--prefix "$WORKDIR/libmongocrypt" \ | ||
--distros "$PACKAGER_DISTRO" \ | ||
--tarball "$WORKDIR/libmongocrypt-$pkg_version.tar.gz" \ | ||
--library-version "$pkg_version" \ | ||
--metadata-gitspec HEAD \ | ||
--arches "$PACKAGER_ARCH" | ||
popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters