From 9368c8abdd6da6410e3cae22f65dd3f44f0bc468 Mon Sep 17 00:00:00 2001 From: Jehan Date: Thu, 29 Aug 2024 20:54:11 +0200 Subject: [PATCH] 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. --- desktop/meson.build | 8 +++----- desktop/test-appdata.sh | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 5 deletions(-) create mode 100755 desktop/test-appdata.sh diff --git a/desktop/meson.build b/desktop/meson.build index bee2e93c48..a493d35f2f 100644 --- a/desktop/meson.build +++ b/desktop/meson.build @@ -45,13 +45,11 @@ if desktop_validate.found() endif if appstreamcli.found() - # TODO: should we use validate-strict when the last errors for a strict - # validation are fixed? test('appdata_file', - appstreamcli, - args: [ 'validate', appdatafile ], + find_program('test-appdata.sh', required: true, dirs: [meson.current_source_dir()]), env: [ - 'GIMP_TESTING_ABS_TOP_BUILDDIR=' + meson.project_build_root(), + 'GIMP_TESTING_BUILDDIR=' + meson.current_build_dir(), + 'GIMP_RELEASE=' + (release ? '1' : '0'), ], suite: 'desktop', ) diff --git a/desktop/test-appdata.sh b/desktop/test-appdata.sh new file mode 100755 index 0000000000..6a77a10f92 --- /dev/null +++ b/desktop/test-appdata.sh @@ -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