From owner-svn-src-all@FreeBSD.ORG Thu Dec 13 01:41:42 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 438A9717; Thu, 13 Dec 2012 01:41:42 +0000 (UTC) (envelope-from bright@mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id E8AE08FC0C; Thu, 13 Dec 2012 01:41:41 +0000 (UTC) Received: from Alfreds-MacBook-Pro-6.local (c-67-180-208-218.hsd1.ca.comcast.net [67.180.208.218]) by elvis.mu.org (Postfix) with ESMTPSA id 708381A3CE9; Wed, 12 Dec 2012 17:41:41 -0800 (PST) Message-ID: <50C93255.5080607@mu.org> Date: Wed, 12 Dec 2012 17:41:41 -0800 From: Alfred Perlstein User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Alfred Perlstein Subject: Re: svn commit: r244165 - head/usr.sbin/portsnap/portsnap References: <201212130139.qBD1dooO005840@svn.freebsd.org> In-Reply-To: <201212130139.qBD1dooO005840@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Dec 2012 01:41:42 -0000 Reviewed by: eadler On 12/12/12 5:39 PM, Alfred Perlstein wrote: > Author: alfred > Date: Thu Dec 13 01:39:49 2012 > New Revision: 244165 > URL: http://svnweb.freebsd.org/changeset/base/244165 > > Log: > Change progress indicator for downloading patches. > > Use a percent style indicator instead of emitting one > long line of patch numbers. > > Modified: > head/usr.sbin/portsnap/portsnap/portsnap.sh > > Modified: head/usr.sbin/portsnap/portsnap/portsnap.sh > ============================================================================== > --- head/usr.sbin/portsnap/portsnap/portsnap.sh Thu Dec 13 00:44:23 2012 (r244164) > +++ head/usr.sbin/portsnap/portsnap/portsnap.sh Thu Dec 13 01:39:49 2012 (r244165) > @@ -612,6 +612,28 @@ fetch_progress() { > echo -n " " > } > > +pct_fmt() > +{ > + printf " \r" > + printf "($1/$2) %02.2f%% " `echo "scale=4;$LNC / $TOTAL * 100"|bc` > +} > + > +fetch_progress_percent() { > + TOTAL=$1 > + LNC=0 > + pct_fmt $LNC $TOTAL > + while read x; do > + LNC=$(($LNC + 1)) > + if [ $(($LNC % 100)) = 0 ]; then > + pct_fmt $LNC $TOTAL > + elif [ $(($LNC % 10)) = 0 ]; then > + echo -n . > + fi > + done > + pct_fmt $LNC $TOTAL > + echo " done. " > +} > + > # Sanity-check an index file > fetch_index_sanity() { > if grep -qvE "^[-_+./@0-9A-Za-z]+\|[0-9a-f]{64}$" INDEX.new || > @@ -781,11 +803,13 @@ fetch_update() { > echo " done." 1>${QUIETREDIR} > > # Attempt to fetch ports patches > - echo -n "Fetching `wc -l < patchlist | tr -d ' '` " > + patchcnt=`wc -l < patchlist | tr -d ' '` > + echo -n "Fetching $patchcnt " > echo ${NDEBUG} "patches.${DDSTATS}" > + echo " " > tr '|' '-' < patchlist | lam -s "bp/" - | > xargs ${XARGST} ${PHTTPGET} ${SERVERNAME} \ > - 2>${STATSREDIR} | fetch_progress > + 2>${STATSREDIR} | fetch_progress_percent $patchcnt > echo "done." > > # Attempt to apply ports patches >