Meta+Toolchain: Move check_sha256 to shell_include.sh

Pure code move, no behavior change.
This commit is contained in:
Nico Weber 2024-06-28 10:51:32 +02:00 committed by Daniel Bertalan
parent 046dbe27c4
commit c1c00f9104
2 changed files with 18 additions and 18 deletions

View file

@ -99,3 +99,21 @@ disk_usage() {
inode_usage() {
find "$1" | wc -l
}
check_sha256() {
if [ $# -ne 2 ]; then
error "Usage: check_sha256 FILE EXPECTED_HASH"
return 1
fi
FILE="${1}"
EXPECTED_HASH="${2}"
SYSTEM_NAME="$(uname -s)"
if [ "$SYSTEM_NAME" = "Darwin" ]; then
SEEN_HASH="$(shasum -a 256 "${FILE}" | cut -d " " -f 1)"
else
SEEN_HASH="$(sha256sum "${FILE}" | cut -d " " -f 1)"
fi
test "${EXPECTED_HASH}" = "${SEEN_HASH}"
}

View file

@ -17,24 +17,6 @@ TARBALLS_DIR="$DIR/Tarballs"
NPROC=$(get_number_of_processing_units)
[ -z "$MAKEJOBS" ] && MAKEJOBS=${NPROC}
check_sha256() {
if [ $# -ne 2 ]; then
error "Usage: check_sha256 FILE EXPECTED_HASH"
return 1
fi
FILE="${1}"
EXPECTED_HASH="${2}"
SYSTEM_NAME="$(uname -s)"
if [ "$SYSTEM_NAME" = "Darwin" ]; then
SEEN_HASH="$(shasum -a 256 "${FILE}" | cut -d " " -f 1)"
else
SEEN_HASH="$(sha256sum "${FILE}" | cut -d " " -f 1)"
fi
test "${EXPECTED_HASH}" = "${SEEN_HASH}"
}
# Note: Update this alongside the cmake port, and Meta/CMake/cmake-version.cmake if the build requires this version of cmake.
CMAKE_VERSION=3.26.4
CMAKE_ARCHIVE_SHA256=313b6880c291bd4fe31c0aa51d6e62659282a521e695f30d5cc0d25abbd5c208