summaryrefslogtreecommitdiffstats
path: root/meta/classes-recipe/manpages.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-recipe/manpages.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-recipe/manpages.bbclass')
-rw-r--r--meta/classes-recipe/manpages.bbclass51
1 files changed, 51 insertions, 0 deletions
diff --git a/meta/classes-recipe/manpages.bbclass b/meta/classes-recipe/manpages.bbclass
new file mode 100644
index 0000000000..693fb53671
--- /dev/null
+++ b/meta/classes-recipe/manpages.bbclass
@@ -0,0 +1,51 @@
1#
2# Copyright OpenEmbedded Contributors
3#
4# SPDX-License-Identifier: MIT
5#
6
7# Inherit this class to enable or disable building and installation of manpages
8# depending on whether 'api-documentation' is in DISTRO_FEATURES. Such building
9# tends to pull in the entire XML stack and other tools, so it's not enabled
10# by default.
11PACKAGECONFIG:append:class-target = " ${@bb.utils.contains('DISTRO_FEATURES', 'api-documentation', 'manpages', '', d)}"
12
13inherit qemu
14
15# usually manual files are packaged to ${PN}-doc except man-pages
16MAN_PKG ?= "${PN}-doc"
17
18# only add man-db to RDEPENDS when manual files are built and installed
19RDEPENDS:${MAN_PKG} += "${@bb.utils.contains('PACKAGECONFIG', 'manpages', 'man-db', '', d)}"
20
21pkg_postinst:${MAN_PKG}:append () {
22 # only update manual page index caches when manual files are built and installed
23 if ${@bb.utils.contains('PACKAGECONFIG', 'manpages', 'true', 'false', d)}; then
24 if test -n "$D"; then
25 if ${@bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', 'true', 'false', d)}; then
26 sed "s:\(\s\)/:\1$D/:g" $D${sysconfdir}/man_db.conf | ${@qemu_run_binary(d, '$D', '${bindir}/mandb')} -C - -u -q $D${mandir}
27 chown -R root:root $D${mandir}
28
29 mkdir -p $D${localstatedir}/cache/man
30 cd $D${mandir}
31 find . -name index.db | while read index; do
32 mkdir -p $D${localstatedir}/cache/man/$(dirname ${index})
33 mv ${index} $D${localstatedir}/cache/man/${index}
34 chown man:man $D${localstatedir}/cache/man/${index}
35 done
36 cd -
37 else
38 $INTERCEPT_DIR/postinst_intercept delay_to_first_boot ${PKG} mlprefix=${MLPREFIX}
39 fi
40 else
41 mandb -q
42 fi
43 fi
44}
45
46pkg_postrm:${MAN_PKG}:append () {
47 # only update manual page index caches when manual files are built and installed
48 if ${@bb.utils.contains('PACKAGECONFIG', 'manpages', 'true', 'false', d)}; then
49 mandb -q
50 fi
51}