svn commit: r244165 - head/usr.sbin/portsnap/portsnap
Alfred Perlstein
alfred at FreeBSD.org
Thu Dec 13 01:39:50 UTC 2012
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
More information about the svn-src-all
mailing list