From: Martin Vidner Date: Fri, 17 Feb 2012 01:04:40 +0000 (+0100) Subject: Added progress counters to init_buildsystem. X-Git-Tag: upstream/20120927~138 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=27b904da6fe1c81bec7fbd78e3d85c98372bcfdb;p=platform%2Fupstream%2Fbuild.git Added progress counters to init_buildsystem. [8/31] preinstalling glibc... [42/109] installing bash-4.2-46.2 --- diff --git a/common_functions b/common_functions index 12258ba..cd43cd9 100755 --- a/common_functions +++ b/common_functions @@ -80,3 +80,25 @@ check_use_emulator() esac return 1 } + +# usage: +# progress_setup LIST +# for I in $LIST; do +# progress_step LIST +# action $I +# done + +# $1 name of a textual list +progress_setup() { + eval "$1__ARRAY__=(\$$1)" + eval "$1__INDEX__=1" + eval "$1__LENGTH__=\${#$1__ARRAY__[@]}" +} + +# $1 name of a textual list +# $2 optional, printf format for 2 numeric arguments (current, total) +progress_step() { + local IDX=$1__INDEX__ + local LEN=$1__LENGTH__ + printf "${2-[%d/%d] }" $(($IDX++)) ${!LEN} +} diff --git a/init_buildsystem b/init_buildsystem index 3efd216..db39ecb 100755 --- a/init_buildsystem +++ b/init_buildsystem @@ -725,16 +725,22 @@ if test ! -f $BUILD_ROOT/var/lib/rpm/packages.rpm -a ! -f $BUILD_ROOT/var/lib/rp for PKG in $PACKAGES_TO_RUNSCRIPTS ; do : > $BUILD_ROOT/.init_b_cache/scripts/$PKG.run done + progress_setup PACKAGES_TO_PREINSTALL for PKG in $PACKAGES_TO_PREINSTALL ; do + progress_step PACKAGES_TO_PREINSTALL preinstall ${PKG##*/} done if test -n "$PREPARE_VM" ; then + progress_setup PACKAGES_TO_VMINSTALL for PKG in $PACKAGES_TO_VMINSTALL ; do + progress_step PACKAGES_TO_VMINSTALL preinstall ${PKG##*/} done fi # add cbpreinstall if cross HOST != TARGET + progress_setup PACKAGES_TO_CBPREINSTALL for PKG in $PACKAGES_TO_CBPREINSTALL ; do + progress_step PACKAGES_TO_CBPREINSTALL preinstall ${PKG##*/} done if [ -w /root ]; then @@ -872,7 +878,10 @@ RPMCHECKOPTS_HOST= test -x $BUILD_ROOT/usr/bin/rpmsign && RPMCHECKOPTS="--nodigest --nosignature" test -x /usr/bin/rpmsign && RPMCHECKOPTS_HOST="--nodigest --nosignature" +MAIN_LIST="$PACKAGES_TO_INSTALL_FIRST RUN_LDCONFIG $PACKAGES_TO_INSTALL $PACKAGES_TO_CBINSTALL" +progress_setup MAIN_LIST for PKG in $PACKAGES_TO_INSTALL_FIRST RUN_LDCONFIG $PACKAGES_TO_INSTALL $PACKAGES_TO_CBINSTALL; do + progress_step MAIN_LIST case $PKG in RUN_LDCONFIG)