Skip to content

Fix update-metainfo-version.sh flattening the AppStream release history - #13896

Merged
niksedk merged 1 commit into
mainfrom
claude/fix-metainfo-version-script
Aug 20, 2026
Merged

Fix update-metainfo-version.sh flattening the AppStream release history#13896
niksedk merged 1 commit into
mainfrom
claude/fix-metainfo-version-script

Conversation

@niksedk

@niksedk niksedk commented Aug 20, 2026

Copy link
Copy Markdown
Member

The bug

The sed in update-metainfo-version.sh had no line anchor, so it applied to every line carrying a <release …> opening tag — rewriting the whole release history to the version being built, not just the newest entry. Running it against the current metainfo:

77:    <release version="5.2.0-beta19" date="2026-08-20">
83:    <release version="5.2.0-beta19" date="2026-08-20">

Both entries, identical. 5.0.0 and 5.0.0-beta9 gone from the history a software centre shows.

It has been harmless so far only by luck: the two callers (build-flatpak.yml, build-ui.yml) run it on a disposable CI checkout for the CI flatpak bundle, and that result is never committed. The first release-prep PR to run it would have lost the history for real.

The fix

  • Entry for this version already present → refresh only its date. Re-running is a no-op.
  • Not present → insert a new entry at the top of <releases>, older entries untouched.
  • Pre-release versions (anything with a -) get type="development" so they aren't offered as the newest stable.
  • awk rather than sed: the insert is multi-line, and awk behaves identically on GNU and BSD without the -i portability dance.
  • Bails out rather than writing if the entry didn't make it into the output, or if there's no <releases> element at all.

Plus a guard for stable releases

A Flathub build installs the metainfo from the pinned tag's checkout, so the entry has to be committed before the tag is cut. v5.1.0 was tagged without it, which is why the manifest we just re-pinned to it advertises 5.0.0 as its newest release.

New --check mode, wired into a verify-metainfo-release-entry job. It has no needs, so a stable dispatch missing the entry fails in seconds instead of after the full build matrix, and create-release now depends on it so the release can't get out either way. is_prerelease=true dispatches skip the requirement, so beta flow is unchanged.

Verified

Against a copy of the real metainfo: insert, re-run idempotency, stable vs pre-release attr, older entries left alone, --check failing then passing, and xmllint clean after each write.

Refs #11800.

🤖 Generated with Claude Code

The sed in this script had no line anchor, so it rewrote *every*
<release> element in the metainfo to the version and date being built,
not just the newest one. Running it against the current file turned both
entries into duplicates of 5.2.0-beta19, erasing 5.0.0 and 5.0.0-beta9
from the AppStream history a software centre shows.

It survived unnoticed because the only callers run it on a disposable CI
checkout for the CI flatpak bundle, and that result is never committed.
The moment a release-prep PR ran it, the history would have gone.

Now it inserts a new entry at the top of <releases>, keeping the older
ones, or refreshes just the date if an entry for that version already
exists, so re-running is a no-op. Pre-release versions get
type="development" so they are not offered as the newest stable. awk
rather than sed: the insert is multi-line and awk behaves the same on
GNU and BSD.

Also adds a --check mode and a verify-metainfo-release-entry job to the
release workflow. A Flathub build installs the metainfo from the pinned
tag's checkout, so the entry has to exist *before* the tag is cut -
v5.1.0 was tagged without it and advertises 5.0.0 as its newest release.
The job is cheap and has no needs, so a stable dispatch missing the entry
fails in seconds rather than after the full build matrix, and
create-release depends on it so the release cannot get out regardless.
Pre-release dispatches skip the requirement.

Co-Authored-By: Claude Opus 5 <[email protected]>
@niksedk
niksedk merged commit 2de46e5 into main Aug 20, 2026
1 check passed
@niksedk
niksedk deleted the claude/fix-metainfo-version-script branch August 20, 2026 05:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant