mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2025-01-29 15:44:03 +00:00
Again, some progress bar optimisation.
This commit is contained in:
parent
823a283d19
commit
56b73046a4
@ -37,28 +37,7 @@ CT_TOP_DIR="`CT_MakeAbsolutePath \"${CT_TOP_DIR}\"`"
|
||||
CT_TestOrAbort "Configuration file not found. Please create one." -f "${CT_TOP_DIR}/.config"
|
||||
. "${CT_TOP_DIR}/.config"
|
||||
|
||||
# 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() {
|
||||
[ ${CT_PROG_BAR_CPT} -eq 0 ] && echo -en "\r`_CT_PROG_BAR_DATE` /"
|
||||
[ ${CT_PROG_BAR_CPT} -eq 10 ] && echo -en "\r`_CT_PROG_BAR_DATE` -"
|
||||
[ ${CT_PROG_BAR_CPT} -eq 20 ] && echo -en "\r`_CT_PROG_BAR_DATE` \\"
|
||||
[ ${CT_PROG_BAR_CPT} -eq 30 ] && echo -en "\r`_CT_PROG_BAR_DATE` |"
|
||||
CT_PROG_BAR_CPT=$(((CT_PROG_BAR_CPT+1)%40))
|
||||
}
|
||||
CT_PROG_BAR_CPT=0
|
||||
CT_PROG_BAR=_CT_PROG_BAR
|
||||
export -f _CT_PROG_BAR
|
||||
else
|
||||
CT_PROG_BAR=
|
||||
fi
|
||||
|
||||
# Apply the color scheme if needed
|
||||
# Override the color scheme if needed
|
||||
if [ "${CT_LOG_USE_COLORS}" = "y" ]; then
|
||||
CT_ERROR_COLOR="${_A_NOR}${_A_BRI}${_F_RED}"
|
||||
CT_WARN_COLOR="${_A_NOR}${_A_BRI}${_F_YEL}"
|
||||
|
@ -75,7 +75,7 @@ CT_DoLog() {
|
||||
else
|
||||
echo "${1}"
|
||||
fi |( IFS="\n" # We want the full lines, even leading spaces
|
||||
cpt=0
|
||||
CT_PROG_BAR_CPT=0
|
||||
indent=$((2*CT_STEP_COUNT))
|
||||
while read line; do
|
||||
case "${CT_LOG_SEE_TOOLS_WARN},${line}" in
|
||||
@ -91,9 +91,16 @@ CT_DoLog() {
|
||||
normal="CT_NORMAL_COLOR"
|
||||
if [ ${cur_l} -le ${max_level} ]; then
|
||||
echo -e "\r${!color}${l}${!normal}"
|
||||
CT_PROG_BAR_CPT=0 # Force redrawing progress bar on next 'unlogged' line
|
||||
else
|
||||
${CT_PROG_BAR}
|
||||
fi
|
||||
if [ "${CT_LOG_PROGRESS_BAR}" = "y" ]; then
|
||||
str=`CT_DoDate +%s`
|
||||
elapsed=$((str-(CT_STAR_DATE/(1000*1000*1000))))
|
||||
[ ${CT_PROG_BAR_CPT} -eq 0 ] && bar="/"
|
||||
[ ${CT_PROG_BAR_CPT} -eq 10 ] && bar="-"
|
||||
[ ${CT_PROG_BAR_CPT} -eq 20 ] && bar="\\"
|
||||
[ ${CT_PROG_BAR_CPT} -eq 30 ] && bar="|"
|
||||
printf "\r[%02d:%02d] %s " $((elapsed/60)) $((elapsed%60)) "${bar}"
|
||||
CT_PROG_BAR_CPT=$(((CT_PROG_BAR_CPT+1)%40))
|
||||
fi
|
||||
done
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user