From 82cdd057367b80fc515c78febc23b5fbb46df11a Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Sun, 18 Jun 2023 11:57:24 +0200 Subject: [PATCH] build: Add support for validating appdata versions This will avoid old dates from being mentioned in the appdata file, as happened in evince. This requires a version of appstream-util with the get-latest-version command: https://github.com/hughsie/appstream-glib/pull/468 See https://gitlab.gnome.org/GNOME/evince/-/issues/1950 --- check-news.sh | 25 +++++++++++++++++++++++++ meson.build | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/check-news.sh b/check-news.sh index e7e8fa6bb..24a2ea10b 100755 --- a/check-news.sh +++ b/check-news.sh @@ -63,6 +63,23 @@ check_version() esac } +has_verify_latest_version() +{ + appstream-util 2>&1 | grep -q get-latest-version + return $? +} + +verify_latest_version() +{ + VERSION=$1 + FILE=$SRC_ROOT/"$2" + LATEST_VERSION=`appstream-util get-latest-version "$FILE" | tr -d '\d'` + if [ "$LATEST_VERSION" != "$VERSION" ] ; then + echo "Expected latest version $VERSION in $FILE, got $LATEST_VERSION" + exit 1 + fi +} + SRC_ROOT=${MESON_DIST_ROOT:-"./"} if [ $# -lt 1 ] ; then usage ; fi @@ -76,6 +93,14 @@ if [ $# -eq 0 ] ; then fi for i in $@ ; do + case "$i" in + *"metainfo"*) + if has_verify_latest_version ; then + verify_latest_version $VERSION "$i" + fi + ;; + esac + check_version $VERSION "$i" done diff --git a/meson.build b/meson.build index de2217d7e..c0ab3d224 100644 --- a/meson.build +++ b/meson.build @@ -533,7 +533,7 @@ if is_stable find_program('check-news.sh').full_path(), '@0@'.format(meson.project_version()), 'NEWS', - 'org.gnome.Evince.appdata.xml.in' + 'org.gnome.Evince.metainfo.xml.in' ) else meson.add_dist_script(