Skip to contentSkip to conversation

graphviz: add pkg_postinst script

PATCH Superseded [email protected] 1 participant 1 message Mar 28, 2022

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 graphviz: add pkg_postinst script

From: Kai Kang <[email protected]>

It needs to run dot -c first before call 'dot' command, otherwise it fails with:

| Format: "png" not recognized. No formats found.
| Perhaps "dot -c" needs to be run (with installer's privileges) to
register the plugins?

---
 .../graphviz/graphviz_2.50.0.bb                 | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
meta-oe/recipes-graphics/graphviz/graphviz_2.50.0.bb +16 -1
index 0eca7fdba..04e5eaa6a 100644
@@ -17,7 +17,7 @@ DEPENDS = " \
 DEPENDS:append:class-target = " ${BPN}-native"
 DEPENDS:append:class-nativesdk = " ${BPN}-native"
 
-inherit autotools-brokensep pkgconfig gettext
+inherit autotools-brokensep pkgconfig gettext qemu
 
 SRC_URI = "https://gitlab.com/api/v4/projects/4207231/packages/generic/${BPN}-releases/${PV}/${BP}.tar.xz \
            "
@@ -81,6 +81,21 @@ graphviz_sstate_postinst() {
 }
 SYSROOT_PREPROCESS_FUNCS:append:class-native = " graphviz_sstate_postinst"
 
+pkg_postinst:${PN} () {
+    if [ -n "$D" ]; then
+        ${@qemu_run_binary(d, '$D', '${bindir}/dot')} -c
+    else
+        dot -c
+    fi
+}
+
+pkg_postrm:${PN} () {
+    rm -f $D${libdir}/graphviz/config*
+    rmdir --ignore-fail-on-non-empty $D${libdir}/graphviz
+}
+
+PACKAGE_WRITE_DEPS += "qemu-native"
+
 PACKAGES =+ "${PN}-python ${PN}-perl ${PN}-demo"
 
 FILES:${PN}-python += "${libdir}/python*/site-packages/ ${libdir}/graphviz/python/"
Signature · 1 line
2.17.1