From a73c25d2ded3a72159f2ce527e7307808c734686 Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Mon, 23 Jul 2012 10:43:22 +0100 Subject: classes/rootfs_rpm: improve speed of RPM rootfs construction Improve the performance of the RPM backend during do_rootfs by performing most of the package name to file resolution in a separate utility written in C, processing the entire list of packages at once rather than running rpm on the command line which loads the RPM database for every package. (From OE-Core rev: 9135d351ba7cb21e50239d2b310565680bd4fdca) Signed-off-by: Paul Eggleton Signed-off-by: Richard Purdie --- meta/classes/package_rpm.bbclass | 109 ++++++++++++++++----------------------- meta/classes/rootfs_rpm.bbclass | 1 + 2 files changed, 46 insertions(+), 64 deletions(-) (limited to 'meta/classes') diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass index 983be4cfd0..29018e9cca 100644 --- a/meta/classes/package_rpm.bbclass +++ b/meta/classes/package_rpm.bbclass @@ -197,6 +197,45 @@ rpm_update_pkg () { fi } +process_pkg_list_rpm() { + local insttype=$1 + shift + local pkgs="$@" + local confbase=${INSTALL_CONFBASE_RPM} + + echo -n > ${target_rootfs}/install/base_archs.pkglist + echo -n > ${target_rootfs}/install/ml_archs.pkglist + + for pkg in $pkgs; do + echo "Processing $pkg..." + + archvar=base_archs + ml_pkg=$pkg + for i in ${MULTILIB_PREFIX_LIST} ; do + subst=${pkg#${i}-} + if [ $subst != $pkg ] ; then + ml_pkg=$subst + archvar=ml_archs + break + fi + done + + echo $ml_pkg >> ${target_rootfs}/install/$archvar.pkglist + done + + local manifestpfx="install" + local extraopt="" + if [ "$insttype" = "attemptonly" ] ; then + manifestpfx="install_attemptonly" + extraopt="-i" + fi + + rpmresolve $extraopt ${confbase}-base_archs.conf ${target_rootfs}/install/base_archs.pkglist >> ${target_rootfs}/install/${manifestpfx}.manifest + if [ -s ${target_rootfs}/install/ml_archs.pkglist ] ; then + rpmresolve $extraopt ${confbase}-ml_archs.conf ${target_rootfs}/install/ml_archs.pkglist >> ${target_rootfs}/install/${manifestpfx}_multilib.manifest + fi +} + # # install a bunch of packages using rpm # the following shell variables needs to be set before calling this func: @@ -256,55 +295,12 @@ package_install_internal_rpm () { # Uclibc builds don't provide this stuff... if [ x${TARGET_OS} = "xlinux" ] || [ x${TARGET_OS} = "xlinux-gnueabi" ] ; then if [ ! -z "${package_linguas}" ]; then - for pkg in ${package_linguas}; do - echo "Processing $pkg..." - - archvar=base_archs - manifest=install.manifest - ml_prefix=`echo ${pkg} | cut -d'-' -f1` - ml_pkg=$pkg - for i in ${MULTILIB_PREFIX_LIST} ; do - if [ ${ml_prefix} = ${i} ]; then - ml_pkg=$(echo ${pkg} | sed "s,^${ml_prefix}-\(.*\),\1,") - archvar=ml_archs - manifest=install_multilib.manifest - break - fi - done - - pkg_name=$(resolve_package_rpm ${confbase}-${archvar}.conf ${ml_pkg}) - if [ -z "$pkg_name" ]; then - echo "Unable to find package $pkg ($ml_pkg)!" - exit 1 - fi - echo $pkg_name >> ${target_rootfs}/install/${manifest} - done + process_pkg_list_rpm linguas ${package_linguas} fi fi - if [ ! -z "${package_to_install}" ]; then - for pkg in ${package_to_install} ; do - echo "Processing $pkg..." - archvar=base_archs - manifest=install.manifest - ml_prefix=`echo ${pkg} | cut -d'-' -f1` - ml_pkg=$pkg - for i in ${MULTILIB_PREFIX_LIST} ; do - if [ ${ml_prefix} = ${i} ]; then - ml_pkg=$(echo ${pkg} | sed "s,^${ml_prefix}-\(.*\),\1,") - archvar=ml_archs - manifest=install_multilib.manifest - break - fi - done - - pkg_name=$(resolve_package_rpm ${confbase}-${archvar}.conf ${ml_pkg}) - if [ -z "$pkg_name" ]; then - echo "Unable to find package $pkg ($ml_pkg)!" - exit 1 - fi - echo $pkg_name >> ${target_rootfs}/install/${manifest} - done + if [ ! -z "${package_to_install}" ]; then + process_pkg_list_rpm default ${package_to_install} fi # Normal package installation @@ -324,24 +320,9 @@ package_install_internal_rpm () { if [ ! -z "${package_attemptonly}" ]; then echo "Adding attempt only packages..." - for pkg in ${package_attemptonly} ; do - echo "Processing $pkg..." - archvar=base_archs - ml_prefix=`echo ${pkg} | cut -d'-' -f1` - ml_pkg=$pkg - for i in ${MULTILIB_PREFIX_LIST} ; do - if [ ${ml_prefix} = ${i} ]; then - ml_pkg=$(echo ${pkg} | sed "s,^${ml_prefix}-\(.*\),\1,") - archvar=ml_archs - break - fi - done - - pkg_name=$(resolve_package_rpm ${confbase}-${archvar}.conf ${ml_pkg}) - if [ -z "$pkg_name" ]; then - echo "Note: Unable to find package $pkg ($ml_pkg) -- PACKAGE_INSTALL_ATTEMPTONLY" - continue - fi + process_pkg_list_rpm attemptonly ${package_attemptonly} + cat ${target_rootfs}/install/install_attemptonly.manifest | while read pkg_name + do echo "Attempting $pkg_name..." >> "`dirname ${BB_LOGFILE}`/log.do_${task}_attemptonly.${PID}" ${RPM} --predefine "_rpmds_sysinfo_path ${target_rootfs}/etc/rpm/sysinfo" \ --predefine "_rpmrc_platform_path ${target_rootfs}/etc/rpm/platform" \ diff --git a/meta/classes/rootfs_rpm.bbclass b/meta/classes/rootfs_rpm.bbclass index 4551f7a608..cd9c5ab778 100644 --- a/meta/classes/rootfs_rpm.bbclass +++ b/meta/classes/rootfs_rpm.bbclass @@ -11,6 +11,7 @@ IMAGE_ROOTFS_EXTRA_SPACE_append = "${@base_contains("PACKAGE_INSTALL", "zypper", ROOTFS_PKGMANAGE_BOOTSTRAP = "" do_rootfs[depends] += "rpm-native:do_populate_sysroot" +do_rootfs[depends] += "rpmresolve-native:do_populate_sysroot" # Needed for update-alternatives do_rootfs[depends] += "opkg-native:do_populate_sysroot" -- cgit v1.2.3-54-g00ecf