mirror of
https://git.yoctoproject.org/poky
synced 2026-04-07 14:02:22 +02:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
94c42e7fdd
commit
73cd296ac0
@@ -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,35 @@ 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: %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("datadir") + "/applications" in path and path.endswith('.desktop') and not bb.data.inherits_class("mime-xdg", d):
|
||||
mime_type_found = False
|
||||
try:
|
||||
with open(path, 'r') as f:
|
||||
for line in f.read().split('\n'):
|
||||
if 'MimeType' in line:
|
||||
mime_type_found = True
|
||||
break;
|
||||
except:
|
||||
# At least libreoffice installs symlinks with absolute paths that are dangling here.
|
||||
# We could implement some magic but for few (one) recipes it is not worth the effort so just warn:
|
||||
wstr = "%s cannot open %s - is it a symlink with absolute path?\n" % (name, package_qa_clean_path(path,d))
|
||||
wstr += "Please check if (linked) file contains key 'MimeType'.\n"
|
||||
pkgname = name
|
||||
if name == d.getVar('PN'):
|
||||
pkgname = '${PN}'
|
||||
wstr += "If yes: add \'inhert mime-xdg\' and \'MIME_XDG_PACKAGES += \"%s\"\' / if no add \'INSANE_SKIP_%s += \"mime-xdg\"\' to recipe." % (pkgname, pkgname)
|
||||
package_qa_add_message(messages, "mime-xdg", wstr)
|
||||
if mime_type_found:
|
||||
package_qa_add_message(messages, "mime-xdg", "package contains desktop file with key 'MimeType' but does not inhert mime-xdg: %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
|
||||
|
||||
Reference in New Issue
Block a user