From: fuzzyray Date: Wed, 8 Aug 2007 14:53:25 +0000 (-0000) Subject: Fix progress bar to only update when there is a change (Bug #186945) X-Git-Tag: gentoolkit-0.2.4.3~82 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=0f542e12353b98f8fe1f74c96e0d460979f53318;p=gentoolkit.git Fix progress bar to only update when there is a change (Bug #186945) svn path=/; revision=431 --- diff --git a/trunk/ChangeLog b/trunk/ChangeLog index 8a71eac..e6385a7 100644 --- a/trunk/ChangeLog +++ b/trunk/ChangeLog @@ -1,3 +1,9 @@ +2007-08-08: Paul Varner + * revdep-rebuild: Fix progress bar to only update when there is a + change (Bug #186945) + * revdep-rebuild: Ensure that we source functions.sh before calling + ewarn, etc. + 2007-08-06: Paul Varner * revdep-rebuild: Fix processing of .la files (Bug #187453) * revdep-rebuild: Add -X option back for backwards compatibilty (Bug diff --git a/trunk/src/revdep-rebuild/revdep-rebuild-rewrite b/trunk/src/revdep-rebuild/revdep-rebuild-rewrite index ac3feae..9d9aa6a 100755 --- a/trunk/src/revdep-rebuild/revdep-rebuild-rewrite +++ b/trunk/src/revdep-rebuild/revdep-rebuild-rewrite @@ -70,6 +70,7 @@ declare SEARCH_DIRS # List of dirs to search for executables and libraries declare SEARCH_DIRS_MASK # List of dirs not to search # Other globals: +declare OLDPROG # Previous pass through the progress meter declare EXACT_PKG # Versionated atom to emerge declare HEAD_TEXT # Feedback string about the search declare LIST # Prefix for temporary filenames @@ -162,9 +163,11 @@ progress() { progress() { :; } else progress() { + local curProg=$(( $1 * 100 / $2 )) + (( curProg == OLDPROG )) && return # no change, output nothing + OLDPROG="$curProg" # must be a global variable (( $1 == $2 )) && local lb=$'\n' - echo -ne '\r \r' - echo -n "[ $(( $1 * 100 / $2 ))% ] $lb" + echo -ne '\r \r'"[ $curProg% ] $lb" } progress $@ fi @@ -295,6 +298,12 @@ get_args() { sed 's:/var/db/pkg/\(.*\)/CONTENTS:\1:' } fi + + # Use the color preference from portage + export NOCOLOR=$(portageq envvar NOCOLOR) + [[ $NOCOLOR = yes || $NOCOLOR = true ]] && export RC_NOCOLOR=yes # HACK! (grr) + source /etc/init.d/functions.sh + # Normalize some EMERGE_OPTIONS EMERGE_OPTIONS=(${EMERGE_OPTIONS[@]/%-p/--pretend}) EMERGE_OPTIONS=(${EMERGE_OPTIONS[@]/%-f/--fetchonly}) @@ -309,10 +318,6 @@ is_real_merge() [[ ]] get_args "$@" -# Use the color preference from portage -export NOCOLOR=$(portageq envvar NOCOLOR) -[[ $NOCOLOR = yes || $NOCOLOR = true ]] && export RC_NOCOLOR=yes # HACK! (grr) -source /etc/init.d/functions.sh einfo "Configuring search environment for $APP_NAME"