summaryrefslogtreecommitdiffstats
path: root/meta/classes/mime.bbclass
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2022-08-10 14:35:29 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-08-12 15:27:17 +0100
commitfd1517e2b51a170f2427122c6b95396db251d827 (patch)
treedabfe3e631339c2fc99a9ee7febb0f9c128e325e /meta/classes/mime.bbclass
parent10317912ee319ccf7f83605d438b5cbf9663f296 (diff)
downloadpoky-fd1517e2b51a170f2427122c6b95396db251d827.tar.gz
classes: Update classes to match new bitbake class scope functionality
Move classes to classes-global or classes-recipe as appropriate to take advantage of new bitbake functionality to check class scope/usage. (From OE-Core rev: f5c128008365e141082c129417eb72d2751e8045) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/mime.bbclass')
-rw-r--r--meta/classes/mime.bbclass76
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
11DEPENDS += "${@bb.utils.contains('BPN', 'shared-mime-info', '', 'shared-mime-info', d)}"
12PACKAGE_WRITE_DEPS += "shared-mime-info-native"
13MIMEDIR = "${datadir}/mime"
14
15mime_postinst() {
16if [ "x$D" != "x" ]; then
17 $INTERCEPT_DIR/postinst_intercept update_mime_database ${PKG} \
18 mlprefix=${MLPREFIX} \
19 mimedir=${MIMEDIR}
20else
21 echo "Updating MIME database... this may take a while."
22 update-mime-database $D${MIMEDIR}
23fi
24}
25
26mime_postrm() {
27if [ "x$D" != "x" ]; then
28 $INTERCEPT_DIR/postinst_intercept update_mime_database ${PKG} \
29 mlprefix=${MLPREFIX} \
30 mimedir=${MIMEDIR}
31else
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}
44fi
45fi
46}
47
48python 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}