Amiga: only take the bundle version from an exact release tag

json-c tags releases on json-c-0.NN branches that are never merged back
to master, so `git describe --tags` from master finds the last release
tagged on master itself (0.17) and the readme claimed that version.
Use the tag only when HEAD is exactly on it, otherwise use the
JSON_C_VERSION from json_c_version.h plus the short commit hash.

Also terminate the sed `p` command with `;` before `}` so the version
extraction works with BSD/macOS sed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cameron Armstrong (Nightfox)andClaude Opus 5.5 authored and Eric Hawicz committed 2026-11-08 10:34:00 -05:00
1 parent 217808a23d
commit b48717e6d0
1 file changed
+7 -5
+7 -5
View File
@@ -34,14 +34,16 @@ rm -rf "$_lha_probe"
# OS gets staged under its own directory.
rm -rf "$DIST"; mkdir -p "$STAGE/json-c"
# Extract the version from either a release tag, or the dev version + abbreviated commit hash
GIT_DESCR=$(git describe --tags --always)
if [[ "$GIT_DESCR" == json-c-* ]] ; then
# Extract the version from either a release tag, or the dev version + abbreviated commit hash.
# Only use a tag when HEAD is exactly on it: release tags live on release
# branches, so the nearest *reachable* tag is often an old release.
GIT_TAG=$(git describe --tags --exact-match 2>/dev/null)
if [[ "$GIT_TAG" == json-c-* ]] ; then
# e.g. 0.19-20260627
JSON_C_VERS=${GIT_DESCR#json-c-}
JSON_C_VERS=${GIT_TAG#json-c-}
else
# e.g. 0.19.99-09e45f6
JSON_C_VERS=$(sed -ne'/define JSON_C_VERSION / { s/"$//; s/.*"//; p }' "${ROOT}/json_c_version.h")-${GIT_DESCR}
JSON_C_VERS=$(sed -ne'/define JSON_C_VERSION / { s/"$//; s/.*"//; p; }' "${ROOT}/json_c_version.h")-$(git rev-parse --short HEAD)
fi
sed -e"s/VERSION/${JSON_C_VERS}/" "$AMIGA_DIR/json-c.readme.template" > "$STAGE/json-c/json-c.readme"