diff options
author | Andreas Müller <schnitzeltony@gmail.com> | 2020-01-17 22:29:07 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-01-19 13:24:38 +0000 |
commit | 73cd296ac0689460b32b4edb73f705c596d481ca (patch) | |
tree | 95b11fe941f961286c146b87c8291699c4c2e21f /meta | |
parent | 94c42e7fdd69ed39d475156a776f6f80d4165932 (diff) | |
download | poky-73cd296ac0689460b32b4edb73f705c596d481ca.tar.gz |
insane.bbclass: Spawn warning for missing mime-xdg in inherit
If a package signals that it can open mime-types but does not inharit mime-xdg,
a warning is created.
(From OE-Core rev: 75b4a377d6e74456bbb4b9966725de7385c74b61)
Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/classes/insane.bbclass | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass index 5b60f6f7bc..795c7b9212 100644 --- a/meta/classes/insane.bbclass +++ b/meta/classes/insane.bbclass | |||
@@ -28,7 +28,7 @@ WARN_QA ?= "ldflags useless-rpaths rpaths staticdev libdir xorg-driver-abi \ | |||
28 | pn-overrides infodir build-deps src-uri-bad \ | 28 | pn-overrides infodir build-deps src-uri-bad \ |
29 | unknown-configure-option symlink-to-sysroot multilib \ | 29 | unknown-configure-option symlink-to-sysroot multilib \ |
30 | invalid-packageconfig host-user-contaminated uppercase-pn patch-fuzz \ | 30 | invalid-packageconfig host-user-contaminated uppercase-pn patch-fuzz \ |
31 | mime \ | 31 | mime mime-xdg \ |
32 | " | 32 | " |
33 | ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \ | 33 | ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \ |
34 | perms dep-cmp pkgvarcheck perm-config perm-line perm-link \ | 34 | perms dep-cmp pkgvarcheck perm-config perm-line perm-link \ |
@@ -197,6 +197,35 @@ def package_qa_check_mime(path, name, d, elf, messages): | |||
197 | package_qa_add_message(messages, "mime", "package contains mime types but does not inhert mime: %s path '%s'" % \ | 197 | package_qa_add_message(messages, "mime", "package contains mime types but does not inhert mime: %s path '%s'" % \ |
198 | (name, package_qa_clean_path(path,d))) | 198 | (name, package_qa_clean_path(path,d))) |
199 | 199 | ||
200 | QAPATHTEST[mime-xdg] = "package_qa_check_mime_xdg" | ||
201 | def package_qa_check_mime_xdg(path, name, d, elf, messages): | ||
202 | """ | ||
203 | Check if package installs desktop file containing MimeType and requires | ||
204 | mime-types.bbclass to create /usr/share/applications/mimeinfo.cache | ||
205 | """ | ||
206 | |||
207 | if d.getVar("datadir") + "/applications" in path and path.endswith('.desktop') and not bb.data.inherits_class("mime-xdg", d): | ||
208 | mime_type_found = False | ||
209 | try: | ||
210 | with open(path, 'r') as f: | ||
211 | for line in f.read().split('\n'): | ||
212 | if 'MimeType' in line: | ||
213 | mime_type_found = True | ||
214 | break; | ||
215 | except: | ||
216 | # At least libreoffice installs symlinks with absolute paths that are dangling here. | ||
217 | # We could implement some magic but for few (one) recipes it is not worth the effort so just warn: | ||
218 | wstr = "%s cannot open %s - is it a symlink with absolute path?\n" % (name, package_qa_clean_path(path,d)) | ||
219 | wstr += "Please check if (linked) file contains key 'MimeType'.\n" | ||
220 | pkgname = name | ||
221 | if name == d.getVar('PN'): | ||
222 | pkgname = '${PN}' | ||
223 | wstr += "If yes: add \'inhert mime-xdg\' and \'MIME_XDG_PACKAGES += \"%s\"\' / if no add \'INSANE_SKIP_%s += \"mime-xdg\"\' to recipe." % (pkgname, pkgname) | ||
224 | package_qa_add_message(messages, "mime-xdg", wstr) | ||
225 | if mime_type_found: | ||
226 | package_qa_add_message(messages, "mime-xdg", "package contains desktop file with key 'MimeType' but does not inhert mime-xdg: %s path '%s'" % \ | ||
227 | (name, package_qa_clean_path(path,d))) | ||
228 | |||
200 | def package_qa_check_libdir(d): | 229 | def package_qa_check_libdir(d): |
201 | """ | 230 | """ |
202 | Check for wrong library installation paths. For instance, catch | 231 | Check for wrong library installation paths. For instance, catch |