Gentoo Archives: gentoo-dev

From: Georgy Yakovlev <gyakovlev@g.o>
To: gentoo-dev@l.g.o
Cc: Georgy Yakovlev <gyakovlev@g.o>
Subject: [gentoo-dev] [PATCH] metadata/install-qa-check.d/60appdata-path: new check
Date: Thu, 13 Feb 2020 07:39:48
Message-Id: 20200213073911.99704-1-gyakovlev@gentoo.org
1 this will warn if package installs xml files to /usr/share/appdata
2 this location is deprecated, files should be installed to
3 /usr/share/metainfo
4
5 https://www.freedesktop.org/software/appstream/docs/chap-Metadata.html
6
7 Signed-off-by: Georgy Yakovlev <gyakovlev@g.o>
8 ---
9 metadata/install-qa-check.d/60appdata-path | 33 ++++++++++++++++++++++
10 1 file changed, 33 insertions(+)
11 create mode 100644 metadata/install-qa-check.d/60appdata-path
12
13 diff --git a/metadata/install-qa-check.d/60appdata-path b/metadata/install-qa-check.d/60appdata-path
14 new file mode 100644
15 index 00000000000..c4878949b0e
16 --- /dev/null
17 +++ b/metadata/install-qa-check.d/60appdata-path
18 @@ -0,0 +1,33 @@
19 +# Copyright 2020 Gentoo Authors
20 +# Distributed under the terms of the GNU General Public License v2
21 +
22 +# QA check: ensure that metadata files are installed in /usr/share/metainfo
23 +# Maintainer: Georgy Yakovlev <gyakovlev@g.o>
24 +
25 +appdata_path_check() {
26 + [[ -d ${ED%/}/usr/share/appdata ]] || return
27 +
28 + local found=() f
29 + while read -d '' -r f; do
30 + found+=( "${f%/*}" )
31 + done < <(find "${ED%/}/usr/share/appdata" -name '*.xml' -print0 || die)
32 +
33 + if [[ ${found[@]} ]]; then
34 + eqawarn
35 + eqawarn "This package seems to install metainfo files into the following"
36 + eqawarn "location(s):"
37 + eqawarn
38 + eqatag -v appdata.invalid-path "${found[@]#${D%/}}"
39 + eqawarn
40 + eqawarn "This location is deprecated, it should not be used anymore by new software"
41 + eqawarn "Appdata/Metainfo files should be installed into /usr/share/metainfo directory"
42 + eqawarn "For more details, please see the freedesktop Upstrem Metadate guidelines"
43 + eqawarn "https://www.freedesktop.org/software/appstream/docs/chap-Metadata.html"
44 + eqawarn
45 + fi
46 +}
47 +
48 +appdata_path_check
49 +: # guarantee successful exit
50 +
51 +# vim:ft=sh
52 --
53 2.25.0

Replies