diff options
Diffstat (limited to 'meta/classes/mime.bbclass')
| -rw-r--r-- | meta/classes/mime.bbclass | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/meta/classes/mime.bbclass b/meta/classes/mime.bbclass deleted file mode 100644 index 9b13f62bda..0000000000 --- a/meta/classes/mime.bbclass +++ /dev/null | |||
| @@ -1,76 +0,0 @@ | |||
| 1 | # | ||
| 2 | # Copyright OpenEmbedded Contributors | ||
| 3 | # | ||
| 4 | # SPDX-License-Identifier: MIT | ||
| 5 | # | ||
| 6 | |||
| 7 | # | ||
| 8 | # This class is used by recipes installing mime types | ||
| 9 | # | ||
| 10 | |||
| 11 | DEPENDS += "${@bb.utils.contains('BPN', 'shared-mime-info', '', 'shared-mime-info', d)}" | ||
| 12 | PACKAGE_WRITE_DEPS += "shared-mime-info-native" | ||
| 13 | MIMEDIR = "${datadir}/mime" | ||
| 14 | |||
| 15 | mime_postinst() { | ||
| 16 | if [ "x$D" != "x" ]; then | ||
| 17 | $INTERCEPT_DIR/postinst_intercept update_mime_database ${PKG} \ | ||
| 18 | mlprefix=${MLPREFIX} \ | ||
| 19 | mimedir=${MIMEDIR} | ||
| 20 | else | ||
| 21 | echo "Updating MIME database... this may take a while." | ||
| 22 | update-mime-database $D${MIMEDIR} | ||
| 23 | fi | ||
| 24 | } | ||
| 25 | |||
| 26 | mime_postrm() { | ||
| 27 | if [ "x$D" != "x" ]; then | ||
| 28 | $INTERCEPT_DIR/postinst_intercept update_mime_database ${PKG} \ | ||
| 29 | mlprefix=${MLPREFIX} \ | ||
| 30 | mimedir=${MIMEDIR} | ||
| 31 | else | ||
| 32 | echo "Updating MIME database... this may take a while." | ||
| 33 | # $D${MIMEDIR}/packages belong to package shared-mime-info-data, | ||
| 34 | # packages like libfm-mime depend on shared-mime-info-data. | ||
| 35 | # after shared-mime-info-data uninstalled, $D${MIMEDIR}/packages | ||
| 36 | # is removed, but update-mime-database need this dir to update | ||
| 37 | # database, workaround to create one and remove it later | ||
| 38 | if [ ! -d $D${MIMEDIR}/packages ]; then | ||
| 39 | mkdir -p $D${MIMEDIR}/packages | ||
| 40 | update-mime-database $D${MIMEDIR} | ||
| 41 | rmdir --ignore-fail-on-non-empty $D${MIMEDIR}/packages | ||
| 42 | else | ||
| 43 | update-mime-database $D${MIMEDIR} | ||
| 44 | fi | ||
| 45 | fi | ||
| 46 | } | ||
| 47 | |||
| 48 | python populate_packages:append () { | ||
| 49 | packages = d.getVar('PACKAGES').split() | ||
| 50 | pkgdest = d.getVar('PKGDEST') | ||
| 51 | mimedir = d.getVar('MIMEDIR') | ||
| 52 | |||
| 53 | for pkg in packages: | ||
| 54 | mime_packages_dir = '%s/%s%s/packages' % (pkgdest, pkg, mimedir) | ||
| 55 | mimes_types_found = False | ||
| 56 | if os.path.exists(mime_packages_dir): | ||
| 57 | for f in os.listdir(mime_packages_dir): | ||
| 58 | if f.endswith('.xml'): | ||
| 59 | mimes_types_found = True | ||
| 60 | break | ||
| 61 | if mimes_types_found: | ||
| 62 | bb.note("adding mime postinst and postrm scripts to %s" % pkg) | ||
| 63 | postinst = d.getVar('pkg_postinst:%s' % pkg) | ||
| 64 | if not postinst: | ||
| 65 | postinst = '#!/bin/sh\n' | ||
| 66 | postinst += d.getVar('mime_postinst') | ||
| 67 | d.setVar('pkg_postinst:%s' % pkg, postinst) | ||
| 68 | postrm = d.getVar('pkg_postrm:%s' % pkg) | ||
| 69 | if not postrm: | ||
| 70 | postrm = '#!/bin/sh\n' | ||
| 71 | postrm += d.getVar('mime_postrm') | ||
| 72 | d.setVar('pkg_postrm:%s' % pkg, postrm) | ||
| 73 | if pkg != 'shared-mime-info-data': | ||
| 74 | bb.note("adding shared-mime-info-data dependency to %s" % pkg) | ||
| 75 | d.appendVar('RDEPENDS:' + pkg, " " + d.getVar('MLPREFIX')+"shared-mime-info-data") | ||
| 76 | } | ||
