Gentoo Archives: gentoo-dev

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

Attachments

File name MIME type
signature.asc application/pgp-signature