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-28 11:13:51 +0100 |
commit | d0b8a98c5b46c305afd389fc862b3bf0c6f1eaab (patch) | |
tree | 7485d204911e135a5ab927f046152db9cee550ba /meta/classes/buildhistory.bbclass | |
parent | 3ba9c0757eb51a0bb5873f4faae023587a33cc1d (diff) | |
download | openembedded-core-d0b8a98c5b46c305afd389fc862b3bf0c6f1eaab.tar.gz openembedded-core-d0b8a98c5b46c305afd389fc862b3bf0c6f1eaab.tar.bz2 openembedded-core-d0b8a98c5b46c305afd389fc862b3bf0c6f1eaab.zip |
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.
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
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() { mkdir -p ${BUILDHISTORY_DIR_IMAGE} # Get list of installed packages - list_installed_packages | sort > ${BUILDHISTORY_DIR_IMAGE}/installed-package-names.txt - INSTALLED_PKGS=`cat ${BUILDHISTORY_DIR_IMAGE}/installed-package-names.txt` + pkgcache="${BUILDHISTORY_DIR_IMAGE}/installed-packages.tmp" + list_installed_packages file | sort > $pkgcache + + cat $pkgcache | awk '{ print $1 }' > ${BUILDHISTORY_DIR_IMAGE}/installed-package-names.txt + cat $pkgcache | awk '{ print $2 }' | xargs -n1 basename > ${BUILDHISTORY_DIR_IMAGE}/installed-packages.txt + + # Produce dependency graph + # First, filter out characters that cause issues for dot + rootfs_list_installed_depends | sed -e 's:-:_:g' -e 's:\.:_:g' -e 's:+::g' > ${BUILDHISTORY_DIR_IMAGE}/depends.tmp + # Change delimiter from pipe to -> and set style for recommend lines + sed -i -e 's:|: -> :' -e 's:\[REC\]:[style=dotted]:' -e 's:$:;:' ${BUILDHISTORY_DIR_IMAGE}/depends.tmp + # Add header, sorted and de-duped contents and footer and then delete the temp file + echo -e "digraph depends {\n node [shape=plaintext]" > ${BUILDHISTORY_DIR_IMAGE}/depends.dot + cat ${BUILDHISTORY_DIR_IMAGE}/depends.tmp | sort | uniq >> ${BUILDHISTORY_DIR_IMAGE}/depends.dot + echo "}" >> ${BUILDHISTORY_DIR_IMAGE}/depends.dot + rm ${BUILDHISTORY_DIR_IMAGE}/depends.tmp - # Produce installed package file and size lists and dependency graph - echo -n > ${BUILDHISTORY_DIR_IMAGE}/installed-packages.txt + # Produce installed package sizes list echo -n > ${BUILDHISTORY_DIR_IMAGE}/installed-package-sizes.tmp - echo -e "digraph depends {\n node [shape=plaintext]" > ${BUILDHISTORY_DIR_IMAGE}/depends.dot - for pkg in $INSTALLED_PKGS; do - pkgfile=`get_package_filename $pkg` - echo `basename $pkgfile` >> ${BUILDHISTORY_DIR_IMAGE}/installed-packages.txt + cat $pkgcache | while read pkg pkgfile + do if [ -f $pkgfile ] ; then pkgsize=`du -k $pkgfile | head -n1 | awk '{ print $1 }'` echo $pkgsize $pkg >> ${BUILDHISTORY_DIR_IMAGE}/installed-package-sizes.tmp fi - - deps=`list_package_depends $pkg` - for dep in $deps ; do - echo "$pkg OPP $dep;" | sed -e 's:-:_:g' -e 's:\.:_:g' -e 's:+::g' | sed 's:OPP:->:g' - done - - recs=`list_package_recommends $pkg` - for rec in $recs ; do - echo "$pkg OPP $rec [style=dotted];" | sed -e 's:-:_:g' -e 's:\.:_:g' -e 's:+::g' | sed 's:OPP:->:g' - done - done | sort | uniq >> ${BUILDHISTORY_DIR_IMAGE}/depends.dot - echo "}" >> ${BUILDHISTORY_DIR_IMAGE}/depends.dot - + done cat ${BUILDHISTORY_DIR_IMAGE}/installed-package-sizes.tmp | sort -n -r | awk '{print $1 "\tKiB " $2}' > ${BUILDHISTORY_DIR_IMAGE}/installed-package-sizes.txt rm ${BUILDHISTORY_DIR_IMAGE}/installed-package-sizes.tmp + # We're now done with the cache, delete it + rm $pkgcache + # Produce some cut-down graphs (for readability) grep -v kernel_image ${BUILDHISTORY_DIR_IMAGE}/depends.dot | grep -v kernel_2 | grep -v kernel_3 > ${BUILDHISTORY_DIR_IMAGE}/depends-nokernel.dot grep -v libc6 ${BUILDHISTORY_DIR_IMAGE}/depends-nokernel.dot | grep -v libgcc > ${BUILDHISTORY_DIR_IMAGE}/depends-nokernel-nolibc.dot grep -v update_ ${BUILDHISTORY_DIR_IMAGE}/depends-nokernel-nolibc.dot > ${BUILDHISTORY_DIR_IMAGE}/depends-nokernel-nolibc-noupdate.dot grep -v kernel_module ${BUILDHISTORY_DIR_IMAGE}/depends-nokernel-nolibc-noupdate.dot > ${BUILDHISTORY_DIR_IMAGE}/depends-nokernel-nolibc-noupdate-nomodules.dot - - # Workaround for broken shell function dependencies - if false ; then - get_package_filename - list_package_depends - list_package_recommends - fi } buildhistory_get_imageinfo() { |