Skip to content

Commit

Permalink
build: Add support for validating appdata versions
Browse files Browse the repository at this point in the history
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:
hughsie/appstream-glib#468

See https://gitlab.gnome.org/GNOME/evince/-/issues/1950
  • Loading branch information
hadess authored and gpoo committed Jun 18, 2023
1 parent 3449031 commit 2ea8c9a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
25 changes: 25 additions & 0 deletions check-news.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,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(
Expand Down

0 comments on commit 2ea8c9a

Please sign in to comment.