From 38c2f66ea79f3ee3fed1757160340548e7687181 Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Thu, 22 Dec 2011 14:46:32 +0000 Subject: classes/image: implement generic locale package installation Let each package-specific rootfs implementation provide basic functions to query the existence of a package and install a list of packages and then have a generic install function so this logic is in one place. Note: unlike previous versions of this code in OE-Core this uses the IMAGE_LINGUAS variable and not IMAGE_LOCALES - note that IMAGE_LINGUAS was what was used in OE-Classic and it is already used in OE-Core in order to install locale-base-*. This will mean that if IMAGE_LINGUAS is left at the default you will now get more packages installed. If you don't want these language support packages then you should set IMAGE_LINGUAS explicitly. This restores locale installation to the same state as OE-Classic, only we now support all the packaging backends. (From OE-Core rev: c0fc36f8629a6abb9a7b542df8a2857526547a31) Signed-off-by: Paul Eggleton Signed-off-by: Richard Purdie --- meta/classes/rootfs_deb.bbclass | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) (limited to 'meta/classes/rootfs_deb.bbclass') diff --git a/meta/classes/rootfs_deb.bbclass b/meta/classes/rootfs_deb.bbclass index bef055c6f5..b6c706c580 100644 --- a/meta/classes/rootfs_deb.bbclass +++ b/meta/classes/rootfs_deb.bbclass @@ -8,8 +8,18 @@ ROOTFS_PKGMANAGE_BOOTSTRAP = "run-postinsts" do_rootfs[depends] += "dpkg-native:do_populate_sysroot apt-native:do_populate_sysroot" do_rootfs[recrdeptask] += "do_package_write_deb" +DEB_POSTPROCESS_COMMANDS = "rootfs_install_all_locales; " + opkglibdir = "${localstatedir}/lib/opkg" +deb_package_setflag() { + sed -i -e "/^Package: $2\$/{n; s/Status: install ok .*/Status: install ok $1/;}" ${IMAGE_ROOTFS}/var/lib/dpkg/status +} + +deb_package_getflag() { + cat ${IMAGE_ROOTFS}/var/lib/dpkg/status | sed -n -e "/^Package: $2\$/{n; s/Status: install ok .*/$1/; p}" +} + fakeroot rootfs_deb_do_rootfs () { set +e @@ -28,25 +38,18 @@ fakeroot rootfs_deb_do_rootfs () { export INSTALL_TASK_DEB="rootfs" package_install_internal_deb - + ${DEB_POSTPROCESS_COMMANDS} export D=${IMAGE_ROOTFS} export OFFLINE_ROOT=${IMAGE_ROOTFS} export IPKG_OFFLINE_ROOT=${IMAGE_ROOTFS} export OPKG_OFFLINE_ROOT=${IMAGE_ROOTFS} - _flag () { - sed -i -e "/^Package: $2\$/{n; s/Status: install ok .*/Status: install ok $1/;}" ${IMAGE_ROOTFS}/var/lib/dpkg/status - } - _getflag () { - cat ${IMAGE_ROOTFS}/var/lib/dpkg/status | sed -n -e "/^Package: $2\$/{n; s/Status: install ok .*/$1/; p}" - } - # Attempt to run preinsts # Mark packages with preinst failures as unpacked for i in ${IMAGE_ROOTFS}/var/lib/dpkg/info/*.preinst; do if [ -f $i ] && ! sh $i; then - _flag unpacked `basename $i .preinst` + deb_package_setflag unpacked `basename $i .preinst` fi done @@ -54,7 +57,7 @@ fakeroot rootfs_deb_do_rootfs () { # Mark packages with postinst failures as unpacked for i in ${IMAGE_ROOTFS}/var/lib/dpkg/info/*.postinst; do if [ -f $i ] && ! sh $i configure; then - _flag unpacked `basename $i .postinst` + deb_package_setflag unpacked `basename $i .postinst` fi done @@ -104,3 +107,17 @@ list_package_depends() { list_package_recommends() { ${DPKG_QUERY_COMMAND} -s $1 | grep ^Recommends | sed -e 's/^Recommends: //' -e 's/,//g' -e 's:([=<>]* [0-9a-zA-Z.~\-]*)::g' } + +rootfs_check_package_exists() { + if [ `apt-cache showpkg $1 | wc -l` -gt 2 ]; then + echo $1 + fi +} + +rootfs_install_packages() { + ${STAGING_BINDIR_NATIVE}/apt-get install $@ --force-yes --allow-unauthenticated + + for pkg in $@ ; do + deb_package_setflag installed $pkg + done +} -- cgit v1.2.3-54-g00ecf