diff options
author | Andrew Geissler <geissonator@yahoo.com> | 2020-04-13 21:39:40 +0300 |
---|---|---|
committer | Andrew Geissler <geissonator@yahoo.com> | 2020-05-05 16:30:44 +0300 |
commit | 82c905dc58a36aeae40b1b273a12f63fb1973cf4 (patch) | |
tree | 38caf00263451b5036435cdc36e035b25d32e623 /poky/meta/classes/mime-xdg.bbclass | |
parent | 83ecb75644b3d677c274188f9ac0b2374d6f6925 (diff) | |
download | openbmc-82c905dc58a36aeae40b1b273a12f63fb1973cf4.tar.xz |
meta-openembedded and poky: subtree updates
Squash of the following due to dependencies among them
and OpenBMC changes:
meta-openembedded: subtree update:d0748372d2..9201611135
meta-openembedded: subtree update:9201611135..17fd382f34
poky: subtree update:9052e5b32a..2e11d97b6c
poky: subtree update:2e11d97b6c..a8544811d7
The change log was too large for the jenkins plugin
to handle therefore it has been removed. Here is
the first and last commit of each subtree:
meta-openembedded:d0748372d2
cppzmq: bump to version 4.6.0
meta-openembedded:17fd382f34
mpv: Remove X11 dependency
poky:9052e5b32a
package_ipk: Remove pointless comment to trigger rebuild
poky:a8544811d7
pbzip2: Fix license warning
Change-Id: If0fc6c37629642ee207a4ca2f7aa501a2c673cd6
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
Diffstat (limited to 'poky/meta/classes/mime-xdg.bbclass')
-rw-r--r-- | poky/meta/classes/mime-xdg.bbclass | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/poky/meta/classes/mime-xdg.bbclass b/poky/meta/classes/mime-xdg.bbclass new file mode 100644 index 000000000..642a5b759 --- /dev/null +++ b/poky/meta/classes/mime-xdg.bbclass @@ -0,0 +1,74 @@ +# +# This class creates mime <-> application associations based on entry +# 'MimeType' in *.desktop files +# + +DEPENDS += "desktop-file-utils" +PACKAGE_WRITE_DEPS += "desktop-file-utils-native" +DESKTOPDIR = "${datadir}/applications" + +# There are recipes out there installing their .desktop files as absolute +# symlinks. For us these are dangling and cannot be introspected for "MimeType" +# easily. By addding package-names to MIME_XDG_PACKAGES, packager can force +# proper update-desktop-database handling. Note that all introspection is +# skipped for MIME_XDG_PACKAGES not empty +MIME_XDG_PACKAGES ?= "" + +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 () { + packages = d.getVar('PACKAGES').split() + pkgdest = d.getVar('PKGDEST') + desktop_base = d.getVar('DESKTOPDIR') + forced_mime_xdg_pkgs = (d.getVar('MIME_XDG_PACKAGES') or '').split() + + for pkg in packages: + desktops_with_mime_found = pkg in forced_mime_xdg_pkgs + if d.getVar('MIME_XDG_PACKAGES') == '': + desktop_dir = '%s/%s%s' % (pkgdest, pkg, desktop_base) + if os.path.exists(desktop_dir): + for df in os.listdir(desktop_dir): + if df.endswith('.desktop'): + try: + 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; + except: + bb.warn('Could not open %s. Set MIME_XDG_PACKAGES in recipe or add mime-xdg to INSANE_SKIP.' % desktop_dir + '/'+ df) + 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") +} |