Added progress counters to init_buildsystem.
authorMartin Vidner <mvidner@suse.cz>
Fri, 17 Feb 2012 01:04:40 +0000 (02:04 +0100)
committerAdrian Schröter <adrian@suse.de>
Fri, 17 Feb 2012 06:56:45 +0000 (07:56 +0100)
[8/31] preinstalling glibc...

[42/109] installing bash-4.2-46.2

common_functions
init_buildsystem

index 12258ba..cd43cd9 100755 (executable)
@@ -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}
+}
index 3efd216..db39ecb 100755 (executable)
@@ -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)