appstream-glib
appstream-glib copied to clipboard
release ordering check does not seem to respect the date
I run flatpak run org.freedesktop.appstream-glib//stable validate on this file and it complains about the releases not being in order:
static/chat.delta.desktop.appdata.xml: FAILED:
? url-not-found : <screenshot> failed to download (HTTP 404: Not Found) [https://github.com/deltachat/deltachat-desktop/raw/master/screenshot.png]
? tag-invalid : <release> versions are not in order [0.105.0-pre2 before v0.103.0]
Validation of files failed
It seems it interprets too much into the "version" string rather than actually looking at the date.
Prefixing all versions with "v" makes it work better. But I am not aware of any requirements mentioned in the spec.
Is -pre2 a semver?
I have absolutely no idea. But here we are, in real life, with real appdata files.
I'm happy to report an issue upstream and fix the file up. What's the allowed syntax there? Should that syntax be referenced from the spec to persist that knowledge?
What's the allowed syntax there
I think a semver is probably the safe subset of what's supported everywhere.
So, AppStream/libappstream uses the same algorithm RPM uses for version comparisons, with very minor tweaks to also compare Debian version numbers as expected.
If I validate the original file as well as the file with your changes, there are no issues.
However, appstreamcli compare-versions 0.105.0-pre2 0.105.0 yields 0.105.0-pre2 >> 0.105.0, so you shouldn't use a dash to mark prerelases. A tilde will work though: 0.105.0~pre2 << 0.105.0. No "v" suffixes are needed.
So, as far as I'm concerned, if the dash is changed to a tilde, everything should be perfectly okay.