1
0
mirror of https://git.yoctoproject.org/poky synced 2026-07-16 15:57:04 +00:00

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 <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Paul Eggleton
2012-07-23 10:43:22 +01:00
committed by Richard Purdie
parent 656726ad60
commit a73c25d2de
4 changed files with 341 additions and 64 deletions
+45 -64
View File
@@ -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
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" \
+1
View File
@@ -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"