desktop: fix AppStream validation with TODO release date.

As I recall, this is something we in fact used to have in gimp-2-10
branch and which we lost when switching from appstream-util to
appstreamcli validation tool (the later is now recommended, but it's
also less featureful, they don't even have a relax test!). So that was a
regression in the build system.

Note that it's not just not to have to put a date too early in our
AppStream metadata, but it's also that this way, we won't forget to
update it upon release (hence shipping with a wrong release data in
metadata). Indeed, when building a non-release version, date="TODO" will
pass the test, yet moving on to a point release version, the validation
test will now fail on a TODO date.
This commit is contained in:
Jehan 2024-08-29 20:54:11 +02:00
parent 6a465876ec
commit 9368c8abdd
2 changed files with 17 additions and 5 deletions

View File

@ -45,13 +45,11 @@ if desktop_validate.found()
endif endif
if appstreamcli.found() if appstreamcli.found()
# TODO: should we use validate-strict when the last errors for a strict
# validation are fixed?
test('appdata_file', test('appdata_file',
appstreamcli, find_program('test-appdata.sh', required: true, dirs: [meson.current_source_dir()]),
args: [ 'validate', appdatafile ],
env: [ env: [
'GIMP_TESTING_ABS_TOP_BUILDDIR=' + meson.project_build_root(), 'GIMP_TESTING_BUILDDIR=' + meson.current_build_dir(),
'GIMP_RELEASE=' + (release ? '1' : '0'),
], ],
suite: 'desktop', suite: 'desktop',
) )

14
desktop/test-appdata.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/sh
cd $GIMP_TESTING_BUILDDIR
if [ $GIMP_RELEASE -eq 1 ]; then
appstreamcli validate org.gimp.GIMP.appdata.xml
exit $?
else
APPDATA=`mktemp org.gimp.GIMP.appdata.XXX.xml`
sed "s/date=\"TODO\"/date=\"`date --iso-8601`\"/" org.gimp.GIMP.appdata.xml > $APPDATA
appstreamcli validate $APPDATA
success=$?
rm $APPDATA
exit $success
fi