public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH] metadata/install-qa-check.d/60appdata-path: new check
@ 2020-02-13  7:39 Georgy Yakovlev
  2020-02-13  7:50 ` Michał Górny
  2020-02-13 16:11 ` Christopher Head
  0 siblings, 2 replies; 4+ messages in thread
From: Georgy Yakovlev @ 2020-02-13  7:39 UTC (permalink / raw
  To: gentoo-dev; +Cc: Georgy Yakovlev

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 <gyakovlev@gentoo.org>
---
 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 <gyakovlev@gentoo.org>
+
+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
-- 
2.25.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [gentoo-dev] [PATCH] metadata/install-qa-check.d/60appdata-path: new check
  2020-02-13  7:39 [gentoo-dev] [PATCH] metadata/install-qa-check.d/60appdata-path: new check Georgy Yakovlev
@ 2020-02-13  7:50 ` Michał Górny
  2020-02-13 16:11 ` Christopher Head
  1 sibling, 0 replies; 4+ messages in thread
From: Michał Górny @ 2020-02-13  7:50 UTC (permalink / raw
  To: gentoo-dev; +Cc: Georgy Yakovlev

[-- Attachment #1: Type: text/plain, Size: 2251 bytes --]

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 <gyakovlev@gentoo.org>
> ---
>  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 <gyakovlev@gentoo.org>
> +
> +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 #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 618 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gentoo-dev] [PATCH] metadata/install-qa-check.d/60appdata-path: new check
  2020-02-13  7:39 [gentoo-dev] [PATCH] metadata/install-qa-check.d/60appdata-path: new check Georgy Yakovlev
  2020-02-13  7:50 ` Michał Górny
@ 2020-02-13 16:11 ` Christopher Head
  2020-02-13 19:04   ` Georgy Yakovlev
  1 sibling, 1 reply; 4+ messages in thread
From: Christopher Head @ 2020-02-13 16:11 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 268 bytes --]

On Wed, 12 Feb 2020 23:39:11 -0800
Georgy Yakovlev <gyakovlev@gentoo.org> wrote:

> +		eqawarn "For more details, please see the
> freedesktop Upstrem Metadate guidelines"

Couple of typos here: s/Upstrem/Upstream/, s/Metadate/Metadata/.
-- 
Christopher Head

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gentoo-dev] [PATCH] metadata/install-qa-check.d/60appdata-path: new check
  2020-02-13 16:11 ` Christopher Head
@ 2020-02-13 19:04   ` Georgy Yakovlev
  0 siblings, 0 replies; 4+ messages in thread
From: Georgy Yakovlev @ 2020-02-13 19:04 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 424 bytes --]

On Thu, 13 Feb 2020 08:11:09 -0800
Christopher Head <chead@chead.ca> wrote:

> On Wed, 12 Feb 2020 23:39:11 -0800
> Georgy Yakovlev <gyakovlev@gentoo.org> wrote:
> 
> > +		eqawarn "For more details, please see the
> > freedesktop Upstrem Metadate guidelines"  
> 
> Couple of typos here: s/Upstrem/Upstream/, s/Metadate/Metadata/.

Thanks!
Fixed and pushed now.

Tracker bug is https://bugs.gentoo.org/709450

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-02-13 19:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-13  7:39 [gentoo-dev] [PATCH] metadata/install-qa-check.d/60appdata-path: new check Georgy Yakovlev
2020-02-13  7:50 ` Michał Górny
2020-02-13 16:11 ` Christopher Head
2020-02-13 19:04   ` Georgy Yakovlev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox