diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2012-07-23 07:59:11 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-07-29 10:16:15 +0100 |
commit | 20ad566d609bccdadf871dab1bc31a0e243f8710 (patch) | |
tree | faea9496677371ab81ea2704183c01ce54d088df /meta/classes/buildhistory.bbclass | |
parent | 98b0f956e7d16c2791cc00dbb75187b886e4cbcd (diff) | |
download | poky-20ad566d609bccdadf871dab1bc31a0e243f8710.tar.gz |
buildhistory: improve performance of image info collection
Reduce the number of calls to the packaging tool, especially in the case
of rpm, using helper utilities to gather the required information more
efficiently where possible.
(From OE-Core rev: d0b8a98c5b46c305afd389fc862b3bf0c6f1eaab)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/buildhistory.bbclass')
-rw-r--r-- | meta/classes/buildhistory.bbclass | 51 |
1 files changed, 23 insertions, 28 deletions
diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass index f0bf849860..ddb76e8771 100644 --- a/meta/classes/buildhistory.bbclass +++ b/meta/classes/buildhistory.bbclass | |||
@@ -285,48 +285,43 @@ buildhistory_get_image_installed() { | |||
285 | mkdir -p ${BUILDHISTORY_DIR_IMAGE} | 285 | mkdir -p ${BUILDHISTORY_DIR_IMAGE} |
286 | 286 | ||
287 | # Get list of installed packages | 287 | # Get list of installed packages |
288 | list_installed_packages | sort > ${BUILDHISTORY_DIR_IMAGE}/installed-package-names.txt | 288 | pkgcache="${BUILDHISTORY_DIR_IMAGE}/installed-packages.tmp" |
289 | INSTALLED_PKGS=`cat ${BUILDHISTORY_DIR_IMAGE}/installed-package-names.txt` | 289 | list_installed_packages file | sort > $pkgcache |
290 | |||
291 | cat $pkgcache | awk '{ print $1 }' > ${BUILDHISTORY_DIR_IMAGE}/installed-package-names.txt | ||
292 | cat $pkgcache | awk '{ print $2 }' | xargs -n1 basename > ${BUILDHISTORY_DIR_IMAGE}/installed-packages.txt | ||
293 | |||
294 | # Produce dependency graph | ||
295 | # First, filter out characters that cause issues for dot | ||
296 | rootfs_list_installed_depends | sed -e 's:-:_:g' -e 's:\.:_:g' -e 's:+::g' > ${BUILDHISTORY_DIR_IMAGE}/depends.tmp | ||
297 | # Change delimiter from pipe to -> and set style for recommend lines | ||
298 | sed -i -e 's:|: -> :' -e 's:\[REC\]:[style=dotted]:' -e 's:$:;:' ${BUILDHISTORY_DIR_IMAGE}/depends.tmp | ||
299 | # Add header, sorted and de-duped contents and footer and then delete the temp file | ||
300 | echo -e "digraph depends {\n node [shape=plaintext]" > ${BUILDHISTORY_DIR_IMAGE}/depends.dot | ||
301 | cat ${BUILDHISTORY_DIR_IMAGE}/depends.tmp | sort | uniq >> ${BUILDHISTORY_DIR_IMAGE}/depends.dot | ||
302 | echo "}" >> ${BUILDHISTORY_DIR_IMAGE}/depends.dot | ||
303 | rm ${BUILDHISTORY_DIR_IMAGE}/depends.tmp | ||
290 | 304 | ||
291 | # Produce installed package file and size lists and dependency graph | 305 | # Produce installed package sizes list |
292 | echo -n > ${BUILDHISTORY_DIR_IMAGE}/installed-packages.txt | ||
293 | echo -n > ${BUILDHISTORY_DIR_IMAGE}/installed-package-sizes.tmp | 306 | echo -n > ${BUILDHISTORY_DIR_IMAGE}/installed-package-sizes.tmp |
294 | echo -e "digraph depends {\n node [shape=plaintext]" > ${BUILDHISTORY_DIR_IMAGE}/depends.dot | 307 | cat $pkgcache | while read pkg pkgfile |
295 | for pkg in $INSTALLED_PKGS; do | 308 | do |
296 | pkgfile=`get_package_filename $pkg` | ||
297 | echo `basename $pkgfile` >> ${BUILDHISTORY_DIR_IMAGE}/installed-packages.txt | ||
298 | if [ -f $pkgfile ] ; then | 309 | if [ -f $pkgfile ] ; then |
299 | pkgsize=`du -k $pkgfile | head -n1 | awk '{ print $1 }'` | 310 | pkgsize=`du -k $pkgfile | head -n1 | awk '{ print $1 }'` |
300 | echo $pkgsize $pkg >> ${BUILDHISTORY_DIR_IMAGE}/installed-package-sizes.tmp | 311 | echo $pkgsize $pkg >> ${BUILDHISTORY_DIR_IMAGE}/installed-package-sizes.tmp |
301 | fi | 312 | fi |
302 | 313 | done | |
303 | deps=`list_package_depends $pkg` | ||
304 | for dep in $deps ; do | ||
305 | echo "$pkg OPP $dep;" | sed -e 's:-:_:g' -e 's:\.:_:g' -e 's:+::g' | sed 's:OPP:->:g' | ||
306 | done | ||
307 | |||
308 | recs=`list_package_recommends $pkg` | ||
309 | for rec in $recs ; do | ||
310 | echo "$pkg OPP $rec [style=dotted];" | sed -e 's:-:_:g' -e 's:\.:_:g' -e 's:+::g' | sed 's:OPP:->:g' | ||
311 | done | ||
312 | done | sort | uniq >> ${BUILDHISTORY_DIR_IMAGE}/depends.dot | ||
313 | echo "}" >> ${BUILDHISTORY_DIR_IMAGE}/depends.dot | ||
314 | |||
315 | cat ${BUILDHISTORY_DIR_IMAGE}/installed-package-sizes.tmp | sort -n -r | awk '{print $1 "\tKiB " $2}' > ${BUILDHISTORY_DIR_IMAGE}/installed-package-sizes.txt | 314 | cat ${BUILDHISTORY_DIR_IMAGE}/installed-package-sizes.tmp | sort -n -r | awk '{print $1 "\tKiB " $2}' > ${BUILDHISTORY_DIR_IMAGE}/installed-package-sizes.txt |
316 | rm ${BUILDHISTORY_DIR_IMAGE}/installed-package-sizes.tmp | 315 | rm ${BUILDHISTORY_DIR_IMAGE}/installed-package-sizes.tmp |
317 | 316 | ||
317 | # We're now done with the cache, delete it | ||
318 | rm $pkgcache | ||
319 | |||
318 | # Produce some cut-down graphs (for readability) | 320 | # Produce some cut-down graphs (for readability) |
319 | grep -v kernel_image ${BUILDHISTORY_DIR_IMAGE}/depends.dot | grep -v kernel_2 | grep -v kernel_3 > ${BUILDHISTORY_DIR_IMAGE}/depends-nokernel.dot | 321 | grep -v kernel_image ${BUILDHISTORY_DIR_IMAGE}/depends.dot | grep -v kernel_2 | grep -v kernel_3 > ${BUILDHISTORY_DIR_IMAGE}/depends-nokernel.dot |
320 | grep -v libc6 ${BUILDHISTORY_DIR_IMAGE}/depends-nokernel.dot | grep -v libgcc > ${BUILDHISTORY_DIR_IMAGE}/depends-nokernel-nolibc.dot | 322 | grep -v libc6 ${BUILDHISTORY_DIR_IMAGE}/depends-nokernel.dot | grep -v libgcc > ${BUILDHISTORY_DIR_IMAGE}/depends-nokernel-nolibc.dot |
321 | grep -v update_ ${BUILDHISTORY_DIR_IMAGE}/depends-nokernel-nolibc.dot > ${BUILDHISTORY_DIR_IMAGE}/depends-nokernel-nolibc-noupdate.dot | 323 | grep -v update_ ${BUILDHISTORY_DIR_IMAGE}/depends-nokernel-nolibc.dot > ${BUILDHISTORY_DIR_IMAGE}/depends-nokernel-nolibc-noupdate.dot |
322 | grep -v kernel_module ${BUILDHISTORY_DIR_IMAGE}/depends-nokernel-nolibc-noupdate.dot > ${BUILDHISTORY_DIR_IMAGE}/depends-nokernel-nolibc-noupdate-nomodules.dot | 324 | grep -v kernel_module ${BUILDHISTORY_DIR_IMAGE}/depends-nokernel-nolibc-noupdate.dot > ${BUILDHISTORY_DIR_IMAGE}/depends-nokernel-nolibc-noupdate-nomodules.dot |
323 | |||
324 | # Workaround for broken shell function dependencies | ||
325 | if false ; then | ||
326 | get_package_filename | ||
327 | list_package_depends | ||
328 | list_package_recommends | ||
329 | fi | ||
330 | } | 325 | } |
331 | 326 | ||
332 | buildhistory_get_imageinfo() { | 327 | buildhistory_get_imageinfo() { |