Skip to contentSkip to conversation

Make MIME work on desktops

PATCH Superseded Andreas Müller 5 participants 24 messages Jan 9, 2020 – Jan 11, 2020

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Make MIME work on desktops

On fresh images file-browsers do not know how to open files and usually open a dialog with ALL applications available on the machine. This is not what users are used to when working with linux: For just one application installed per Mime-Type, the application is opened automatically.

To get a working MIME on desktop it needs two 'databases' on target:

1. Mime-Types: This is handled by mime.bbclass and creates database in /usr/share/mime/mime.cache.
2. Mime associations: A simple text-list of pairs Mime-Type <-> application in /usr/share/applications/mimeinfo.cache

This patch series updates/implements/enhances both parts to get images work as expected.

@Khem: This series creates many QA warnings for layers in meta-openembedded and a patch series fixing many was prepared [1]. Once this series get's applied (or you ask for it) I can send them out.

[1] https://github.com/schnitzeltony/meta-openembedded/tree/work-2020-01

Andreas Müller (11):
itstool: add from meta-oe
itstool: extend to nativesdk
shared-mime-info: upgrade 1.10 -> 1.15
bitbake.conf: add variables 'mimedir' and 'desktopdir' mime.bbclass: rework
insane.bbclass: introduce a warning for mime missing in inherit
shared-mime-info: add mime to inherit
gcr: add mime to inherit
mime-xdg.bbclass: initial add
insane.bbclass: Spawn warning for missing mime-xdg in inherit
gcr: add mime-xdg to inherit

 meta/classes/insane.bbclass                   | 30 +++++++++
 meta/classes/mime-xdg.bbclass                 | 62 +++++++++++++++++++
 meta/classes/mime.bbclass                     | 60 +++++++++---------
 meta/conf/bitbake.conf                        |  4 +-
 meta/recipes-gnome/gcr/gcr_3.34.0.bb          |  2 +-
 ...-build-time-hardcoded-python-binary-.patch | 35 +++++++++++
 ...ld-time-hardcoded-python-binary-path.patch | 29 +++++++++
 meta/recipes-support/itstool/itstool_2.0.6.bb | 21 +++++++
 .../shared-mime-info/install-data-hook.patch  | 25 --------
 .../shared-mime-info/parallelmake.patch       | 33 ----------
 .../shared-mime-info/shared-mime-info_1.10.bb |  7 ---
 ...mime-info.inc => shared-mime-info_1.15.bb} |  8 ++-
 .../update_desktop_database                   |  8 +++
 .../postinst-intercepts/update_mime_database  |  9 +++
 14 files changed, 234 insertions(+), 99 deletions(-)
 create mode 100644 meta/classes/mime-xdg.bbclass
 create mode 100644 meta/recipes-support/itstool/itstool/0001-Native-Don-t-use-build-time-hardcoded-python-binary-.patch
 create mode 100644 meta/recipes-support/itstool/itstool/0002-Don-t-use-build-time-hardcoded-python-binary-path.patch
 create mode 100644 meta/recipes-support/itstool/itstool_2.0.6.bb
 delete mode 100644 meta/recipes-support/shared-mime-info/shared-mime-info/install-data-hook.patch
 delete mode 100644 meta/recipes-support/shared-mime-info/shared-mime-info/parallelmake.patch
 delete mode 100644 meta/recipes-support/shared-mime-info/shared-mime-info_1.10.bb
 rename meta/recipes-support/shared-mime-info/{shared-mime-info.inc => shared-mime-info_1.15.bb} (69%)
 create mode 100644 scripts/postinst-intercepts/update_desktop_database
 create mode 100644 scripts/postinst-intercepts/update_mime_database
Signature · 1 line
2.21.0
#1 lore raw

PATCH 1/11 itstool: add from meta-oe

Recent versions of shared-mime-info depend on itstool

---
 ...-build-time-hardcoded-python-binary-.patch | 35 +++++++++++++++++++
 ...ld-time-hardcoded-python-binary-path.patch | 29 +++++++++++++++
 meta/recipes-support/itstool/itstool_2.0.6.bb | 20 +++++++++++
 3 files changed, 84 insertions(+)
 create mode 100644 meta/recipes-support/itstool/itstool/0001-Native-Don-t-use-build-time-hardcoded-python-binary-.patch
 create mode 100644 meta/recipes-support/itstool/itstool/0002-Don-t-use-build-time-hardcoded-python-binary-path.patch
 create mode 100644 meta/recipes-support/itstool/itstool_2.0.6.bb
meta/recipes-support/itstool/itstool/0001-Native-Don-t-use-build-time-hardcoded-python-binary-.patch new file +35 -0
new file mode 100644
index 0000000000..19a858bd75
@@ -0,0 +1,35 @@
+From 335ef14fc801c9dfbe7e5692dc71cfbe72049d2b Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Andreas=20M=C3=BCller?= <[email protected]>
+Date: Sun, 27 Oct 2019 16:38:52 +0100
+Subject: [PATCH] Native: Don't use build time hardcoded python binary path.
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This is same patch as used for target build except that we do not use the
+'-S' and '-s' option because '-S' is relatively young [1] and elder build-host
+don't support it [2]
+
+[1] https://github.com/coreutils/coreutils/commit/668306ed86c8c79b0af0db8b9c882654ebb66db2#diff-83d9d52b1f12ac589739ab1334ae4f30
+[2] https://errors.yoctoproject.org/Errors/Details/274743/
+
+Upstream-Status: Inappropriate [OE specific]
+
+Signed-off-by: Andreas Müller <[email protected]>
+---
+ itstool.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/itstool.in b/itstool.in
+index e64cd34..05d264f 100755
+--- a/itstool.in
++++ b/itstool.in
+@@ -1,4 +1,4 @@
+-#!@PYTHON@ -s
++#!/usr/bin/env python3
+ #
+ # Copyright (c) 2010-2018 Shaun McCance <[email protected]>
+ #
+-- 
+2.21.0
+
meta/recipes-support/itstool/itstool/0002-Don-t-use-build-time-hardcoded-python-binary-path.patch new file +29 -0
new file mode 100644
index 0000000000..b91105330c
@@ -0,0 +1,29 @@
+From cd9b56224895576125e91cca317ace8a80f3eb77 Mon Sep 17 00:00:00 2001
+From: Piotr Tworek <[email protected]>
+Date: Sat, 27 Jul 2019 10:19:11 +0200
+Subject: [PATCH] Don't use build time hardcoded python binary path.
+
+This path obviously won't work on target since they refer to build
+machine directory structure. Native builds will also fail if local.conf
+has INHERIT+=rm_work. Instread of hardcoding path to python binary use
+whatever is found in PATH first. This should also allow the tool to use
+python3 binary provided in recipe-sysroot-native.
+
+Upstream-Status: Inappropriate [OE specific]
+---
+ itstool.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/itstool.in b/itstool.in
+index b3c0033..7df2476 100755
+--- a/itstool.in
++++ b/itstool.in
+@@ -1,4 +1,4 @@
+-#!@PYTHON@ -s
++#!/usr/bin/env -S python3 -s
+ #
+ # Copyright (c) 2010-2018 Shaun McCance <[email protected]>
+ #
+--
+2.21.0
+
meta/recipes-support/itstool/itstool_2.0.6.bb new file +20 -0
new file mode 100644
index 0000000000..8290c5e581
@@ -0,0 +1,20 @@
+SUMMARY = "ITS Tool allows you to translate your XML documents with PO files"
+HOMEPAGE = "http://itstool.org/"
+LICENSE = "GPLv3"
+LIC_FILES_CHKSUM = "file://COPYING;md5=59c57b95fd7d0e9e238ebbc7ad47c5a5"
+
+inherit autotools python3native
+
+DEPENDS = "libxml2-native"
+
+SRC_URI = "http://files.itstool.org/${BPN}/${BPN}-${PV}.tar.bz2"
+SRC_URI_append_class-native = " file://0001-Native-Don-t-use-build-time-hardcoded-python-binary-.patch"
+SRC_URI_append_class-target = " file://0002-Don-t-use-build-time-hardcoded-python-binary-path.patch"
+
+SRC_URI[md5sum] = "4306eeba4f4aee6b393d14f9c3c57ca1"
+SRC_URI[sha256sum] = "6233cc22726a9a5a83664bf67d1af79549a298c23185d926c3677afa917b92a9"
+
+BBCLASSEXTEND = "native"
+
+RDEPENDS_${PN} += "libxml2-python"
+RDEPENDS_${PN}_class-native = ""
Signature · 1 line
2.21.0
#2 lore raw

