summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorFrédéric Desbiens <[email protected]>2026-09-28 19:56:37 -0400
committerGitHub <[email protected]>2026-09-28 19:56:37 -0400
commit0a52df8f87d473c85b7f9631457fac54718bafd0 (patch)
treed4c2e2b4a4b72175c4a4b52b6965cff2aba26124 /scripts
parent80dfbe7797f4e03bb878f06b9557ddc4041cf212 (diff)
Stopped the version pass skipping ports in silence (#786)
The port stage matched a version only where "Version" was followed immediately by four dotted numbers. A port writing three numbers, or a stray letter before the first, was passed over and kept its old release, and the pass reported success either way. The RISC-V32/IAR port is one of them. It reads "Version G6.5.0.202601", and the letter in front of the number has kept it out of every pass since, so it has advertised 6.5.0.202601 across two releases it was not part of. Its string now reads the current release. The pattern accepts three or four numbers and tolerates a leading letter. A check follows it: any port header that names a release other than the one being prepared is listed and the pass stops, so a port the substitution cannot reach fails the release instead of shipping a version that misreports itself. Verified: every ThreadX port header now advertises 6.5.2.202603. Against a FileX tree, a port the substitution cannot reach makes the pass name the file and exit non-zero, and correcting that string lets the pass complete. Assisted-by: Claude Code (Opus 5) <[email protected]>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/prepare_release.sh31
1 files changed, 29 insertions, 2 deletions
diff --git a/scripts/prepare_release.sh b/scripts/prepare_release.sh
index 0c453667..02e3df83 100755
--- a/scripts/prepare_release.sh
+++ b/scripts/prepare_release.sh
@@ -159,15 +159,42 @@ PORT_FILES=$(printf "%s" "${PORT_FILES}" | grep -v '^[[:space:]]*$' || true)
if [ -z "${PORT_FILES}" ]; then
printf "Warning: No port header files found. Skipping port version string commit.\n"
else
+ # A port advertises its release in the string the library reports at run time.
+ # The pattern accepts three or four dotted numbers and tolerates a stray
+ # letter before the first one, so a port that writes its version slightly
+ # differently is still reached.
+ VERSION_RE='Version[[:space:]]+[A-Za-z]?[0-9]+(\.[0-9]+)+[a-z]*'
while IFS= read -r port_file; do
- if [ -n "${port_file}" ] && grep -qE "Version [0-9]" "${port_file}" 2>/dev/null; then
- sed -i -E "s/Version [0-9]+\.[0-9]+\.[0-9]+\.[0-9]+[a-z]*/Version ${VERSION}/g" "${port_file}"
+ if [ -n "${port_file}" ] && grep -qE "${VERSION_RE}" "${port_file}" 2>/dev/null; then
+ sed -i -E "s/${VERSION_RE}/Version ${VERSION}/g" "${port_file}"
printf " Updated: %s\n" "${port_file#${REPO_ROOT}/}"
fi
done <<EOF
${PORT_FILES}
EOF
+ # Every port header that names a release must now name this one. A port
+ # whose string is shaped in some other way is not rewritten above, and
+ # without this check the pass reports success while leaving that port
+ # advertising the previous release for the life of the version.
+ STALE=""
+ while IFS= read -r port_file; do
+ [ -n "${port_file}" ] || continue
+ advertised=$(grep -hoE '"[^"]*[0-9]+\.[0-9]+\.[0-9]+[^"]*"' "${port_file}" 2>/dev/null || true)
+ [ -n "${advertised}" ] || continue
+ if ! printf "%s" "${advertised}" | grep -qF "${VERSION}"; then
+ STALE="${STALE} ${port_file#${REPO_ROOT}/}
+"
+ fi
+ done <<EOF
+${PORT_FILES}
+EOF
+ if [ -n "${STALE}" ]; then
+ printf "\nError: these port headers still advertise another release:\n%s" "${STALE}" >&2
+ printf "Correct them so the substitution above reaches them, then re-run.\n" >&2
+ exit 1
+ fi
+
git -C "${REPO_ROOT}" add -u
if git -C "${REPO_ROOT}" diff --cached --quiet; then
printf "No port version string changes staged. Skipping commit.\n"