Create GIO module cache on postinst/rm
v2 cover Create GIO module cache on postinst/rm
Branch updated. Changes since v1:
* Fix whitespace issues
* Install gio-querymodules in $libexec (to placate debian renamer)
* Make binary name unique per multilib ("${mlprefix}gio-querymodules")
* Add a patch to fix odd file placemements in glib.inc
Please take a look at the multilib binary install: I couldn't find an example of that so added the bit in do_install_append() -- maybe there's a nicer way to do that?
Original cover letter:
GIO module cache is used by GIO at runtime to avoid opening all modules just to find out which extension points they implement. The patch uses gio-querymodules tool to regenerate the cache at postinst/postrm.
So nothing is really broken currently, this is a runtime optimization.
Cheers,
Jussi
The following changes since commit 8037ba4d86a65ee296cfdcee736dfd614c568818:
bitbake: bb/tests/fetch: Update cups url (2016-03-21 12:43:12 +0000)
are available in the git repository at:
git://git.yoctoproject.org/poky-contrib jku/gio-module-cache
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=jku/gio-module-cache
Jussi Kukkonen (3):
glib-2.0: Install gio-querymodules in main package
gio-module-cache: Add class for Gio modules glib-2.0: Fix packaging
meta/classes/gio-module-cache.bbclass | 37 ++++++++++++++++++++++ ...stall-gio-querymodules-as-libexec_PROGRAM.patch | 31 ++++++++++++++++++ meta/recipes-core/glib-2.0/glib-2.0_2.46.2.bb | 1 + meta/recipes-core/glib-2.0/glib.inc | 29 +++++++++++++---- .../glib-networking/glib-networking_2.46.1.bb | 2 +- meta/recipes-gnome/gnome/gconf_3.2.6.bb | 2 +- .../postinst-intercepts/update_gio_module_cache | 7 ++++ 7 files changed, 100 insertions(+), 9 deletions(-) create mode 100644 meta/classes/gio-module-cache.bbclass create mode 100644 meta/recipes-core/glib-2.0/glib-2.0/0001-Install-gio-querymodules-as-libexec_PROGRAM.patch create mode 100644 scripts/postinst-intercepts/update_gio_module_cache
Signature · 1 line
2.1.4
PATCH v2 1/3 glib-2.0: Install gio-querymodules in main package
gio-querymodules should be used whenever new Gio modules are installed (to regenerate the module cache) so it should be available by default. Each multilib is going to need its own variant (because the tool actually dlopens the modules when cache is generated), so it's packaged as ${libexecdir}/${MLPREFIX}gio-querymodules
--- ...stall-gio-querymodules-as-libexec_PROGRAM.patch | 31 ++++++++++++++++++++++ meta/recipes-core/glib-2.0/glib-2.0_2.46.2.bb | 1 + meta/recipes-core/glib-2.0/glib.inc | 13 +++++++-- 3 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 meta/recipes-core/glib-2.0/glib-2.0/0001-Install-gio-querymodules-as-libexec_PROGRAM.patch
meta/recipes-core/glib-2.0/glib-2.0/0001-Install-gio-querymodules-as-libexec_PROGRAM.patch new file +31 -0
@@ -0,0 +1,31 @@ +From 80682c171ccb27d01343d4cfcfb4dd49b7863ccc Mon Sep 17 00:00:00 2001 +From: Jussi Kukkonen <[email protected]> +Date: Tue, 22 Mar 2016 15:14:58 +0200 +Subject: [PATCH] Install gio-querymodules as libexec_PROGRAM + +We want to install this binary with the gio library, and debian +renamer does not cope with library packages with files in ${bindir} + +Signed-off-by: Jussi Kukkonen <[email protected]> +Upstream-Status: Inappropriate [OE specific] +--- + gio/Makefile.am | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/gio/Makefile.am b/gio/Makefile.am +index b7f91cc..4d81cc0 100644 +--- a/gio/Makefile.am ++++ b/gio/Makefile.am +@@ -702,7 +702,8 @@ gio.def: libgio-2.0.la + gio-2.0.lib: libgio-2.0.la gio.def + $(AM_V_GEN) lib.exe -machine:@LIB_EXE_MACHINE_FLAG@ -name:libgio-2.0-$(LT_CURRENT_MINUS_AGE).dll -def:$(builddir)/gio.def -out:$@ + +-bin_PROGRAMS = gio-querymodules glib-compile-schemas glib-compile-resources gsettings ++bin_PROGRAMS = glib-compile-schemas glib-compile-resources gsettings ++libexec_PROGRAMS = gio-querymodules + + glib_compile_resources_LDADD = libgio-2.0.la \ + $(top_builddir)/gobject/libgobject-2.0.la \ +-- +2.1.4 +
meta/recipes-core/glib-2.0/glib-2.0_2.46.2.bb +1 -0
@@ -16,6 +16,7 @@ SRC_URI = "${GNOME_MIRROR}/glib/${SHRT_VER}/glib-${PV}.tar.xz \ file://0001-Remove-the-warning-about-deprecated-paths-in-schemas.patch \ file://Enable-more-tests-while-cross-compiling.patch \ file://gi-exclude.patch \ + file://0001-Install-gio-querymodules-as-libexec_PROGRAM.patch \ " SRC_URI_append_class-native = " file://glib-gettextize-dir.patch \
meta/recipes-core/glib-2.0/glib.inc +11 -2
@@ -48,8 +48,12 @@ do_configure_prepend() { sed -i -e '1s,#!.*,#!${USRBINPATH}/env python,' ${S}/gio/gdbus-2.0/codegen/gdbus-codegen.in } -FILES_${PN} = "${libdir}/lib*${SOLIBS} ${libdir}/gio ${datadir}/glib-2.0/schemas \ - ${datadir}/glib-2.0/gettext/mkinstalldirs ${datadir}/glib-2.0/gettext/po/Makefile.in.in" +FILES_${PN} = "${libdir}/lib*${SOLIBS} \ + ${libdir}/gio \ + ${libexecdir}/*gio-querymodules \ + ${datadir}/glib-2.0/schemas \ + ${datadir}/glib-2.0/gettext/mkinstalldirs \ + ${datadir}/glib-2.0/gettext/po/Makefile.in.in" FILES_${PN}-dev += "${libdir}/glib-2.0/include \ ${libdir}/gio/modules/lib*${SOLIBSDEV} \ ${libdir}/gio/modules/*.la"
@@ -81,6 +85,11 @@ do_install_append () { rm ${D}${datadir}/installed-tests/glib/gdbus-serialization.test fi fi + + # Make sure gio-querymodules is unique among multilibs + if test "x${MLPREFIX}" != "x"; then + mv ${D}${libexecdir}/gio-querymodules ${D}${libexecdir}/${MLPREFIX}gio-querymodules + fi } do_install_append_libc-musl () {
Signature · 1 line
2.1.4
PATCH v2 2/3 gio-module-cache: Add class for Gio modules
The new class uses gio-querymodules tool on postinst and postrm. This regenerates the module cache which is useful to avoid loading modules that are not needed at runtime: If a Gio module is not listed in the cache file it will always get loaded.
* Add a postinst-intercept 'gio-module-cache': it runs gio-querymodules using qemuwrapper. This is required because the tool actually loads the modules to generate the cache.
* Add a gio-module-cache class that adds postinstall and postrm scripts. In the sysroot population case use the new intercept.
* Inherit the new class in glib-2.0, glib-networking and gconf.
Fixes [YOCTO #9241].
--- meta/classes/gio-module-cache.bbclass | 37 ++++++++++++++++++++++ meta/recipes-core/glib-2.0/glib.inc | 2 +- .../glib-networking/glib-networking_2.46.1.bb | 2 +- meta/recipes-gnome/gnome/gconf_3.2.6.bb | 2 +- .../postinst-intercepts/update_gio_module_cache | 7 ++++ 5 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 meta/classes/gio-module-cache.bbclass create mode 100644 scripts/postinst-intercepts/update_gio_module_cache
meta/classes/gio-module-cache.bbclass new file +37 -0
@@ -0,0 +1,37 @@ +DEPENDS += "qemu-native" +inherit qemu + +GIO_MODULE_PACKAGES ??= "${PN}" + +gio_module_cache_common() { +if [ "x$D" != "x" ]; then + $INTERCEPT_DIR/postinst_intercept update_gio_module_cache ${PKG} \ + mlprefix=${MLPREFIX} \ + binprefix=${MLPREFIX} \ + libdir=${libdir} \ + base_libdir=${base_libdir} \ + bindir=${bindir} +else + ${libexecdir}/${MLPREFIX}gio-querymodules ${libdir}/gio/modules/ +fi +} + +python populate_packages_append () { + packages = d.getVar('GIO_MODULE_PACKAGES', True).split() + + for pkg in packages: + bb.note("adding gio-module-cache postinst and postrm scripts to %s" % pkg) + + postinst = d.getVar('pkg_postinst_%s' % pkg, True) + if not postinst: + postinst = '#!/bin/sh\n' + postinst += d.getVar('gio_module_cache_common', True) + d.setVar('pkg_postinst_%s' % pkg, postinst) + + postrm = d.getVar('pkg_postrm_%s' % pkg, True) + if not postrm: + postrm = '#!/bin/sh\n' + postrm += d.getVar('gio_module_cache_common', True) + d.setVar('pkg_postrm_%s' % pkg, postrm) +} +
meta/recipes-core/glib-2.0/glib.inc +1 -1
@@ -27,7 +27,7 @@ PACKAGES =+ "${PN}-utils ${PN}-codegen" LEAD_SONAME = "libglib-2.0.*" FILES_${PN}-utils = "${bindir}/* ${datadir}/glib-2.0/gettext" -inherit autotools gettext gtk-doc pkgconfig ptest-gnome upstream-version-is-even bash-completion +inherit autotools gettext gtk-doc pkgconfig ptest-gnome upstream-version-is-even bash-completion gio-module-cache S = "${WORKDIR}/glib-${PV}"
meta/recipes-core/glib-networking/glib-networking_2.46.1.bb +1 -1
@@ -22,7 +22,7 @@ PACKAGECONFIG[pkcs11] = "--with-pkcs11,--without-pkcs11,p11-kit" EXTRA_OECONF = "--without-gnome-proxy" -inherit gnomebase gettext upstream-version-is-even +inherit gnomebase gettext upstream-version-is-even gio-module-cache FILES_${PN} += "${libdir}/gio/modules/libgio*.so ${datadir}/dbus-1/services/" FILES_${PN}-dev += "${libdir}/gio/modules/libgio*.la"
meta/recipes-gnome/gnome/gconf_3.2.6.bb +1 -1
@@ -5,7 +5,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=55ca817ccb7d5b5b66355690e9abc605" DEPENDS = "glib-2.0 dbus dbus-glib libxml2 intltool-native" -inherit gnomebase gtk-doc gettext gobject-introspection +inherit gnomebase gtk-doc gettext gobject-introspection gio-module-cache SRC_URI = "${GNOME_MIRROR}/GConf/${@gnome_verdir("${PV}")}/GConf-${PV}.tar.xz;name=archive \ file://remove_plus_from_invalid_characters_list.patch \
scripts/postinst-intercepts/update_gio_module_cache new file +7 -0
@@ -0,0 +1,7 @@ +#!/bin/sh + +set -e + +PSEUDO_UNLOAD=1 qemuwrapper -L $D -E LD_LIBRARY_PATH=$D${libdir}:$D${base_libdir} \ + $D${libexecdir}/${binprefix}gio-querymodules $D${libdir}/gio/modules/ +
Signature · 1 line
2.1.4
PATCH v2 3/3 glib-2.0: Fix packaging
In reply to Jussi Kukkonen* move gdbus-codegen to ${PN}-codegen
* move other development tools and data files to ${PN}-dev
* remove references to non-existent paths
--- meta/recipes-core/glib-2.0/glib.inc | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)
meta/recipes-core/glib-2.0/glib.inc +13 -7
@@ -22,10 +22,9 @@ DEPENDS_append = " ${@bb.utils.contains('PTEST_ENABLED', '1', ' dbus', '', d)}" DEPENDS_class-native = "pkgconfig-native gettext-native libffi-native zlib-native" DEPENDS_class-nativesdk = "nativesdk-libtool nativesdk-gettext nativesdk-libffi nativesdk-zlib glib-2.0-native" -PACKAGES =+ "${PN}-utils ${PN}-codegen" +PACKAGES += "${PN}-codegen ${PN}-utils" LEAD_SONAME = "libglib-2.0.*" -FILES_${PN}-utils = "${bindir}/* ${datadir}/glib-2.0/gettext" inherit autotools gettext gtk-doc pkgconfig ptest-gnome upstream-version-is-even bash-completion gio-module-cache
@@ -51,14 +50,21 @@ do_configure_prepend() { FILES_${PN} = "${libdir}/lib*${SOLIBS} \ ${libdir}/gio \ ${libexecdir}/*gio-querymodules \ - ${datadir}/glib-2.0/schemas \ - ${datadir}/glib-2.0/gettext/mkinstalldirs \ - ${datadir}/glib-2.0/gettext/po/Makefile.in.in" + ${datadir}/glib-2.0/schemas" FILES_${PN}-dev += "${libdir}/glib-2.0/include \ ${libdir}/gio/modules/lib*${SOLIBSDEV} \ - ${libdir}/gio/modules/*.la" + ${libdir}/gio/modules/*.la \ + ${bindir}/glib-genmarshal \ + ${bindir}/glib-gettextize \ + ${bindir}/glib-mkenums \ + ${bindir}/glib-compile-schemas \ + ${bindir}/glib-compile-resources \ + ${datadir}/glib-2.0/gettext/po/Makefile.in.in \ + ${datadir}/glib-2.0/schemas/gschema.dtd" FILES_${PN}-dbg += "${datadir}/glib-2.0/gdb ${datadir}/gdb" -FILES_${PN}-codegen = "${datadir}/glib-2.0/codegen/*.py" +FILES_${PN}-codegen = "${datadir}/glib-2.0/codegen/*.py \ + ${bindir}/gdbus-codegen" +FILES_${PN}-utils = "${bindir}/*" ARM_INSTRUCTION_SET_armv4 = "arm" ARM_INSTRUCTION_SET_armv5 = "arm"
Signature · 1 line
2.1.4