summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2012-07-23 10:43:22 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-07-29 10:16:14 +0100
commita73c25d2ded3a72159f2ce527e7307808c734686 (patch)
tree5e27f29a2b6c6b91cf20a64508878646013e2ba7 /meta/classes
parent656726ad6044d8b7e5661251a985770c93cb9242 (diff)
downloadpoky-a73c25d2ded3a72159f2ce527e7307808c734686.tar.gz
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>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/package_rpm.bbclass109
-rw-r--r--meta/classes/rootfs_rpm.bbclass1
2 files changed, 46 insertions, 64 deletions
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 () {
197 fi 197 fi
198} 198}
199 199
200process_pkg_list_rpm() {
201 local insttype=$1
202 shift
203 local pkgs="$@"
204 local confbase=${INSTALL_CONFBASE_RPM}
205
206 echo -n > ${target_rootfs}/install/base_archs.pkglist
207 echo -n > ${target_rootfs}/install/ml_archs.pkglist
208
209 for pkg in $pkgs; do
210 echo "Processing $pkg..."
211
212 archvar=base_archs
213 ml_pkg=$pkg
214 for i in ${MULTILIB_PREFIX_LIST} ; do
215 subst=${pkg#${i}-}
216 if [ $subst != $pkg ] ; then
217 ml_pkg=$subst
218 archvar=ml_archs
219 break
220 fi
221 done
222
223 echo $ml_pkg >> ${target_rootfs}/install/$archvar.pkglist
224 done
225
226 local manifestpfx="install"
227 local extraopt=""
228 if [ "$insttype" = "attemptonly" ] ; then
229 manifestpfx="install_attemptonly"
230 extraopt="-i"
231 fi
232
233 rpmresolve $extraopt ${confbase}-base_archs.conf ${target_rootfs}/install/base_archs.pkglist >> ${target_rootfs}/install/${manifestpfx}.manifest
234 if [ -s ${target_rootfs}/install/ml_archs.pkglist ] ; then
235 rpmresolve $extraopt ${confbase}-ml_archs.conf ${target_rootfs}/install/ml_archs.pkglist >> ${target_rootfs}/install/${manifestpfx}_multilib.manifest
236 fi
237}
238
200# 239#
201# install a bunch of packages using rpm 240# install a bunch of packages using rpm
202# the following shell variables needs to be set before calling this func: 241# the following shell variables needs to be set before calling this func:
@@ -256,55 +295,12 @@ package_install_internal_rpm () {
256 # Uclibc builds don't provide this stuff... 295 # Uclibc builds don't provide this stuff...
257 if [ x${TARGET_OS} = "xlinux" ] || [ x${TARGET_OS} = "xlinux-gnueabi" ] ; then 296 if [ x${TARGET_OS} = "xlinux" ] || [ x${TARGET_OS} = "xlinux-gnueabi" ] ; then
258 if [ ! -z "${package_linguas}" ]; then 297 if [ ! -z "${package_linguas}" ]; then
259 for pkg in ${package_linguas}; do 298 process_pkg_list_rpm linguas ${package_linguas}
260 echo "Processing $pkg..."
261
262 archvar=base_archs
263 manifest=install.manifest
264 ml_prefix=`echo ${pkg} | cut -d'-' -f1`
265 ml_pkg=$pkg
266 for i in ${MULTILIB_PREFIX_LIST} ; do
267 if [ ${ml_prefix} = ${i} ]; then
268 ml_pkg=$(echo ${pkg} | sed "s,^${ml_prefix}-\(.*\),\1,")
269 archvar=ml_archs
270 manifest=install_multilib.manifest
271 break
272 fi
273 done
274
275 pkg_name=$(resolve_package_rpm ${confbase}-${archvar}.conf ${ml_pkg})
276 if [ -z "$pkg_name" ]; then
277 echo "Unable to find package $pkg ($ml_pkg)!"
278 exit 1
279 fi
280 echo $pkg_name >> ${target_rootfs}/install/${manifest}
281 done
282 fi 299 fi
283 fi 300 fi
284 if [ ! -z "${package_to_install}" ]; then
285 for pkg in ${package_to_install} ; do
286 echo "Processing $pkg..."
287 301
288 archvar=base_archs 302 if [ ! -z "${package_to_install}" ]; then
289 manifest=install.manifest 303 process_pkg_list_rpm default ${package_to_install}
290 ml_prefix=`echo ${pkg} | cut -d'-' -f1`
291 ml_pkg=$pkg
292 for i in ${MULTILIB_PREFIX_LIST} ; do
293 if [ ${ml_prefix} = ${i} ]; then
294 ml_pkg=$(echo ${pkg} | sed "s,^${ml_prefix}-\(.*\),\1,")
295 archvar=ml_archs
296 manifest=install_multilib.manifest
297 break
298 fi
299 done
300
301 pkg_name=$(resolve_package_rpm ${confbase}-${archvar}.conf ${ml_pkg})
302 if [ -z "$pkg_name" ]; then
303 echo "Unable to find package $pkg ($ml_pkg)!"
304 exit 1
305 fi
306 echo $pkg_name >> ${target_rootfs}/install/${manifest}
307 done
308 fi 304 fi
309 305
310 # Normal package installation 306 # Normal package installation
@@ -324,24 +320,9 @@ package_install_internal_rpm () {
324 320
325 if [ ! -z "${package_attemptonly}" ]; then 321 if [ ! -z "${package_attemptonly}" ]; then
326 echo "Adding attempt only packages..." 322 echo "Adding attempt only packages..."
327 for pkg in ${package_attemptonly} ; do 323 process_pkg_list_rpm attemptonly ${package_attemptonly}
328 echo "Processing $pkg..." 324 cat ${target_rootfs}/install/install_attemptonly.manifest | while read pkg_name
329 archvar=base_archs 325 do
330 ml_prefix=`echo ${pkg} | cut -d'-' -f1`
331 ml_pkg=$pkg
332 for i in ${MULTILIB_PREFIX_LIST} ; do
333 if [ ${ml_prefix} = ${i} ]; then
334 ml_pkg=$(echo ${pkg} | sed "s,^${ml_prefix}-\(.*\),\1,")
335 archvar=ml_archs
336 break
337 fi
338 done
339
340 pkg_name=$(resolve_package_rpm ${confbase}-${archvar}.conf ${ml_pkg})
341 if [ -z "$pkg_name" ]; then
342 echo "Note: Unable to find package $pkg ($ml_pkg) -- PACKAGE_INSTALL_ATTEMPTONLY"
343 continue
344 fi
345 echo "Attempting $pkg_name..." >> "`dirname ${BB_LOGFILE}`/log.do_${task}_attemptonly.${PID}" 326 echo "Attempting $pkg_name..." >> "`dirname ${BB_LOGFILE}`/log.do_${task}_attemptonly.${PID}"
346 ${RPM} --predefine "_rpmds_sysinfo_path ${target_rootfs}/etc/rpm/sysinfo" \ 327 ${RPM} --predefine "_rpmds_sysinfo_path ${target_rootfs}/etc/rpm/sysinfo" \
347 --predefine "_rpmrc_platform_path ${target_rootfs}/etc/rpm/platform" \ 328 --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",
11ROOTFS_PKGMANAGE_BOOTSTRAP = "" 11ROOTFS_PKGMANAGE_BOOTSTRAP = ""
12 12
13do_rootfs[depends] += "rpm-native:do_populate_sysroot" 13do_rootfs[depends] += "rpm-native:do_populate_sysroot"
14do_rootfs[depends] += "rpmresolve-native:do_populate_sysroot"
14 15
15# Needed for update-alternatives 16# Needed for update-alternatives
16do_rootfs[depends] += "opkg-native:do_populate_sysroot" 17do_rootfs[depends] += "opkg-native:do_populate_sysroot"