Re: [PATCH 01/11] itstool: add from meta-oe

This also needs a maintainers.inc entry.

Alex

Quoted 139 lines · Andreas Müller

Recent versions of shared-mime-info depend on itstool

---
 ...-build-time-hardcoded-python-binary-.patch | 35 +++++++++++++++++++
 ...ld-time-hardcoded-python-binary-path.patch | 29 +++++++++++++++
 meta/recipes-support/itstool/itstool_2.0.6.bb | 20 +++++++++++
 3 files changed, 84 insertions(+)
 create mode 100644
meta/recipes-support/itstool/itstool/0001-Native-Don-t-use-build-time-hardcoded-python-binary-.patch
 create mode 100644
meta/recipes-support/itstool/itstool/0002-Don-t-use-build-time-hardcoded-python-binary-path.patch
 create mode 100644 meta/recipes-support/itstool/itstool_2.0.6.bb

diff --git a/meta/recipes-support/itstool/itstool/0001-Native-Don-t-use-build-time-hardcoded-python-binary-.patch b/meta/recipes-support/itstool/itstool/0001-Native-Don-t-use-build-time-hardcoded-python-binary-.patch new file mode 100644
index 0000000000..19a858bd75
--- /dev/null
+++
b/meta/recipes-support/itstool/itstool/0001-Native-Don-t-use-build-time-hardcoded-python-binary-.patch

meta/recipes-support/itstool/itstool/0001-Native-Don-t-use-build-time-hardcoded-python-binary-.patch new file +4 -0
@@ -0,0 +1,35 @@
+From 335ef14fc801c9dfbe7e5692dc71cfbe72049d2b Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Andreas=20M=C3=BCller?= <[email protected]>
+Date: Sun, 27 Oct 2019 16:38:52 +0100
+Subject: [PATCH] Native: Don't use build time hardcoded python binary

path.

meta/recipes-support/itstool/itstool/0001-Native-Don-t-use-build-time-hardcoded-python-binary-.patch new file +6 -0
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This is same patch as used for target build except that we do not use the
+'-S' and '-s' option because '-S' is relatively young [1] and elder

build-host

meta/recipes-support/itstool/itstool/0001-Native-Don-t-use-build-time-hardcoded-python-binary-.patch new file +3 -0
+don't support it [2]
+
+[1]

https://github.com/coreutils/coreutils/commit/668306ed86c8c79b0af0db8b9c882654ebb66db2#diff-83d9d52b1f12ac589739ab1334ae4f30
+[2] https://errors.yoctoproject.org/Errors/Details/274743/

meta/recipes-support/itstool/itstool/0001-Native-Don-t-use-build-time-hardcoded-python-binary-.patch new file +21 -0
+
+Upstream-Status: Inappropriate [OE specific]
+
+Signed-off-by: Andreas Müller <[email protected]>
+---
+ itstool.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/itstool.in b/itstool.in
+index e64cd34..05d264f 100755
+--- a/itstool.in
++++ b/itstool.in
+@@ -1,4 +1,4 @@
+-#!@PYTHON@ -s
++#!/usr/bin/env python3
+ #
+ # Copyright (c) 2010-2018 Shaun McCance <[email protected]>
+ #
+--
+2.21.0
+

diff --git a/meta/recipes-support/itstool/itstool/0002-Don-t-use-build-time-hardcoded-python-binary-path.patch b/meta/recipes-support/itstool/itstool/0002-Don-t-use-build-time-hardcoded-python-binary-path.patch new file mode 100644
index 0000000000..b91105330c
--- /dev/null
+++
b/meta/recipes-support/itstool/itstool/0002-Don-t-use-build-time-hardcoded-python-binary-path.patch

meta/recipes-support/itstool/itstool/0002-Don-t-use-build-time-hardcoded-python-binary-path.patch new file +29 -0
@@ -0,0 +1,29 @@
+From cd9b56224895576125e91cca317ace8a80f3eb77 Mon Sep 17 00:00:00 2001
+From: Piotr Tworek <[email protected]>
+Date: Sat, 27 Jul 2019 10:19:11 +0200
+Subject: [PATCH] Don't use build time hardcoded python binary path.
+
+This path obviously won't work on target since they refer to build
+machine directory structure. Native builds will also fail if local.conf
+has INHERIT+=rm_work. Instread of hardcoding path to python binary use
+whatever is found in PATH first. This should also allow the tool to use
+python3 binary provided in recipe-sysroot-native.
+
+Upstream-Status: Inappropriate [OE specific]
+---
+ itstool.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/itstool.in b/itstool.in
+index b3c0033..7df2476 100755
+--- a/itstool.in
++++ b/itstool.in
+@@ -1,4 +1,4 @@
+-#!@PYTHON@ -s
++#!/usr/bin/env -S python3 -s
+ #
+ # Copyright (c) 2010-2018 Shaun McCance <[email protected]>
+ #
+--
+2.21.0
+
meta/recipes-support/itstool/itstool_2.0.6.bb new file +1 -0
new file mode 100644
index 0000000000..8290c5e581
@@ -0,0 +1,20 @@
+SUMMARY = "ITS Tool allows you to translate your XML documents with PO

files"

