summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBilly Donahue <billy.donahue@mongodb.com>2018-06-15 13:12:46 -0400
committerBilly Donahue <billy.donahue@mongodb.com>2018-06-19 15:22:37 -0400
commit4e614564d032bc9133ac46319b588b4b62cee304 (patch)
tree7ae4e62c8cf8fec9ea374d01e26f22708957fc18
parentdcbb5b7700ba377003e88dd64fa5d4c0a294a5ba (diff)
downloadmongo-4e614564d032bc9133ac46319b588b4b62cee304.tar.gz
SERVER-35620 Use 'shasum -a 256' for tarball integrity.
Instead of using in-house Python. Refactor fetch_and_build_openssl.sh workaround for old shasum stdin bug
-rwxr-xr-x[-rw-r--r--]buildscripts/fetch_and_build_openssl.sh38
-rw-r--r--buildscripts/sha256sum.py14
2 files changed, 23 insertions, 29 deletions
diff --git a/buildscripts/fetch_and_build_openssl.sh b/buildscripts/fetch_and_build_openssl.sh
index 41780650d25..4b99db88943 100644..100755
--- a/buildscripts/fetch_and_build_openssl.sh
+++ b/buildscripts/fetch_and_build_openssl.sh
@@ -1,31 +1,39 @@
#!/bin/bash
set -o errexit
-set -o verbose
+#set -o verbose
if [ $# -ne 3 ]; then
- echo "Arguments: <python command> <make flags> <config flags>"
+ echo "Arguments: <python command> <make flags> <config flags>" >&2
exit 3
fi
-PYTHON=$1
-OPENSSL_MAKE_FLAGS=$2
-OPENSSL_CONFIG_FLAGS=$3
+PYTHON="$1" # not needed anymore
+OPENSSL_MAKE_FLAGS="$2"
+OPENSSL_CONFIG_FLAGS="$3"
OPENSSL_VERSION=1.1.0h
OPENSSL_NAME=openssl-${OPENSSL_VERSION}
OPENSSL_TARBALL=${OPENSSL_NAME}.tar.gz
+
+basedir="$(pwd)"
+
mkdir -p openssl
-curl -L -o openssl/${OPENSSL_TARBALL} https://s3.amazonaws.com/boxes.10gen.com/build/${OPENSSL_TARBALL}
-LOCAL_HASH="$(${PYTHON} buildscripts/sha256sum.py openssl/${OPENSSL_TARBALL})"
-echo ${LOCAL_HASH}
+pushd openssl
+curl -L -o ${OPENSSL_TARBALL} \
+ "https://s3.amazonaws.com/boxes.10gen.com/build/${OPENSSL_TARBALL}"
-if [ "$LOCAL_HASH" != "5835626cde9e99656585fc7aaa2302a73a7e1340bf8c14fd635a62c66802a517" ]
-then
- exit 3
-fi
+# To regenerate: shasum -a 256 -b $OPENSSL_TARBALL
+shasum -c /dev/fd/0 <<EOF || exit 3
+5835626cde9e99656585fc7aaa2302a73a7e1340bf8c14fd635a62c66802a517 *$OPENSSL_TARBALL
+EOF
+
+tar -xzf ${OPENSSL_TARBALL}
-cd openssl
-tar -xvzf ${OPENSSL_TARBALL} --strip-components 1
-./config no-shared --prefix=${PWD}/../openssl_install_dir ${OPENSSL_CONFIG_FLAGS}
+mkdir -p build
+pushd build
+../$OPENSSL_NAME/config no-shared --prefix="$basedir/openssl_install_dir" ${OPENSSL_CONFIG_FLAGS}
make ${OPENSSL_MAKE_FLAGS}
make install_sw
+popd # build
+
+popd # openssl
diff --git a/buildscripts/sha256sum.py b/buildscripts/sha256sum.py
deleted file mode 100644
index 90c2c06b768..00000000000
--- a/buildscripts/sha256sum.py
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/usr/bin/env python2
-"""
-Computes a SHA256 sum of a file.
-
-Accepts a file path, prints the hex encoded hash to stdout.
-"""
-
-from __future__ import print_function
-
-import sys
-from hashlib import sha256
-
-with open(sys.argv[1], 'rb') as fh:
- print(sha256(fh.read()).hexdigest())