summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2007-05-08 12:54:06 (GMT)
committerYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2007-05-08 12:54:06 (GMT)
commitb332ed5ab6631aef5ee8ddc075cbb967f3114079 (patch)
treeddb8743f5f34c41c7c559fafc46b53fdcdc2e2ed
parentea1ed9627e7cc9651425dd4bd478e803b9720f5f (diff)
Print the elapsed time alongside with the progress bar, such as below:
[02:27] \
-rwxr-xr-xscripts/crosstool.sh15
-rw-r--r--scripts/functions4
2 files changed, 13 insertions, 6 deletions
diff --git a/scripts/crosstool.sh b/scripts/crosstool.sh
index d5feecb..f11fffe 100755
--- a/scripts/crosstool.sh
+++ b/scripts/crosstool.sh
@@ -39,13 +39,18 @@ CT_TestOrAbort "Configuration file not found. Please create one." -f "${CT_TOP_D
# The progress bar indicator is asked for
if [ "${CT_LOG_PROGRESS_BAR}" = "y" ]; then
+ _CT_PROG_BAR_DATE() {
+ local str=`CT_DoDate +%s`
+ local elapsed=$((str-(CT_STAR_DATE/(1000*1000*1000))))
+ printf "[%02d:%02d]" $((elapsed/60)) $((elapsed%60))
+ }
_CT_PROG_BAR() {
- [ $((cpt/5)) -eq 0 ] && echo -en "/"
- [ $((cpt/5)) -eq 1 ] && echo -en "-"
- [ $((cpt/5)) -eq 2 ] && echo -en "\\"
- [ $((cpt/5)) -eq 3 ] && echo -en "|"
echo -en "\r"
- cpt=$(((cpt+1)%20))
+ [ $((cpt/10)) -eq 0 ] && echo -en "`_CT_PROG_BAR_DATE` /"
+ [ $((cpt/10)) -eq 1 ] && echo -en "`_CT_PROG_BAR_DATE` -"
+ [ $((cpt/10)) -eq 2 ] && echo -en "`_CT_PROG_BAR_DATE` \\"
+ [ $((cpt/10)) -eq 3 ] && echo -en "`_CT_PROG_BAR_DATE` |"
+ cpt=$(((cpt+1)%40))
}
CT_PROG_BAR=_CT_PROG_BAR
export -f _CT_PROG_BAR
diff --git a/scripts/functions b/scripts/functions
index 5307268..70b9387 100644
--- a/scripts/functions
+++ b/scripts/functions
@@ -88,7 +88,7 @@ CT_DoLog() {
color="CT_${cur_L}_COLOR"
normal="CT_NORMAL_COLOR"
if [ ${cur_l} -le ${max_level} ]; then
- echo -e "${!color}${l}${!normal}"
+ echo -e "\r${!color}${l}${!normal}"
else
${CT_PROG_BAR}
fi
@@ -267,8 +267,10 @@ CT_GetFile() {
ext=`CT_GetFileExtension "${file}"`
if [ -n "${ext}" ]; then
if [ "${CT_FORCE_DOWNLOAD}" = "y" ]; then
+ CT_DoLog DEBUG "Removing already present \"${file}\""
rm -f "${CT_TARBALLS_DIR}/${file}${ext}"
else
+ CT_DoLog EXTRA "Already have \"${file}\""
return 0
fi
fi