meta/recipes-support/itstool/itstool_2.0.6.bb new file +10 -0
+HOMEPAGE = "http://itstool.org/"
+LICENSE = "GPLv3"
+LIC_FILES_CHKSUM = "file://COPYING;md5=59c57b95fd7d0e9e238ebbc7ad47c5a5"
+
+inherit autotools python3native
+
+DEPENDS = "libxml2-native"
+
+SRC_URI = "http://files.itstool.org/${BPN}/${BPN}-${PV}.tar.bz2"
+SRC_URI_append_class-native = "

file://0001-Native-Don-t-use-build-time-hardcoded-python-binary-.patch" +SRC_URI_append_class-target = " file://0002-Don-t-use-build-time-hardcoded-python-binary-path.patch"

meta/recipes-support/itstool/itstool_2.0.6.bb new file +3 -0
+
+SRC_URI[md5sum] = "4306eeba4f4aee6b393d14f9c3c57ca1"
+SRC_URI[sha256sum] =

"6233cc22726a9a5a83664bf67d1af79549a298c23185d926c3677afa917b92a9"

meta/recipes-support/itstool/itstool_2.0.6.bb new file +5 -1
+
+BBCLASSEXTEND = "native"
+
+RDEPENDS_${PN} += "libxml2-python"
+RDEPENDS_${PN}_class-native = ""
--

2.21.0

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#3 lore raw

Re: [PATCH 01/11] itstool: add from meta-oe

Quoted 4 lines · Alexander Kanavin

This also needs a maintainers.inc entry.

Alex

Shall I add me - or who would like to?

Andreas

#4 lore raw

Re: [PATCH 01/11] itstool: add from meta-oe

Adding yourself is fine :)

Alex

Quoted 10 lines · Andreas Müller
Quoted 4 lines · Alexander Kanavin

This also needs a maintainers.inc entry.

Alex

Shall I add me - or who would like to?

Andreas

#5 lore raw

PATCH 2/11 itstool: extend to nativesdk

In reply to Andreas Müller

This was not done in meta-oe but shared-mime-info extends to nativesdk either.

---
 meta/recipes-support/itstool/itstool_2.0.6.bb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta/recipes-support/itstool/itstool_2.0.6.bb +2 -1
index 8290c5e581..5f358f463d 100644
@@ -9,12 +9,13 @@ DEPENDS = "libxml2-native"
 
 SRC_URI = "http://files.itstool.org/${BPN}/${BPN}-${PV}.tar.bz2"
 SRC_URI_append_class-native = " file://0001-Native-Don-t-use-build-time-hardcoded-python-binary-.patch"
+SRC_URI_append_class-nativesdk = " file://0001-Native-Don-t-use-build-time-hardcoded-python-binary-.patch"
 SRC_URI_append_class-target = " file://0002-Don-t-use-build-time-hardcoded-python-binary-path.patch"
 
 SRC_URI[md5sum] = "4306eeba4f4aee6b393d14f9c3c57ca1"
 SRC_URI[sha256sum] = "6233cc22726a9a5a83664bf67d1af79549a298c23185d926c3677afa917b92a9"
 
-BBCLASSEXTEND = "native"
+BBCLASSEXTEND = "native nativesdk"
 
 RDEPENDS_${PN} += "libxml2-python"
 RDEPENDS_${PN}_class-native = ""
Signature · 1 line
2.21.0
#6 lore raw

PATCH 3/11 shared-mime-info: upgrade 1.10 -> 1.15

In reply to Andreas Müller

* sources/development moved to freedesktop's gitlab
* patches do not apply any more due to major changes in Makefile.am
* give up bb/inc separation

---
 .../shared-mime-info/install-data-hook.patch  | 25 --------------
 .../shared-mime-info/parallelmake.patch       | 33 -------------------
 .../shared-mime-info/shared-mime-info_1.10.bb |  7 ----
 ...mime-info.inc => shared-mime-info_1.15.bb} |  8 +++--
 4 files changed, 5 insertions(+), 68 deletions(-)
 delete mode 100644 meta/recipes-support/shared-mime-info/shared-mime-info/install-data-hook.patch
 delete mode 100644 meta/recipes-support/shared-mime-info/shared-mime-info/parallelmake.patch
 delete mode 100644 meta/recipes-support/shared-mime-info/shared-mime-info_1.10.bb
 rename meta/recipes-support/shared-mime-info/{shared-mime-info.inc => shared-mime-info_1.15.bb} (69%)
meta/recipes-support/shared-mime-info/shared-mime-info/install-data-hook.patch deleted +0 -25
deleted file mode 100644
index 262ff7562c..0000000000
@@ -1,25 +0,0 @@
-fix shared-mime-info build race condition
-
-The definition of install-data-hook in Makefile.am leads
-to multiple, overlapping, executions of install-binPROGRAMS
-target.  We modify the definition to avoid that.
-
-Upstream-Status: Pending
-
-Signed-off-by: Joe Slater <[email protected]>
-
-Index: shared-mime-info-1.9/Makefile.am
-===================================================================
---- shared-mime-info-1.9.orig/Makefile.am
-+++ shared-mime-info-1.9/Makefile.am
-@@ -50,7 +50,9 @@ else
-   update_mime_database="$(top_builddir)/update-mime-database$(EXEEXT)"
- endif
- 
--install-data-hook: install-binPROGRAMS
-+# do NOT make this dependent on anything!
-+#
-+install-data-hook:
- if ENABLE_UPDATE_MIMEDB
- 	$(update_mime_database) -V "$(DESTDIR)$(datadir)/mime"
- endif
meta/recipes-support/shared-mime-info/shared-mime-info/parallelmake.patch deleted +0 -33
deleted file mode 100644
index fea34a55a2..0000000000
@@ -1,33 +0,0 @@
-The Makefile used by shared-mime-info is one big race with the SUBDIRS 
-option and the dependency specifically calling make all combining to
-create multiple make instances all of which may try and build targets
-like update-mime-database.
-
-This patch removes those options meaning make can correctly identify
-dependencies and stop itself racing itself.
-
-RP 10/10/2011
-
-Upstream-Status: Pending
-Signed-off-by: Constantin Musca <[email protected]>
-
-Index: shared-mime-info-1.9/Makefile.am
-===================================================================
---- shared-mime-info-1.9.orig/Makefile.am
-+++ shared-mime-info-1.9/Makefile.am
-@@ -1,5 +1,3 @@
--SUBDIRS=. po
--
- AM_CPPFLAGS = $(ALL_CFLAGS)
- 
- packagesdir = $(datadir)/mime/packages
-@@ -81,8 +79,7 @@ endif
- 
- all: $(defaultmakedeps)
- 
--create-pot:
--	$(AM_V_GEN) $(MAKE) -C po shared-mime-info.pot
-+create-pot: po
- 
- local-test: create-pot freedesktop.org.xml update-mime-database$(EXEEXT)
- if CROSS_COMPILING
meta/recipes-support/shared-mime-info/shared-mime-info_1.10.bb deleted +0 -7
deleted file mode 100644
index 9fc210b718..0000000000
@@ -1,7 +0,0 @@
-require shared-mime-info.inc
-
-SRC_URI += "file://parallelmake.patch \
-	    file://install-data-hook.patch"
-
-SRC_URI[md5sum] = "418c2ced9dc4dd5ca8b06a755e6d64e9"
-SRC_URI[sha256sum] = "c625a83b4838befc8cafcd54e3619946515d9e44d63d61c4adf7f5513ddfbebf"
meta/recipes-support/shared-mime-info/shared-mime-info_1.15.bb renamed from meta/recipes-support/shared-mime-info/shared-mime-info.inc +5 -3
similarity index 69%
rename from meta/recipes-support/shared-mime-info/shared-mime-info.inc
rename to meta/recipes-support/shared-mime-info/shared-mime-info_1.15.bb
index 3fe1a445b0..163e74f362 100644
@@ -5,11 +5,13 @@ SECTION = "base"
 LICENSE = "GPLv2"
 LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
 
