mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-06-27 16:26:29 +02:00
[cmake] Update CPMUtil (#4123)
Notable changes - Single cpmfile - version/min_version/git_version have been fixed and replaced with version and min_version - Docs rewrite - Legacy options are gone - Fixed update/version commands - Added patch creation functionality Signed-off-by: crueter <crueter@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4123 Reviewed-by: Lizzie <lizzie@eden-emu.dev> Reviewed-by: MaranBr <maranbr@eden-emu.dev>
This commit is contained in:
parent
6bdb03d8ac
commit
c993bc01a4
35 changed files with 1500 additions and 1294 deletions
|
|
@ -63,8 +63,9 @@ done
|
|||
[ -n "$packages" ] || usage
|
||||
|
||||
for pkg in $packages; do
|
||||
PACKAGE="$pkg"
|
||||
export PACKAGE
|
||||
unset JSON
|
||||
export PACKAGE="$pkg"
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
. "$SCRIPTS"/vars.sh
|
||||
|
||||
|
|
@ -82,13 +83,14 @@ for pkg in $packages; do
|
|||
|
||||
echo "-- Package $PACKAGE"
|
||||
|
||||
# TODO(crueter): Support for Forgejo updates w/ forgejo_token
|
||||
# Use gh-cli to avoid ratelimits, if available
|
||||
# TODO(crueter): Support for forgejo_token?
|
||||
endpoint="/repos/$REPO/tags"
|
||||
if command -v gh >/dev/null 2>&1; then
|
||||
TAGS=$(gh api --method GET "$endpoint")
|
||||
else
|
||||
elif [ "$GIT_HOST" = github.com ]; then
|
||||
TAGS=$(curl -sfL "https://api.github.com$endpoint")
|
||||
else
|
||||
TAGS=$(curl -sfL "https://$GIT_HOST/api/v1$endpoint")
|
||||
fi
|
||||
|
||||
# filter out some commonly known annoyances
|
||||
|
|
@ -102,7 +104,6 @@ for pkg in $packages; do
|
|||
|
||||
filter_out yotta # mbedtls
|
||||
|
||||
# ????????????????????????????????
|
||||
filter_out vksc
|
||||
|
||||
# ignore betas/alphas (remove if needed)
|
||||
|
|
@ -110,15 +111,15 @@ for pkg in $packages; do
|
|||
filter_out beta
|
||||
filter_out rc
|
||||
|
||||
# openssl
|
||||
# Add package-specific overrides here, e.g. here for fmt:
|
||||
[ "$PACKAGE" != fmt ] || filter_out v0.11
|
||||
|
||||
# Or for OpenSSL:
|
||||
if [ "$PACKAGE" = openssl ]; then
|
||||
filter_out rsaref
|
||||
filter_in "openssl-"
|
||||
fi
|
||||
|
||||
# Add package-specific overrides here, e.g. here for fmt:
|
||||
[ "$PACKAGE" != fmt ] || filter_out v0.11
|
||||
|
||||
LATEST=$(echo "$TAGS" | jq -r '.[0].name')
|
||||
|
||||
if [ "$LATEST" = "null" ] ||
|
||||
|
|
@ -127,45 +128,47 @@ for pkg in $packages; do
|
|||
continue
|
||||
fi
|
||||
|
||||
# TODO: This is identical to version.sh
|
||||
|
||||
if [ "$HAS_REPLACE" = "true" ]; then
|
||||
# this just extracts the tag prefix
|
||||
VERSION_PREFIX=$(echo "$ORIGINAL_TAG" | cut -d"%" -f1)
|
||||
|
||||
# then we strip out the prefix from the new tag, and make that our new git_version
|
||||
# then we strip out the prefix from the new tag, and make that our new version
|
||||
if [ -z "$VERSION_PREFIX" ]; then
|
||||
NEW_GIT_VERSION="$LATEST"
|
||||
NEW_VERSION="$LATEST"
|
||||
else
|
||||
NEW_GIT_VERSION=$(echo "$LATEST" | sed "s/$VERSION_PREFIX//g")
|
||||
NEW_VERSION=$(echo "$LATEST" | sed "s/$VERSION_PREFIX//g")
|
||||
fi
|
||||
else
|
||||
NEW_GIT_VERSION="$LATEST"
|
||||
NEW_VERSION="$LATEST"
|
||||
fi
|
||||
|
||||
_commit="$_commit
|
||||
* $PACKAGE: $GIT_VERSION -> $NEW_GIT_VERSION"
|
||||
* $PACKAGE: $VERSION -> $NEW_VERSION"
|
||||
|
||||
echo "-- * Version $LATEST available, current is $TAG"
|
||||
|
||||
if [ "$UPDATE" = "true" ]; then
|
||||
if [ "$HAS_REPLACE" = "true" ]; then
|
||||
NEW_JSON=$(echo "$JSON" | jq ".git_version = \"$NEW_GIT_VERSION\"")
|
||||
JSON=$(echo "$JSON" | jq ".version = \"$NEW_VERSION\"")
|
||||
else
|
||||
NEW_JSON=$(echo "$JSON" | jq ".tag = \"$NEW_GIT_VERSION\"")
|
||||
JSON=$(echo "$JSON" | jq ".tag = \"$NEW_VERSION\"")
|
||||
fi
|
||||
|
||||
"$SCRIPTS"/util/replace.sh "$PACKAGE" "$NEW_JSON"
|
||||
|
||||
echo "-- * -- Updating hash"
|
||||
|
||||
export UPDATE
|
||||
QUIET=true "$SCRIPTS"/util/fix-hash.sh "$PACKAGE"
|
||||
# shellcheck disable=SC1091
|
||||
. "$SCRIPTS"/vars.sh
|
||||
HASH=$("$SCRIPTS"/util/url-hash.sh "$DOWNLOAD")
|
||||
JSON=$(echo "$JSON" | jq ".hash = \"$HASH\"")
|
||||
|
||||
"$SCRIPTS"/util/replace.sh "$PACKAGE" "$JSON"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$UPDATE" = "true" ] && [ "$COMMIT" = "true" ] && [ -n "$_commit" ]; then
|
||||
for file in $CPMFILES; do
|
||||
git add "$file"
|
||||
done
|
||||
git add "cpmfile.json"
|
||||
git commit -m "Update dependencies
|
||||
$_commit"
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue