On Wed, 2020-02-12 at 23:39 -0800, Georgy Yakovlev wrote:
> this will warn if package installs xml files to /usr/share/appdata
> this location is deprecated, files should be installed to
> /usr/share/metainfo
> 
> https://www.freedesktop.org/software/appstream/docs/chap-Metadata.html
> 
> Signed-off-by: Georgy Yakovlev <[email protected]>
> ---
>  metadata/install-qa-check.d/60appdata-path | 33 ++++++++++++++++++++++
>  1 file changed, 33 insertions(+)
>  create mode 100644 metadata/install-qa-check.d/60appdata-path
> 
> diff --git a/metadata/install-qa-check.d/60appdata-path 
> b/metadata/install-qa-check.d/60appdata-path
> new file mode 100644
> index 00000000000..c4878949b0e
> --- /dev/null
> +++ b/metadata/install-qa-check.d/60appdata-path
> @@ -0,0 +1,33 @@
> +# Copyright 2020 Gentoo Authors
> +# Distributed under the terms of the GNU General Public License v2
> +
> +# QA check: ensure that metadata files are installed in /usr/share/metainfo
> +# Maintainer: Georgy Yakovlev <[email protected]>
> +
> +appdata_path_check() {
> +     [[ -d ${ED%/}/usr/share/appdata ]] || return
> +
> +     local found=() f
> +     while read -d '' -r f; do
> +             found+=( "${f%/*}" )
> +     done < <(find "${ED%/}/usr/share/appdata" -name '*.xml' -print0 || die)
> +
> +     if [[ ${found[@]} ]]; then
> +             eqawarn
> +             eqawarn "This package seems to install metainfo files into the 
> following"
> +             eqawarn "location(s):"
> +             eqawarn
> +             eqatag -v appdata.invalid-path "${found[@]#${D%/}}"
> +             eqawarn
> +             eqawarn "This location is deprecated, it should not be used 
> anymore by new software"
> +             eqawarn "Appdata/Metainfo files should be installed into 
> /usr/share/metainfo directory"
> +             eqawarn "For more details, please see the freedesktop Upstrem 
> Metadate guidelines"
> +             eqawarn 
> "https://www.freedesktop.org/software/appstream/docs/chap-Metadata.html";
> +             eqawarn
> +     fi
> +}
> +
> +appdata_path_check
> +: # guarantee successful exit
> +
> +# vim:ft=sh

LGTM on principle.

I'm wondering if we shouldn't create some kind of united 'deprecated
path' check to avoid repeating the boilerplate.  But that's just
a thought, not asking you to block this on it.

-- 
Best regards,
Michał Górny

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to