-DEPENDS = "libxml2 intltool-native glib-2.0 shared-mime-info-native"
+DEPENDS = "libxml2 itstool glib-2.0 shared-mime-info-native"
 
-SRC_URI = "http://freedesktop.org/~hadess/shared-mime-info-${PV}.tar.xz"
+SRC_URI = "https://gitlab.freedesktop.org/xdg/shared-mime-info/uploads/b27eb88e4155d8fccb8bb3cd12025d5b/${BPN}-${PV}.tar.xz"
+SRC_URI[md5sum] = "5215f3d679a817de97eb8b0b911e9393"
+SRC_URI[sha256sum] = "f482b027437c99e53b81037a9843fccd549243fd52145d016e9c7174a4f5db90"
 
-inherit autotools pkgconfig gettext
+inherit autotools pkgconfig gettext python3native
 
 EXTRA_OECONF = "--disable-update-mimedb"
 
Signature · 1 line
2.21.0
#7 lore raw

Re: [PATCH 03/11] shared-mime-info: upgrade 1.10 -> 1.15

Quoted 8 lines · Andreas Müller
(quoted diff) +1 -1
-SRC_URI = "http://freedesktop.org/~hadess/shared-mime-info-${PV}.tar.xz"
+SRC_URI = "

https://gitlab.freedesktop.org/xdg/shared-mime-info/uploads/b27eb88e4155d8fccb8bb3cd12025d5b/${BPN}-${PV}.tar.xz
"

(quoted diff) +2 -0
+SRC_URI[md5sum] = "5215f3d679a817de97eb8b0b911e9393"
+SRC_URI[sha256sum] =

"f482b027437c99e53b81037a9843fccd549243fd52145d016e9c7174a4f5db90"

The changing hash in the URI will make automated upgrades impossible unfortunately. How about building from git repo?

Alex

#8 lore raw

Re: [PATCH 03/11] shared-mime-info: upgrade 1.10 -> 1.15

Quoted 11 lines · Alexander Kanavin

meta/recipes-support/shared-mime-info/shared-mime-info_1.15.bb SECTION = "base" · line 12

Quoted 5 lines · Andreas Müller
meta/recipes-support/shared-mime-info/shared-mime-info_1.15.bb renamed from meta/recipes-support/shared-mime-info/shared-mime-info.inc +3 -1
-SRC_URI = "http://freedesktop.org/~hadess/shared-mime-info-${PV}.tar.xz"
+SRC_URI = "https://gitlab.freedesktop.org/xdg/shared-mime-info/uploads/b27eb88e4155d8fccb8bb3cd12025d5b/${BPN}-${PV}.tar.xz"
+SRC_URI[md5sum] = "5215f3d679a817de97eb8b0b911e9393"
+SRC_URI[sha256sum] = "f482b027437c99e53b81037a9843fccd549243fd52145d016e9c7174a4f5db90"

The changing hash in the URI will make automated upgrades impossible unfortunately. How about building from git repo?

Quoted 1 line

Alex

OK - V2 will come shortly

Andreas

#9 lore raw

PATCH 4/11 bitbake.conf: add variables 'mimedir' and 'desktopdir'

In reply to Andreas Müller

mimedir:
This is the path all mime information is stored at and update-mime-database works with
desktopdir:
All application .desktop files are stored here

---
 meta/conf/bitbake.conf | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
meta/conf/bitbake.conf +3 -1
index 263d8aea4f..6fb4072f1b 100644
@@ -34,6 +34,8 @@ export datadir = "${prefix}/share"
 export infodir = "${datadir}/info"
 export mandir = "${datadir}/man"
 export docdir = "${datadir}/doc"
+export mimedir = "${datadir}/mime"
+export desktopdir = "${datadir}/applications"
 export systemd_unitdir = "${nonarch_base_libdir}/systemd"
 export systemd_system_unitdir = "${nonarch_base_libdir}/systemd/system"
 export nonarch_libdir = "${exec_prefix}/lib"
