Skip to content

Commit

Permalink
cmake: improve external project error traces
Browse files Browse the repository at this point in the history
In case of mismatched download MD5 checksum.
  • Loading branch information
benoit-pierre committed Oct 4, 2024
1 parent 8d66e37 commit 8bc76ac
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions thirdparty/cmake_modules/koenv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,19 @@ run() {
"$@"
}

validate_md5() {
[ -r "$1" ] && md5sum -c <<EOF
$2 $1
EOF
}
validate_md5() { (
[ $# -ge 2 ] || return 1
file="$1"
md5="$2"
shift 2
[ -r "${file}" ] || return 1
calculated="$(md5sum "${file}")"
calculated="${calculated%% *}"
if [ "${calculated}" != "${md5}" ]; then
err "computed checksum did NOT match: ${file}, expected ${md5}, calculated ${calculated}"
return 1
fi
); }

download_archive() { (
[ $# -ge 3 ] || return 1
Expand Down

0 comments on commit 8bc76ac

Please sign in to comment.