mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-10-05 05:37:10 +00:00
[cmake, tools, docs] Update CPMUtil (#2790)
updates CPMUtil to [`8f9b39fc98`](https://git.crueter.xyz/CMake/CPMUtil/commit/8f9b39fc980fc7079c7c4471c19f219180abe368) Makes the tooling/docs better and enforces usage of tar.gz everywhere as opposed to zips Signed-off-by: crueter <crueter@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2790 Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Reviewed-by: MaranBr <maranbr@eden-emu.dev>
This commit is contained in:
+43
-10
@@ -3,18 +3,49 @@
|
||||
# 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
|
||||
usage() {
|
||||
cat << EOF
|
||||
Usage: $0 [uf] [PACKAGE]...
|
||||
Check the hash of a specific package or packages.
|
||||
If a hash mismatch occurs, this script will print the corrected hash of the package.
|
||||
|
||||
Options:
|
||||
-u, --update Correct the package's hash if it's a mismatch
|
||||
|
||||
-f, --force Update the package's hash anyways (implies -u)
|
||||
|
||||
Note that this procedure will usually take a long time
|
||||
depending on the number and size of dependencies.
|
||||
|
||||
This project has defined the following as valid cpmfiles:
|
||||
EOF
|
||||
|
||||
for file in $CPMFILES; do
|
||||
echo "- $file"
|
||||
done
|
||||
|
||||
exit $RETURN
|
||||
}
|
||||
|
||||
while true; do
|
||||
case "$1" in
|
||||
(-uf|-f|--force) UPDATE=true; FORCE=true; shift; continue ;;
|
||||
(-u|--update) UPDATE=true; shift; continue ;;
|
||||
(-h) usage ;;
|
||||
("$0") break ;;
|
||||
("") break ;;
|
||||
esac
|
||||
|
||||
PACKAGE="$1"
|
||||
|
||||
shift
|
||||
|
||||
export PACKAGE
|
||||
# shellcheck disable=SC1091
|
||||
. tools/cpm/package.sh
|
||||
|
||||
if [ "$CI" != null ]; then
|
||||
@@ -31,11 +62,13 @@ do
|
||||
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 [ "$ACTUAL" != "$HASH" ]; then
|
||||
echo "-- * Expected $HASH"
|
||||
echo "-- * Got $ACTUAL"
|
||||
[ "$UPDATE" != "true" ] && RETURN=1
|
||||
fi
|
||||
|
||||
if [ "$UPDATE" = "true" ] && [ "$ACTUAL" != "$HASH" ]; then
|
||||
# shellcheck disable=SC2034
|
||||
if { [ "$UPDATE" = "true" ] && [ "$ACTUAL" != "$HASH" ]; } || [ "$FORCE" = "true" ]; then
|
||||
NEW_JSON=$(echo "$JSON" | jq ".hash = \"$ACTUAL\"")
|
||||
export NEW_JSON
|
||||
|
||||
|
||||
Reference in New Issue
Block a user