-
Notifications
You must be signed in to change notification settings - Fork 29.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tools: log and check shasum of archive file #48088
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,11 +20,17 @@ download() { | |
echo "Making temporary workspace..." | ||
WORKSPACE=$(mktemp -d 2> /dev/null || mktemp -d -t 'tmp') | ||
|
||
# shellcheck disable=SC1091 | ||
. "$BASE_DIR/tools/dep_updaters/utils.sh" | ||
|
||
cd "$WORKSPACE" | ||
|
||
echo "Fetching OpenSSL source archive..." | ||
curl -sL "https://api.github.com/repos/quictls/openssl/tarball/openssl-$OPENSSL_VERSION" | tar xzf - | ||
OPENSSL_TARBALL="openssl-v$OPENSSL_VERSION.tar.gz" | ||
curl -sL -o "$OPENSSL_TARBALL" "https://api.github.com/repos/quictls/openssl/tarball/openssl-$OPENSSL_VERSION" | ||
log_and_verify_sha256sum "openssl" "$OPENSSL_TARBALL" | ||
gzip -dc "$OPENSSL_TARBALL" | tar xf - | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Out of curiosity, why the explicit There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's more portable. Some non-GNU versions of tar (e.g. on AIX) do not support There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see. I assumed these would only have to work under |
||
rm "$OPENSSL_TARBALL" | ||
mv quictls-openssl-* openssl | ||
|
||
echo "Replacing existing OpenSSL..." | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/sh | ||
|
||
# This function logs the archive checksum and, if provided, compares it with | ||
# the deposited checksum | ||
# | ||
# $1 is the package name e.g. 'acorn', 'ada', 'base64' etc. See that file | ||
# for a complete list of package name | ||
# $2 is the downloaded archive | ||
# $3 (optional) is the deposited sha256 cheksum. When provided, it is checked | ||
# against the checksum generated from the archive | ||
log_and_verify_sha256sum() { | ||
package_name="$1" | ||
archive="$2" | ||
checksum="$3" | ||
bsd_formatted_checksum=$(sha256sum --tag "$archive") | ||
if [ -z "$3" ]; then | ||
echo "$bsd_formatted_checksum" | ||
else | ||
archive_checksum=$(sha256sum "$archive") | ||
if [ "$checksum" = "$archive_checksum" ]; then | ||
echo "Valid $package_name checksum" | ||
echo "$bsd_formatted_checksum" | ||
else | ||
echo "ERROR - Invalid $package_name checksum:" | ||
echo "deposited: $checksum" | ||
echo "generated: $archive_checksum" | ||
exit 1 | ||
fi | ||
fi | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this change? It doesnt seem related to the PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency with the other deps that logs the checksum in the format
SHA256 (packagename-v1.0.0.zip) = abc123
for e.g.SHA256 (ada-v2.4.2.zip) = 1c1d96f27307b6f7bd21af87d10d528207f44e904f77a550837037e9def06607