diff options
| author | crueter <crueter@eden-emu.dev> | 2025-10-05 03:04:53 +0200 |
|---|---|---|
| committer | crueter <crueter@eden-emu.dev> | 2025-10-05 03:04:53 +0200 |
| commit | 9f385bf627e40e2b7d5b06cd83cab0a4e9f98f99 (patch) | |
| tree | a9146b701ca51c941197fe60f90b691ecf60506c /tools/cpm/check-hash.sh | |
| parent | 1a13e79c3d8619ff302d9c77eacf1a35c2210b66 (diff) | |
[tools, cmake] refactor: update/hash check scripts, use tags for some more deps, proper CPMUtil separation (#2666)
Uses tags for a bunch of deps that can use them
Also adds a bunmch of scripts to tools/cpm, notably for checking hashes
and checking for updates.
TODO for the future:
- CI target to check hashes
- Weekly CI to check for updates
Need to get that other CI runner up
additional stuff
- Ports gentoo fixes
- makes solaris work (TODO: sdl2)
- way better docs
- properly separates CPMUtil as a standalone project
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2666
Reviewed-by: Lizzie <lizzie@eden-emu.dev>
Reviewed-by: MaranBr <maranbr@eden-emu.dev>
Diffstat (limited to 'tools/cpm/check-hash.sh')
| -rwxr-xr-x | tools/cpm/check-hash.sh | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/tools/cpm/check-hash.sh b/tools/cpm/check-hash.sh new file mode 100755 index 0000000000..85c60aad8c --- /dev/null +++ b/tools/cpm/check-hash.sh @@ -0,0 +1,46 @@ +#!/bin/sh -e + +# SPDX-FileCopyrightText: 2025 crueter +# SPDX-License-Identifier: GPL-3.0-or-later + +# env vars: +# - UPDATE: fix hashes if needed + +# shellcheck disable=SC1091 +. tools/cpm/common.sh + +RETURN=0 + +for PACKAGE in "$@" +do + export PACKAGE + # shellcheck disable=SC1091 + . tools/cpm/package.sh + + if [ "$CI" != null ]; then + continue + fi + + [ "$HASH_URL" != null ] && continue + [ "$HASH_SUFFIX" != null ] && continue + + echo "-- Package $PACKAGE" + + [ "$HASH" = null ] && echo "-- * Warning: no hash specified" && continue + + export USE_TAG=true + ACTUAL=$(tools/cpm/url-hash.sh "$DOWNLOAD") + + # shellcheck disable=SC2028 + [ "$ACTUAL" != "$HASH" ] && echo "-- * Expected $HASH" && echo "-- * Got $ACTUAL" && [ "$UPDATE" != "true" ] && RETURN=1 + + if [ "$UPDATE" = "true" ] && [ "$ACTUAL" != "$HASH" ]; then + # shellcheck disable=SC2034 + NEW_JSON=$(echo "$JSON" | jq ".hash = \"$ACTUAL\"") + export NEW_JSON + + tools/cpm/replace.sh + fi +done + +exit $RETURN
\ No newline at end of file |
