All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] manpages.bbclass: Update RDEPENDS and post install scripts
@ 2018-06-07  9:01 Kai Kang
  2018-06-07  9:02 ` [PATCH 2/2] man-pages: inherit manpages Kai Kang
  2018-06-07 13:02 ` [PATCH 1/2] manpages.bbclass: Update RDEPENDS and post install scripts Alexander Kanavin
  0 siblings, 2 replies; 3+ messages in thread
From: Kai Kang @ 2018-06-07  9:01 UTC (permalink / raw)
  To: alexander.kanavin; +Cc: openembedded-core

If a package installs manual files, it should update manual index cache
after its installation. Add package 'man-db' to RDEPENDS which contains
command 'mandb' to update the cache. And do the update in the post
install scripts.

Signed-off-by: Kai Kang <kai.kang@windriver.com>
---
 meta/classes/manpages.bbclass | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/meta/classes/manpages.bbclass b/meta/classes/manpages.bbclass
index d16237b8983..50c254763e8 100644
--- a/meta/classes/manpages.bbclass
+++ b/meta/classes/manpages.bbclass
@@ -3,3 +3,35 @@
 # tends to pull in the entire XML stack and other tools, so it's not enabled
 # by default.
 PACKAGECONFIG_append_class-target = " ${@bb.utils.contains('DISTRO_FEATURES', 'api-documentation', 'manpages', '', d)}"
+
+inherit qemu
+
+# usually manual files are packaged to ${PN}-doc except man-pages
+MAN_PKG ?= "${PN}-doc"
+
+# only add man-db to RDEPENDS when manual files are built and installed
+RDEPENDS_${MAN_PKG} += "${@bb.utils.contains('PACKAGECONFIG', 'manpages', 'man-db', '', d)}"
+
+pkg_postinst_append_${MAN_PKG} () {
+	# only update manual page index caches when manual files are built and installed
+	if ${@bb.utils.contains('PACKAGECONFIG', 'manpages', 'true', 'false', d)}; then
+		if test -n "$D"; then
+			if ${@bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', 'true','false', d)}; then
+				sed "s:\(\s\)/:\1$D/:g" $D${sysconfdir}/man_db.conf | ${@qemu_run_binary(d, '$D', '${bindir}/mandb')} -C - -u -q $D${mandir}
+				mkdir -p $D${localstatedir}/cache/man
+				mv $D${mandir}/index.db $D${localstatedir}/cache/man
+			else
+				$INTERCEPT_DIR/postinst_intercept delay_to_first_boot ${PKG} mlprefix=${MLPREFIX}
+			fi
+		else
+			mandb -q
+		fi
+	fi
+}
+
+pkg_postrm_append_${MAN_PKG} () {
+	# only update manual page index caches when manual files are built and installed
+	if ${@bb.utils.contains('PACKAGECONFIG', 'manpages', 'true', 'false', d)}; then
+		mandb -q
+	fi
+}
-- 
2.11.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] man-pages: inherit manpages
  2018-06-07  9:01 [PATCH 1/2] manpages.bbclass: Update RDEPENDS and post install scripts Kai Kang
@ 2018-06-07  9:02 ` Kai Kang
  2018-06-07 13:02 ` [PATCH 1/2] manpages.bbclass: Update RDEPENDS and post install scripts Alexander Kanavin
  1 sibling, 0 replies; 3+ messages in thread
From: Kai Kang @ 2018-06-07  9:02 UTC (permalink / raw)
  To: alexander.kanavin; +Cc: openembedded-core

Inherit manpages to update manual file index caches after installation
for man-pages.

Signed-off-by: Kai Kang <kai.kang@windriver.com>
---
 meta/recipes-extended/man-pages/man-pages_4.14.bb | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-extended/man-pages/man-pages_4.14.bb b/meta/recipes-extended/man-pages/man-pages_4.14.bb
index f8bd090d192..4ce0b13ce83 100644
--- a/meta/recipes-extended/man-pages/man-pages_4.14.bb
+++ b/meta/recipes-extended/man-pages/man-pages_4.14.bb
@@ -10,7 +10,13 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/docs/${BPN}/Archive/${BP}.tar.gz"
 SRC_URI[md5sum] = "82bd2d05c4d0dba5e7a90d39c9555197"
 SRC_URI[sha256sum] = "aeebc6b09a11e7f7bbc98f3984fe8b8b2bde9d2f5f9dcbd4348a9e0d93704238"
 
-RDEPENDS_${PN} = "man"
+inherit manpages
+
+MAN_PKG = "${PN}"
+
+# help manpages.bbclass deal with RDEPNDS and postinstall scripts
+PACKAGECONFIG = "manpages"
+PACKAGECONFIG[manpages] = ""
 
 do_configure[noexec] = "1"
 do_compile[noexec] = "1"
-- 
2.11.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] manpages.bbclass: Update RDEPENDS and post install scripts
  2018-06-07  9:01 [PATCH 1/2] manpages.bbclass: Update RDEPENDS and post install scripts Kai Kang
  2018-06-07  9:02 ` [PATCH 2/2] man-pages: inherit manpages Kai Kang
@ 2018-06-07 13:02 ` Alexander Kanavin
  1 sibling, 0 replies; 3+ messages in thread
From: Alexander Kanavin @ 2018-06-07 13:02 UTC (permalink / raw)
  To: Kai Kang; +Cc: openembedded-core

On 06/07/2018 12:01 PM, Kai Kang wrote:
> If a package installs manual files, it should update manual index cache
> after its installation. Add package 'man-db' to RDEPENDS which contains
> command 'mandb' to update the cache. And do the update in the post
> install scripts.
> 

Thanks, this looks good. Hope it passes all the autobuilder tests as well :)

Alex


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-06-07 13:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-07  9:01 [PATCH 1/2] manpages.bbclass: Update RDEPENDS and post install scripts Kai Kang
2018-06-07  9:02 ` [PATCH 2/2] man-pages: inherit manpages Kai Kang
2018-06-07 13:02 ` [PATCH 1/2] manpages.bbclass: Update RDEPENDS and post install scripts Alexander Kanavin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.