Generate fonts cache on host and other fixes
cover Generate fonts cache on host and other fixes
Hi all,
The main addition of this patchset is the ability to generate the fonts cache on host, at do_rootfs time. For that, a new feature has been added to fc-cache and fc-cat in fontconfig package (a --sysroot option basically) and you can find more info on how to use this feature in the comment of the patch itself. I'm working with the fontconfig maintainers to merge this upstream. Also, a new class (fontcache.bbclass) has been added that needs to be included by all font packages, so that the postinst/postrm scriptlets are generated correctly.
Other fixes:
* fix pulseaudio postinstall;
* remove the debugging option from package_ipk/rootfs_ipk bbclass'es because it generates a lot of 'noise' in the log.do_rootfs;
* add a meaningful error message if an intercept hook script fails;
NOTE: the /var/cache directory must NOT be in volatiles in order for the fonts cache to be deployed on target. I sent a patchset yesterday that does exactly that.
Thanks,
Laurentiu
The following changes since commit 7e9cb437b1b720e656f4a33f73c07c5dc7356a2c:
dropbear: fix RPROVIDES (2013-02-04 23:31:02 +0000)
are available in the git repository at:
git://git.yoctoproject.org/poky-contrib lpalcu/fc-rebased
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=lpalcu/fc-rebased
Laurentiu Palcu (8):
add fontcache.bbclass
add qemuwrapper-cross recipe
qemu.bbclass: return qemuwrapper instead of qemu-allarch image.bbclass: add a proper error message if hook script fails
fontconfig: add sysroot option to fc-cache and fc-cat
liberation-fonts: use the new fontcache.bbclass package_ipk, rootfs_ipk: remove the "set -x"
pulseaudio: do not postpone postinstall
meta/classes/fontcache.bbclass | 47 ++ meta/classes/image.bbclass | 4 + meta/classes/package_ipk.bbclass | 2 +- meta/classes/qemu.bbclass | 6 +- meta/classes/rootfs_ipk.bbclass | 2 +- .../recipes-devtools/qemu/qemuwrapper-cross_1.0.bb | 14 + .../fontconfig/fontconfig-2.10.2/97_fontconfig | 1 - ...Add-sysroot-option-to-fc-cache-and-fc-cat.patch | 731 ++++++++++++++++++++ .../fontconfig/fontconfig_2.10.2.bb | 13 +- .../ttf-fonts/liberation-fonts_1.04.bb | 14 +- meta/recipes-multimedia/pulseaudio/pulseaudio.inc | 7 +- 11 files changed, 812 insertions(+), 29 deletions(-) create mode 100644 meta/classes/fontcache.bbclass create mode 100644 meta/recipes-devtools/qemu/qemuwrapper-cross_1.0.bb delete mode 100644 meta/recipes-graphics/fontconfig/fontconfig-2.10.2/97_fontconfig create mode 100644 meta/recipes-graphics/fontconfig/fontconfig-2.10.2/Add-sysroot-option-to-fc-cache-and-fc-cat.patch
Signature · 1 line
1.7.9.5
PATCH 1/8 add fontcache.bbclass
All font packages should inherit this class in order to generate the proper postinst/postrm scriptlets.
The scriptlets will actually create a host intercept hook that will be executed at the end, at do_rootfs time, after all packages have been installed. This is good when there are many font packages.
[YOCTO #2923]
--- meta/classes/fontcache.bbclass | 47 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 meta/classes/fontcache.bbclass
meta/classes/fontcache.bbclass new file +47 -0
@@ -0,0 +1,47 @@ +# +# This class will generate the proper postinst/postrm scriptlets for font +# packages. +# + +DEPENDS += "qemu-native" +inherit qemu + +FONT_PACKAGES ??= "${PN}" + +fontcache_common() { +if [ "x$D" != "x" ] ; then + if [ ! -f $INTERCEPT_DIR/update_font_cache ]; then + cat << "EOF" > $INTERCEPT_DIR/update_font_cache +#!/bin/sh + +${@qemu_run_binary(d, '$D', '/usr/bin/fc-cache')} --sysroot=$D >/dev/null 2>&1 + +if [ $? -ne 0 ]; then + exit 1 +fi + +EOF + fi + exit 0 +fi + +fc-cache +} + +python populate_packages_append() { + font_pkgs = d.getVar('FONT_PACKAGES', True).split() + + for pkg in font_pkgs: + bb.note("adding fonts postinst and postrm scripts to %s" % pkg) + postinst = d.getVar('pkg_postinst_%s' % pkg, True) or d.getVar('pkg_postinst', True) + if not postinst: + postinst = '#!/bin/sh\n' + postinst += d.getVar('fontcache_common', True) + d.setVar('pkg_postinst_%s' % pkg, postinst) + + postrm = d.getVar('pkg_postrm_%s' % pkg, True) or d.getVar('pkg_postrm', True) + if not postrm: + postrm = '#!/bin/sh\n' + postrm += d.getVar('fontcache_common', True) + d.setVar('pkg_postrm_%s' % pkg, postrm) +}
Signature · 1 line
1.7.9.5
Re: [PATCH 1/8] add fontcache.bbclass
W dniu 05.02.2013 10:34, Laurentiu Palcu pisze:
Quoted 7 lines
All font packages should inherit this class in order to generate the proper postinst/postrm scriptlets.
The scriptlets will actually create a host intercept hook that will be executed at the end, at
do_rootfstime, after all packages have been installed. This is good when there are many font packages.
Quoted 7 lines
[YOCTO #2923]
Signed-off-by Laurentiu Palcu <[email protected]>--- meta/classes/fontcache.bbclass | 47 +++++++++++++++++++++++++++++++++++++++++${@qemu_run_binary(d, '$D', '
/usr/bin/fc-cache')} --sysroot=$D >/dev/null 2>&1
What about platform which do not have qemu support? Like AArch64...
| Configuring libpcre-staticdev. | Building from feeds activated! | Running intercept scripts: | > Executing update_font_cache | ERROR: Function failed: do_rootfs (see
/home/hrw/HDD/devel/canonical/aarch64/openembedded/build/tmp-eglibc/work/genericarmv8-oe-linux/linaro-image-sdk/1.0-r2/temp/log.do_rootfs.23211 for further information)
Re: [PATCH 1/8] add fontcache.bbclass
Quoted 18 lines · Marcin Juszkiewicz
W dniu 05.02.2013 10:34, Laurentiu Palcu pisze:
Quoted 7 lines
All font packages should inherit this class in order to generate the proper postinst/postrm scriptlets.
The scriptlets will actually create a host intercept hook that will be executed at the end, at
do_rootfstime, after all packages have been installed. This is good when there are many font packages.Quoted 7 lines
[YOCTO #2923]
Signed-off-by Laurentiu Palcu <[email protected]>--- meta/classes/fontcache.bbclass | 47 +++++++++++++++++++++++++++++++++++++++++${@qemu_run_binary(d, '$D', '
/usr/bin/fc-cache')} --sysroot=$D >/dev/null 2>&1What about platform which do not have qemu support? Like AArch64...
Quoted 7 lines
| Configuring libpcre-staticdev. | Building from feeds activated! | Running intercept scripts: | > Executing update_font_cache | ERROR: Function failed: do_rootfs (see
/home/hrw/HDD/devel/canonical/aarch64/openembedded/build/tmp-eglibc/work/genericarmv8-oe-linux/linaro-image-sdk/1.0-r2/temp/log.do_rootfs.23211for further information)
Ideally the intercept code should fall back to running the postinst on the target if qemu isn't available. Patches welcome to make that happen.
The hard part is this is an "allarch" recipe so we can't disable this conditionally on aarch64. We can disable all intercept scripts I guess.
Or we make these packages arch specific on aarch64 I guess.
Cheers,
Richard
Re: [PATCH 1/8] add fontcache.bbclass
In reply to Marcin JuszkiewiczQuoted 3 lines · Marcin Juszkiewicz
Quoted 1 line
+${@qemu_run_binary(d, '$D', '
/usr/bin/fc-cache')} --sysroot=$D
/dev/null2>&1
What about platform which do not have qemu support? Like AArch64...
There are other places in the oe-core tree that already require working qemu support so I don't think this is a qualitatively new issue. I suspect that in the long term, qemu is going to become another tool that needs targetting to any new architecture, just like gcc, binutils, glibc, linux, javascriptcore and so on.
On the other hand, that "/usr/bin" looks a bit unwholesome to me. :-}
p.
PATCH 2/8 add qemuwrapper-cross recipe
In reply to Laurentiu PalcuThis will just install a wrapper script in STAGING_BINDIR_CROSS that will execute the proper qemu user binary for the current target.
[YOCTO #2599]
--- .../recipes-devtools/qemu/qemuwrapper-cross_1.0.bb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 meta/recipes-devtools/qemu/qemuwrapper-cross_1.0.bb
meta/recipes-devtools/qemu/qemuwrapper-cross_1.0.bb new file +14 -0
@@ -0,0 +1,14 @@ +DESCRIPTION = "Qemu wrapper script" +LICENSE = "MIT" +PR = "r0" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + +inherit qemu + +do_install () { + install -d ${STAGING_BINDIR_CROSS} + + echo "#!/bin/sh" > ${STAGING_BINDIR_CROSS}/qemuwrapper + echo exec env ${@qemu_target_binary(d)} \"\$@\" >> ${STAGING_BINDIR_CROSS}/qemuwrapper + chmod +x ${STAGING_BINDIR_CROSS}/qemuwrapper +}
Signature · 1 line
1.7.9.5
PATCH 3/8 qemu.bbclass: return qemuwrapper instead of qemu-allarch
In reply to Laurentiu PalcuWhen qemu bbclass is inherited from a recipe that is not architecture dependent, qemu_run_binary will return "qemu-allarch". However this binary does not exist. Instead, return "qemuwrapper" which will, in turn, execute the right binary for the target the image was built for.
[YOCTO #2599]
--- meta/classes/qemu.bbclass | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
meta/classes/qemu.bbclass +5 -1
@@ -23,10 +23,14 @@ def qemu_target_binary(data): # ${@qemu_run_binary(d, '$D', '/usr/bin/test_app')} [test_app arguments] # def qemu_run_binary(data, rootfs_path, binary): + qemu_binary = qemu_target_binary(data) + if qemu_binary == "qemu-allarch": + qemu_binary = "qemuwrapper" + dynamic_loader = rootfs_path + '$(readelf -l ' + rootfs_path + \ binary + '| grep "Requesting program interpreter"|sed -e \'s/^.*\[.*: \(.*\)\]/\\1/\')' library_path = rootfs_path + data.getVar("base_libdir", True) + ":" + \ rootfs_path + data.getVar("libdir", True) - return qemu_target_binary(data) + " " + dynamic_loader + " --library-path " + library_path \ + return qemu_binary + " " + dynamic_loader + " --library-path " + library_path \ + " " + rootfs_path + binary
Signature · 1 line
1.7.9.5
PATCH 4/8 image.bbclass: add a proper error message if hook script fails
In reply to Laurentiu Palcu--- meta/classes/image.bbclass | 4 ++++ 1 file changed, 4 insertions(+)
meta/classes/image.bbclass +4 -0
@@ -10,6 +10,7 @@ inherit gzipnative LICENSE = "MIT" PACKAGES = "" +DEPENDS += "qemuwrapper-cross" RDEPENDS += "${IMAGE_INSTALL} ${LINGUAS_INSTALL} ${NORMAL_FEATURE_INSTALL} ${ROOTFS_BOOTSTRAP_INSTALL}" RRECOMMENDS += "${NORMAL_FEATURE_INSTALL_OPTIONAL}"
@@ -197,6 +198,9 @@ run_intercept_scriptlets () { echo "> Executing $script" chmod +x $script ./$script + if [ $? -ne 0 ]; then + echo "ERROR: intercept script \"$script\" failed!" + fi done fi }
Signature · 1 line
1.7.9.5
PATCH 5/8 fontconfig: add sysroot option to fc-cache and fc-cat
In reply to Laurentiu PalcuThis is needed in order to be able to generate the cache on host.
Additionally, remove the volatile config file, as /var/cache was moved out of tmpfs.
[YOCTO #2599]
--- .../fontconfig/fontconfig-2.10.2/97_fontconfig | 1 - ...Add-sysroot-option-to-fc-cache-and-fc-cat.patch | 731 ++++++++++++++++++++ .../fontconfig/fontconfig_2.10.2.bb | 13 +- 3 files changed, 735 insertions(+), 10 deletions(-) delete mode 100644 meta/recipes-graphics/fontconfig/fontconfig-2.10.2/97_fontconfig create mode 100644 meta/recipes-graphics/fontconfig/fontconfig-2.10.2/Add-sysroot-option-to-fc-cache-and-fc-cat.patch
meta/recipes-graphics/fontconfig/fontconfig-2.10.2/97_fontconfig deleted +0 -1
@@ -1 +0,0 @@ -d root root 0755 /var/cache/fontconfig none
meta/recipes-graphics/fontconfig/fontconfig-2.10.2/Add-sysroot-option-to-fc-cache-and-fc-cat.patch new file +731 -0
731 lines not on this page · raw message
meta/recipes-graphics/fontconfig/fontconfig_2.10.2.bb +4 -9
@@ -14,17 +14,18 @@ BUGTRACKER = "https://bugs.freedesktop.org/enter_bug.cgi?product=fontconfig" LICENSE = "MIT-style & MIT & PD" LIC_FILES_CHKSUM = "file://COPYING;md5=dc5b39c592e47a22dbec44855988d2a0 \ file://src/fcfreetype.c;endline=45;md5=5d9513e3196a1fbfdfa94051c09dfc84 \ - file://src/fccache.c;beginline=1109;endline=1124;md5=0326cfeb4a7333dd4dd25fbbc4b9f27f" + file://src/fccache.c;beginline=1182;endline=1197;md5=0326cfeb4a7333dd4dd25fbbc4b9f27f" SECTION = "libs" DEPENDS = "expat freetype zlib" -PR = "r0" +PR = "r1" SRC_URI = "http://fontconfig.org/release/fontconfig-${PV}.tar.gz \ + file://Add-sysroot-option-to-fc-cache-and-fc-cat.patch \ file://fix-pkgconfig.patch \ - file://97_fontconfig" + " SRC_URI[md5sum] = "025e08b3d7fe45c433de5718e441ed15" SRC_URI[sha256sum] = "5c3bf994bb6d6303bbf1e641eaa4b431932138dc90de33642e5845e31e1fdfd6"
@@ -82,9 +83,3 @@ do_configure_append () { } -do_install_append() { - install -d ${D}${sysconfdir}/default/volatiles - install -m 0644 ${WORKDIR}/97_fontconfig ${D}${sysconfdir}/default/volatiles - rmdir ${D}${localstatedir}/cache/fontconfig - rmdir ${D}${localstatedir}/cache/ -}
Signature · 1 line
1.7.9.5
PATCH 6/8 liberation-fonts: use the new fontcache.bbclass
In reply to Laurentiu PalcuThis will add the proper postinst/postrm scriptlets.
[YOCTO #2599]
--- .../ttf-fonts/liberation-fonts_1.04.bb | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)
meta/recipes-graphics/ttf-fonts/liberation-fonts_1.04.bb +4 -10
@@ -9,10 +9,12 @@ SECTION = "x11/fonts" LICENSE = "GPLv2" LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f" RDEPENDS_${PN} = "fontconfig-utils" -PR = "r2" +PR = "r3" PE = "1" -inherit allarch +inherit allarch fontcache + +FONT_PACKAGES = "${PN}" SRC_URI = "https://fedorahosted.org/releases/l/i/liberation-fonts/liberation-fonts-${PV}.tar.gz \ file://30-liberation-aliases.conf"
@@ -33,13 +35,5 @@ do_install () { install -m 0644 License.txt ${D}${datadir}/doc/${PN}/ } -pkg_postinst_${PN} () { -#!/bin/sh -if [ "x$D" != "x" ] ; then - exit 1 -fi -fc-cache -} - PACKAGES = "${PN}" FILES_${PN} += "${sysconfdir} ${datadir}"
Signature · 1 line
1.7.9.5
PATCH 7/8 package_ipk, rootfs_ipk: remove the "set -x"
In reply to Laurentiu PalcuComment the "set -x" lines since these will add a lot of extra, not always necessary, debug messages in the log.do_rootfs.
[YOCTO #2599]
--- meta/classes/package_ipk.bbclass | 2 +- meta/classes/rootfs_ipk.bbclass | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
meta/classes/package_ipk.bbclass +1 -1
@@ -196,7 +196,7 @@ ipk_log_check() { # Update the Packages index files in ${DEPLOY_DIR_IPK} # package_update_index_ipk () { - set -x + #set -x ipkgarchs="${ALL_MULTILIB_PACKAGE_ARCHS} ${SDK_PACKAGE_ARCHS}"
meta/classes/rootfs_ipk.bbclass +1 -1
@@ -26,7 +26,7 @@ BAD_RECOMMENDATIONS ?= "" MULTILIBRE_ALLOW_REP = "${opkglibdir}" fakeroot rootfs_ipk_do_rootfs () { - set -x + #set -x rm -f ${IPKGCONF_TARGET} touch ${IPKGCONF_TARGET}
Signature · 1 line
1.7.9.5
PATCH 8/8 pulseaudio: do not postpone postinstall
In reply to Laurentiu PalcuSince populate-volatile.sh will run everytime the device boots, no need to postpone the postinstall when the rootfs is created.
[YOCTO #3840]
--- meta/recipes-multimedia/pulseaudio/pulseaudio.inc | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
meta/recipes-multimedia/pulseaudio/pulseaudio.inc +1 -6
@@ -99,12 +99,7 @@ CONFFILES_pulseaudio-server = "\ " pkg_postinst_${PN}-server() { - # can't do this offline - if [ "x$D" != "x" ]; then - exit 1 - fi - - if [ -e ${sysconfdir}/init.d/populate-volatile.sh ] ; then + if [ -z "$D" ] && [ -e ${sysconfdir}/init.d/populate-volatile.sh ] ; then ${sysconfdir}/init.d/populate-volatile.sh update fi }
Signature · 1 line
1.7.9.5