@@ -300,7 +302,7 @@ FILES_${PN} = "${bindir}/* ${sbindir}/* ${libexecdir}/* ${libdir}/lib*${SOLIBS}
             ${base_prefix}/lib/udev ${prefix}/lib/udev \
             ${base_libdir}/udev ${libdir}/udev \
             ${datadir}/${BPN} ${libdir}/${BPN}/* \
-            ${datadir}/pixmaps ${datadir}/applications \
+            ${datadir}/pixmaps ${desktopdir} \
             ${datadir}/idl ${datadir}/omf ${datadir}/sounds \
             ${libdir}/bonobo/servers"
 
Signature · 1 line
2.21.0
#10 lore raw

Re: [PATCH 04/11] bitbake.conf: add variables 'mimedir' and 'desktopdir'

Quoted 16 lines · Andreas Müller

mimedir:
This is the path all mime information is stored at and update-mime-database works with
desktopdir:
All application .desktop files are stored here

---
 meta/conf/bitbake.conf | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
meta/conf/bitbake.conf +0 -0
index 263d8aea4f..6fb4072f1b 100644

meta/conf/bitbake.conf export datadir = "${prefix}/share" · line 38

Quoted 5 lines
meta/conf/bitbake.conf +2 -0
@@ -34,6 +34,8 @@ export datadir = "${prefix}/share"
 export infodir = "${datadir}/info"
 export mandir = "${datadir}/man"
 export docdir = "${datadir}/doc"
+export mimedir = "${datadir}/mime"
+export desktopdir = "${datadir}/applications"

Do these really need to be exported to the environment for everything?

Cheers,

Richard

#11 lore raw

Re: [PATCH 04/11] bitbake.conf: add variables 'mimedir' and 'desktopdir'

Quoted 13 lines · Richard Purdie
Quoted 11 lines · Andreas Müller

mimedir:
This is the path all mime information is stored at and update-mime-database works with
desktopdir:
All application .desktop files are stored here

---
 meta/conf/bitbake.conf | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Quoted 12 lines

meta/conf/bitbake.conf export datadir = "${prefix}/share" · line 38

Quoted 10 lines
meta/conf/bitbake.conf +2 -0
index 263d8aea4f..6fb4072f1b 100644
@@ -34,6 +34,8 @@ export datadir = "${prefix}/share"
 export infodir = "${datadir}/info"
 export mandir = "${datadir}/man"
 export docdir = "${datadir}/doc"
+export mimedir = "${datadir}/mime"
+export desktopdir = "${datadir}/applications"

Do these really need to be exported to the environment for everything?

It is not mandatory. It is just that I wanted to avoid redundancies in insane.bbclass / mime*.bbclass. If adding exports is a problem I can remove that. Let me know

Andreas

Quoted 5 lines

Cheers,

Richard

#12 lore raw

Re: [PATCH 04/11] bitbake.conf: add variables 'mimedir' and 'desktopdir'

Quoted 28 lines · Andreas Müller
Quoted 12 lines · Richard Purdie
Quoted 11 lines · Andreas Müller

mimedir:
This is the path all mime information is stored at and update-mime-database works with
desktopdir:
All application .desktop files are stored here

---
 meta/conf/bitbake.conf | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Quoted 13 lines

meta/conf/bitbake.conf export datadir = "${prefix}/share" · line 38

Quoted 10 lines
meta/conf/bitbake.conf +3 -1
index 263d8aea4f..6fb4072f1b 100644
--- a/meta/conf/bitbake.conf
++++++ b/meta/conf/bionf/bitbake.conf
@@ -34,6 +34,8 @@ export datadir = "${prefix}/share"
 export infodir = "${datadir}/info"
 export mandir = "${datadir}/man"
 export docdir = "${datadir}/doc"
+export mimedir = "${datadir}/mime"
+export desktopdir = "${datadir}/applications"

Do these really need to be exported to the environment for everything?

Quoted 3 lines

It is not mandatory. It is just that I wanted to avoid redundancies in insane.bbclass / mime*.bbclass. If adding exports is a problem I can remove that. Let me know

There are two issues here. One is that:

export mimedir = "${datadir}/mime"

and:

mimedir = "${datadir}/mime"

are quite different. The first one will place it in the environment of every shell task. For makefiles, this is necessary for some variables but in general its not and I'd prefer to clean up the shell environment where we can rather than make it worse. I suspect you don't need the export.

If we could move the setting of mimedir to mine.bbclass, that would also be better since variables have an effect on parsing time. I can see how wanting to share it between the two classes makes this trickier though and I'm torn on that, I can see the problem.

Cheers,

Richard

#13 lore raw

Re: [PATCH 04/11] bitbake.conf: add variables 'mimedir' and 'desktopdir'

Quoted 14 lines · Richard Purdie
Quoted 7 lines
Quoted 3 lines

Do these really need to be exported to the environment for everything?

It is not mandatory. It is just that I wanted to avoid redundancies in insane.bbclass / mime*.bbclass. If adding exports is a problem I can remove that. Let me know

There are two issues here. One is that:

export mimedir = "${datadir}/mime"

and:

Quoted 7 lines

mimedir = "${datadir}/mime"

are quite different. The first one will place it in the environment of every shell task. For makefiles, this is necessary for some variables but in general its not and I'd prefer to clean up the shell environment where we can rather than make it worse. I suspect you don't need the export.

Yes this was part of my thoughts because export is a shell thing but I thought there is some magic I am not aware of.

Quoted 6 lines

If we could move the setting of mimedir to mine.bbclass, that would also be better since variables have an effect on parsing time. I can see how wanting to share it between the two classes makes this trickier though and I'm torn on that, I can see the problem.

There are two directories that are turning into 'shared' by this series:

1. ${datadir}/mime: insane.bbclass / mime.bbclass
2. ${datadir}/applications: insane.bbclass / mime-xdg.bbclass

How about some mime-dir.bbclass or desktop-dir.bbclass or common-dir.bbclass or.. setting these dirs for bitbake without export but still at one place?

Or just set them in mime.bbclass / mime-xdg.bbclass / insane.bbclass. I have no strong opinion on that - it is just that I don't like redundancies (and am interested getting the base of this series applied because it bugged me for soo long)

Andreas

#14 lore raw

PATCH 5/11 mime.bbclass: rework

In reply to Andreas Müller

* add a short descriptions of class' use case
* remove checks for update-mime-database - it can be considered available:
* at build time by PACKAGE_WRITE_DEPS
* at package upgrade by RDEPENDS chain

    pkg -> shared-mime-info-data -> shared-mime-info

* simplify (accelerate?) xml file extension detection
* run update-mime-database once only at image creation to avoid expensive redundant operations
* allow shared-mime-info to inherit mime.bbclass by avoiding circular dependencies

---
 meta/classes/mime.bbclass                     | 60 ++++++++++---------
 .../postinst-intercepts/update_mime_database  |  9 +++
 2 files changed, 40 insertions(+), 29 deletions(-)
 create mode 100644 scripts/postinst-intercepts/update_mime_database
meta/classes/mime.bbclass +31 -29
index 6c7b868f79..9018bbc449 100644
@@ -1,29 +1,29 @@
-DEPENDS += "shared-mime-info"
+#
+# This class is used by recipes installing mime types
+#
+
+DEPENDS += "${@bb.utils.contains('BPN', 'shared-mime-info', '', 'shared-mime-info', d)}"
 PACKAGE_WRITE_DEPS += "shared-mime-info-native"
 
 mime_postinst() {
-if [ "$1" = configure ]; then
-	UPDATEMIMEDB=`which update-mime-database`
-	if [ -x "$UPDATEMIMEDB" ] ; then
-		echo "Updating MIME database... this may take a while."
-		$UPDATEMIMEDB $D${datadir}/mime
-	else
-		echo "Missing update-mime-database, update of mime database failed!"
-		exit 1
-	fi
+if [ "x$D" != "x" ]; then
+	$INTERCEPT_DIR/postinst_intercept update_mime_database ${PKG} \
+		mlprefix=${MLPREFIX} \
+		mimedir=${mimedir}
+else
+	echo "Updating MIME database... this may take a while."
+	update-mime-database $D${mimedir}
 fi
 }
 
 mime_postrm() {
-if [ "$1" = remove ] || [ "$1" = upgrade ]; then
-	UPDATEMIMEDB=`which update-mime-database`
-	if [ -x "$UPDATEMIMEDB" ] ; then
-		echo "Updating MIME database... this may take a while."
-		$UPDATEMIMEDB $D${datadir}/mime
-	else
-		echo "Missing update-mime-database, update of mime database failed!"
-		exit 1
-	fi
+if [ "x$D" != "x" ]; then
+	$INTERCEPT_DIR/postinst_intercept update_mime_database ${PKG} \
+		mlprefix=${MLPREFIX} \
+		mimedir=${mimedir}
+else
+	echo "Updating MIME database... this may take a while."
+	update-mime-database $D${mimedir}
 fi
 }
 
@@ -31,16 +31,17 @@ python populate_packages_append () {
     import re
     packages = d.getVar('PACKAGES').split()
     pkgdest =  d.getVar('PKGDEST')
+    mimedir = d.getVar('mimedir')
 
     for pkg in packages:
-        mime_dir = '%s/%s/usr/share/mime/packages' % (pkgdest, pkg)
-        mimes = []
-        mime_re = re.compile(".*\.xml$")
-        if os.path.exists(mime_dir):
-            for f in os.listdir(mime_dir):
-                if mime_re.match(f):
-                    mimes.append(f)
-        if mimes:
+        mime_packages_dir = '%s/%s%s/packages' % (pkgdest, pkg, mimedir)
+        mimes_types_found = False
+        if os.path.exists(mime_packages_dir):
+            for f in os.listdir(mime_packages_dir):
+                if f.endswith('.xml'):
+                    mimes_types_found = True
+                    break
+        if mimes_types_found:
             bb.note("adding mime postinst and postrm scripts to %s" % pkg)
             postinst = d.getVar('pkg_postinst_%s' % pkg)
             if not postinst:
@@ -52,6 +53,7 @@ python populate_packages_append () {
                 postrm = '#!/bin/sh\n'
             postrm += d.getVar('mime_postrm')
             d.setVar('pkg_postrm_%s' % pkg, postrm)
-            bb.note("adding shared-mime-info-data dependency to %s" % pkg)
-            d.appendVar('RDEPENDS_' + pkg, " " + d.getVar('MLPREFIX')+"shared-mime-info-data")
+            if pkg != 'shared-mime-info-data':
+                bb.note("adding shared-mime-info-data dependency to %s" % pkg)
+                d.appendVar('RDEPENDS_' + pkg, " " + d.getVar('MLPREFIX')+"shared-mime-info-data")
 }
scripts/postinst-intercepts/update_mime_database new file +9 -0
new file mode 100644
index 0000000000..582d1e162c
@@ -0,0 +1,9 @@
+#!/bin/sh
+#
+# SPDX-License-Identifier: MIT
+#
+# Post-install intercept for mime.bbclass
+
+echo "Updating MIME database... this may take a while."
+update-mime-database $D${mimedir}
+
Signature · 1 line
2.21.0
#15 lore raw

PATCH 6/11 insane.bbclass: introduce a warning for mime missing in inherit

In reply to Andreas Müller

* looking through layers it looks that usage of mime.bbclass is somewhat orphaned
* now that update-mime-database is called once only at image creation time, costs of mime.bbclass are limited

---
 meta/classes/insane.bbclass | 12 ++++++++++++
 1 file changed, 12 insertions(+)
meta/classes/insane.bbclass +12 -0
index f856cf6a2b..442e9e5113 100644
@@ -28,6 +28,7 @@ WARN_QA ?= "ldflags useless-rpaths rpaths staticdev libdir xorg-driver-abi \
             pn-overrides infodir build-deps src-uri-bad \
             unknown-configure-option symlink-to-sysroot multilib \
             invalid-packageconfig host-user-contaminated uppercase-pn patch-fuzz \
+            mime \
             "
 ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \
             perms dep-cmp pkgvarcheck perm-config perm-line perm-link \
@@ -185,6 +186,17 @@ def package_qa_check_staticdev(path, name, d, elf, messages):
         package_qa_add_message(messages, "staticdev", "non -staticdev package contains static .a library: %s path '%s'" % \
                  (name, package_qa_clean_path(path,d)))
 
+QAPATHTEST[mime] = "package_qa_check_mime"
+def package_qa_check_mime(path, name, d, elf, messages):
+    """
+    Check if package installs mime types to to /usr/share/mime/packages
+    while no inheriting mime.bbclass
+    """
+
+    if d.getVar("mimedir") + "/packages" in path and path.endswith('.xml') and not bb.data.inherits_class("mime", d):
+        package_qa_add_message(messages, "mime", "package contains mime types but does not inhert mime.bbclass: %s path '%s'" % \
+                 (name, package_qa_clean_path(path,d)))
+
 def package_qa_check_libdir(d):
     """
     Check for wrong library installation paths. For instance, catch
Signature · 1 line
2.21.0
#16 lore raw

Re: [PATCH 06/11] insane.bbclass: introduce a warning for mime missing in inherit

Quoted 31 lines

-----Original Message-----
From: [email protected] <openembedded-core- [email protected]> On Behalf Of Andreas Müller
Sent: den 9 januari 2020 21:26
To: [email protected]
Subject: [OE-core] [PATCH 06/11] insane.bbclass: introduce a warning for mime missing in inherit

* looking through layers it looks that usage of mime.bbclass is somewhat orphaned
* now that update-mime-database is called once only at image creation time, costs of mime.bbclass are limited

---
 meta/classes/insane.bbclass | 12 ++++++++++++
 1 file changed, 12 insertions(+)
meta/classes/insane.bbclass +1 -0
index f856cf6a2b..442e9e5113 100644
@@ -28,6 +28,7 @@ WARN_QA ?= "ldflags useless-rpaths rpaths staticdev libdir xorg-driver-abi \
             pn-overrides infodir build-deps src-uri-bad \
             unknown-configure-option symlink-to-sysroot multilib \
             invalid-packageconfig host-user-contaminated uppercase-pn patch-fuzz \
+            mime \
             "
 ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \
             perms dep-cmp pkgvarcheck perm-config perm-line perm-link \

meta/classes/insane.bbclass def package_qa_check_staticdev(path, name, d, elf, messages): · line 192

Quoted 7 lines
meta/classes/insane.bbclass +4 -0
@@ -185,6 +186,17 @@ def package_qa_check_staticdev(path, name, d, elf, messages):
         package_qa_add_message(messages, "staticdev", "non -staticdev package contains static .a library: %s path '%s'" % \
                  (name, package_qa_clean_path(path,d)))
 
+QAPATHTEST[mime] = "package_qa_check_mime"
+def package_qa_check_mime(path, name, d, elf, messages):
+    """
+    Check if package installs mime types to to /usr/share/mime/packages

Change "to to" to "to".

Quoted 11 lines
meta/classes/insane.bbclass +7 -1
+    while no inheriting mime.bbclass
+    """
+
+    if d.getVar("mimedir") + "/packages" in path and path.endswith('.xml') and not bb.data.inherits_class("mime", d):
+        package_qa_add_message(messages, "mime", "package contains mime types but does not inhert mime.bbclass: %s path '%s'" % \
+                 (name, package_qa_clean_path(path,d)))
+
 def package_qa_check_libdir(d):
     """
     Check for wrong library installation paths. For instance, catch
--
Quoted 1 line

2.21.0

//Peter

#17 lore raw

PATCH 7/11 shared-mime-info: add mime to inherit

In reply to Andreas Müller

shared-mime-info-data: is the base for mime database

---
 meta/recipes-support/shared-mime-info/shared-mime-info_1.15.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-support/shared-mime-info/shared-mime-info_1.15.bb +1 -1
index 163e74f362..633722125a 100644
@@ -11,7 +11,7 @@ SRC_URI = "https://gitlab.freedesktop.org/xdg/shared-mime-info/uploads/b27eb88e4
 SRC_URI[md5sum] = "5215f3d679a817de97eb8b0b911e9393"
 SRC_URI[sha256sum] = "f482b027437c99e53b81037a9843fccd549243fd52145d016e9c7174a4f5db90"
 
-inherit autotools pkgconfig gettext python3native
+inherit autotools pkgconfig gettext python3native mime
 
 EXTRA_OECONF = "--disable-update-mimedb"
 
Signature · 1 line
2.21.0
#18 lore raw

PATCH 8/11 gcr: add mime to inherit

In reply to Andreas Müller

gcr installs mime types we want in our mime-database

---
 meta/recipes-gnome/gcr/gcr_3.34.0.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-gnome/gcr/gcr_3.34.0.bb +1 -1
index e3e8999635..272112dd12 100644
@@ -11,7 +11,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=55ca817ccb7d5b5b66355690e9abc605"
 DEPENDS = "gtk+3 p11-kit glib-2.0 libgcrypt \
            ${@bb.utils.contains('GI_DATA_ENABLED', 'True', 'libxslt-native', '', d)}"
 
-inherit gnomebase gtk-icon-cache gtk-doc features_check upstream-version-is-even vala gobject-introspection gettext
+inherit gnomebase gtk-icon-cache gtk-doc features_check upstream-version-is-even vala gobject-introspection gettext mime
 # depends on gtk+3, but also x11 through gtk+-x11
 REQUIRED_DISTRO_FEATURES = "x11"
 
Signature · 1 line
2.21.0
#19 lore raw

PATCH 9/11 mime-xdg.bbclass: initial add

In reply to Andreas Müller

When opening files by file-browsers on fresh images, user has to choose the application to open from the pool af ALL known applications even those not designed to open the file selected. By inheriting this classs in recipes the assosiations in /usr/share/applications/mimeinfo.cache are build by calling update-desktop-database.

---
 meta/classes/mime-xdg.bbclass                 | 62 +++++++++++++++++++
 .../update_desktop_database                   |  8 +++
 2 files changed, 70 insertions(+)
 create mode 100644 meta/classes/mime-xdg.bbclass
 create mode 100644 scripts/postinst-intercepts/update_desktop_database
meta/classes/mime-xdg.bbclass new file +62 -0
new file mode 100644
index 0000000000..07194ce037
@@ -0,0 +1,62 @@
+#
+# This class creates mime <-> application associations based on entry 
+# 'MimeType' in *.desktop files
+#
+
+DEPENDS += "desktop-file-utils"
+PACKAGE_WRITE_DEPS += "desktop-file-utils-native"
+
+mime_xdg_postinst() {
+if [ "x$D" != "x" ]; then
+	$INTERCEPT_DIR/postinst_intercept update_desktop_database ${PKG} \
+		mlprefix=${MLPREFIX} \
+		desktop_dir=${desktopdir}
+else
+	update-desktop-database $D${desktopdir}
+fi
+}
+
+mime_xdg_postrm() {
+if [ "x$D" != "x" ]; then
+	$INTERCEPT_DIR/postinst_intercept update_desktop_database ${PKG} \
+		mlprefix=${MLPREFIX} \
+		desktop_dir=${desktopdir}
+else
+	update-desktop-database $D${desktopdir}
+fi
+}
+
+python populate_packages_append () {
+    import re
+    packages = d.getVar('PACKAGES').split()
+    pkgdest =  d.getVar('PKGDEST')
+    desktop_base = d.getVar('desktopdir')
+
+    for pkg in packages:
+        desktop_dir = '%s/%s%s' % (pkgdest, pkg, desktop_base)
+        desktops_with_mime_found = False
+        if os.path.exists(desktop_dir):
+            for df in os.listdir(desktop_dir):
+                if df.endswith('.desktop'):
+                    with open(desktop_dir + '/'+ df, 'r') as f:
+                        for line in f.read().split('\n'):
+                            if 'MimeType' in line:
+                                desktops_with_mime_found = True
+                                break;
+                if desktops_with_mime_found:
+                    break
+        if desktops_with_mime_found:
+            bb.note("adding mime-xdg postinst and postrm scripts to %s" % pkg)
+            postinst = d.getVar('pkg_postinst_%s' % pkg)
+            if not postinst:
+                postinst = '#!/bin/sh\n'
+            postinst += d.getVar('mime_xdg_postinst')
+            d.setVar('pkg_postinst_%s' % pkg, postinst)
+            postrm = d.getVar('pkg_postrm_%s' % pkg)
+            if not postrm:
+                postrm = '#!/bin/sh\n'
+            postrm += d.getVar('mime_xdg_postrm')
+            d.setVar('pkg_postrm_%s' % pkg, postrm)
+            bb.note("adding desktop-file-utils dependency to %s" % pkg)
+            d.appendVar('RDEPENDS_' + pkg, " " + d.getVar('MLPREFIX')+"desktop-file-utils")
+}
scripts/postinst-intercepts/update_desktop_database new file +8 -0
new file mode 100644
index 0000000000..8903b496f3
@@ -0,0 +1,8 @@
+#!/bin/sh
+#
+# SPDX-License-Identifier: MIT
+#
+# Post-install intercept for mime-xdg.bbclass
+
+update-desktop-database $D${desktop_dir}
+
Signature · 1 line
2.21.0
#20 lore raw

PATCH 10/11 insane.bbclass: Spawn warning for missing mime-xdg in inherit

In reply to Andreas Müller

If a package signals that it can open mime-types but does not inharit mime-xdg, a warning is created.

---
 meta/classes/insane.bbclass | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)
meta/classes/insane.bbclass +19 -1
index 442e9e5113..4ca39f22ff 100644
@@ -28,7 +28,7 @@ WARN_QA ?= "ldflags useless-rpaths rpaths staticdev libdir xorg-driver-abi \
             pn-overrides infodir build-deps src-uri-bad \
             unknown-configure-option symlink-to-sysroot multilib \
             invalid-packageconfig host-user-contaminated uppercase-pn patch-fuzz \
-            mime \
+            mime mime-xdg \
             "
 ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \
             perms dep-cmp pkgvarcheck perm-config perm-line perm-link \
@@ -197,6 +197,24 @@ def package_qa_check_mime(path, name, d, elf, messages):
         package_qa_add_message(messages, "mime", "package contains mime types but does not inhert mime.bbclass: %s path '%s'" % \
                  (name, package_qa_clean_path(path,d)))
 
+QAPATHTEST[mime-xdg] = "package_qa_check_mime_xdg"
+def package_qa_check_mime_xdg(path, name, d, elf, messages):
+    """
+    Check if package installs desktop file containing MimeType and requires
+    mime-types.bbclass to create /usr/share/applications/mimeinfo.cache
+    """
+
+    if d.getVar("desktopdir") in path and path.endswith('.desktop') and not bb.data.inherits_class("mime-xdg", d):
+        mime_type_found = False
+        with open(path, 'r') as f:
+            for line in f.read().split('\n'):
+                if 'MimeType' in line:
+                    mime_type_found = True
+                    break;
+        if mime_type_found:
+            package_qa_add_message(messages, "mime-xdg", "package contains desktop file with key 'MimeType' but does not inhert mime-xdg.bbclass: %s path '%s'" % \
+                    (name, package_qa_clean_path(path,d)))
+
 def package_qa_check_libdir(d):
     """
     Check for wrong library installation paths. For instance, catch
Signature · 1 line
2.21.0
#21 lore raw

PATCH 11/11 gcr: add mime-xdg to inherit

In reply to Andreas Müller
---
 meta/recipes-gnome/gcr/gcr_3.34.0.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-gnome/gcr/gcr_3.34.0.bb +1 -1
index 272112dd12..9853b3f416 100644
@@ -11,7 +11,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=55ca817ccb7d5b5b66355690e9abc605"
 DEPENDS = "gtk+3 p11-kit glib-2.0 libgcrypt \
            ${@bb.utils.contains('GI_DATA_ENABLED', 'True', 'libxslt-native', '', d)}"
 
-inherit gnomebase gtk-icon-cache gtk-doc features_check upstream-version-is-even vala gobject-introspection gettext mime
+inherit gnomebase gtk-icon-cache gtk-doc features_check upstream-version-is-even vala gobject-introspection gettext mime mime-xdg
 # depends on gtk+3, but also x11 through gtk+-x11
 REQUIRED_DISTRO_FEATURES = "x11"
 
Signature · 1 line
2.21.0
#22 lore raw

✗ patchtest: failure for Make MIME work on desktops

In reply to Andreas Müller

== Series Details ==

Series: Make MIME work on desktops
Revision: 1
URL : https://patchwork.openembedded.org/series/21945/
State : failure

== Summary ==

Thank you for submitting this patch series to OpenEmbedded Core. This is an automated response. Several tests have been executed on the proposed series by patchtest resulting in the following failures:

* Issue A patch file has been added, but does not have a Signed-off-by tag [test_signed_off_by_presence]
Suggested fix Sign off the added patch file (meta/recipes-support/itstool/itstool/0002-Don-t-use-build-time-hardcoded-python-binary-path.patch)

If you believe any of these test results are incorrect, please reply to the mailing list ([email protected]) raising your concerns. Otherwise we would appreciate you correcting the issues and submitting a new version of the patchset if applicable. Please ensure you add/increment the version number when sending the new version (i.e. [PATCH] -> [PATCH v2] -> [PATCH v3] -> ...).

---

Guidelines:     https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines
Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
Test suite:     http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe
#23 lore raw
In reply to Andreas Müller
Quoted 61 lines · Andreas Müller

On fresh images file-browsers do not know how to open files and usually open a dialog with ALL applications available on the machine. This is not what users are used to when working with linux: For just one application installed per Mime-Type, the application is opened automatically.

To get a working MIME on desktop it needs two 'databases' on target:

1. Mime-Types: This is handled by mime.bbclass and creates database in /usr/share/mime/mime.cache.
2. Mime associations: A simple text-list of pairs Mime-Type <-> application in /usr/share/applications/mimeinfo.cache

This patch series updates/implements/enhances both parts to get images work as expected.

@Khem: This series creates many QA warnings for layers in meta-openembedded and a patch series fixing many was prepared [1]. Once this series get's applied (or you ask for it) I can send them out.

[1] https://github.com/schnitzeltony/meta-openembedded/tree/work-2020-01

Andreas Müller (11):
itstool: add from meta-oe
itstool: extend to nativesdk
shared-mime-info: upgrade 1.10 -> 1.15
bitbake.conf: add variables 'mimedir' and 'desktopdir' mime.bbclass: rework
insane.bbclass: introduce a warning for mime missing in inherit
shared-mime-info: add mime to inherit
gcr: add mime to inherit
mime-xdg.bbclass: initial add
insane.bbclass: Spawn warning for missing mime-xdg in inherit
gcr: add mime-xdg to inherit

 meta/classes/insane.bbclass                   | 30 +++++++++
 meta/classes/mime-xdg.bbclass                 | 62 +++++++++++++++++++
 meta/classes/mime.bbclass                     | 60 +++++++++---------
 meta/conf/bitbake.conf                        |  4 +-
 meta/recipes-gnome/gcr/gcr_3.34.0.bb          |  2 +-
 ...-build-time-hardcoded-python-binary-.patch | 35 +++++++++++
 ...ld-time-hardcoded-python-binary-path.patch | 29 +++++++++
 meta/recipes-support/itstool/itstool_2.0.6.bb | 21 +++++++
 .../shared-mime-info/install-data-hook.patch  | 25 --------
 .../shared-mime-info/parallelmake.patch       | 33 ----------
 .../shared-mime-info/shared-mime-info_1.10.bb |  7 ---
 ...mime-info.inc => shared-mime-info_1.15.bb} |  8 ++-
 .../update_desktop_database                   |  8 +++
 .../postinst-intercepts/update_mime_database  |  9 +++
 14 files changed, 234 insertions(+), 99 deletions(-)
 create mode 100644 meta/classes/mime-xdg.bbclass
 create mode 100644 meta/recipes-support/itstool/itstool/0001-Native-Don-t-use-build-time-hardcoded-python-binary-.patch
 create mode 100644 meta/recipes-support/itstool/itstool/0002-Don-t-use-build-time-hardcoded-python-binary-path.patch
 create mode 100644 meta/recipes-support/itstool/itstool_2.0.6.bb
 delete mode 100644 meta/recipes-support/shared-mime-info/shared-mime-info/install-data-hook.patch
 delete mode 100644 meta/recipes-support/shared-mime-info/shared-mime-info/parallelmake.patch
 delete mode 100644 meta/recipes-support/shared-mime-info/shared-mime-info_1.10.bb
 rename meta/recipes-support/shared-mime-info/{shared-mime-info.inc => shared-mime-info_1.15.bb} (69%)
 create mode 100644 scripts/postinst-intercepts/update_desktop_database
 create mode 100644 scripts/postinst-intercepts/update_mime_database
Quoted 3 lines

--
2.21.0

Thanks everybody for review./comments I will prepare a V2 and run full tests here. That may take a few days...

Andreas