From c3913ab9ae11ce9a9ed1258190b8b447f8cc773d Mon Sep 17 00:00:00 2001 From: MilhouseVH Date: Wed, 24 Apr 2019 04:56:39 +0100 Subject: [PATCH] config/functions: remove non-mt support in update_dashboard() --- config/functions | 44 +++++++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/config/functions b/config/functions index 481f319401..75c6378780 100644 --- a/config/functions +++ b/config/functions @@ -1312,11 +1312,13 @@ pkg_lock_status() { } update_dashboard() { + [ "${MTWITHLOCKS}" != "yes" ] && return 0 + local status="$1" pkg="$2" task="$3" msg="$4" local line sedline preamble num elapsed projdevarch local boldred boldgreen boldyellow endcolor - [ -n "${MTJOBID}" ] && sedline=$((MTJOBID + 2)) || sedline=1 + sedline=$((MTJOBID + 2)) num=$(cat "${THREAD_CONTROL}/status" | wc -l) while [ ${num} -lt ${sedline} ]; do echo "" >>"${THREAD_CONTROL}/status"; num=$((num + 1)); done @@ -1329,30 +1331,26 @@ update_dashboard() { printf -v preamble "%s Dashboard (%s) - %d of %d jobs completed, %s elapsed" "${DISTRONAME}" "${projdevarch}" ${num} ${MTMAXJOBS} "${elapsed}" printf -v preamble "%b%-105s %s" "\e[2J\e[0;0H" "${preamble//\//\\/}" "$(date "+%Y-%m-%d %H:%M:%S")" - # Only update the header when caller is not a worker thread - if [ -z "${MTJOBID}" ]; then - sed -e "1s/.*/${preamble}/" -i "${THREAD_CONTROL}/status" - else - if [ "${DISABLE_COLORS}" != "yes" ]; then - boldred="\e[1;31m" - boldgreen="\e[1;32m" - boldyellow="\e[1;33m" - white="\e[0;37m" - endcolor="\e[0m" + if [ "${DISABLE_COLORS}" != "yes" ]; then + boldred="\e[1;31m" + boldgreen="\e[1;32m" + boldyellow="\e[1;33m" + white="\e[0;37m" + endcolor="\e[0m" - case "${status}" in - IDLE) color="${white}";; - STALLED) color="${boldyellow}";; - MUTEX/W) color="${boldyellow}";; - FAILED ) color="${boldred}";; - *) color="${boldgreen}";; - esac - fi - - printf -v line "[%02d\/%0*d] %b%-7s%b %-7s %-35s" ${MTJOBID} ${#MTMAXJOBS} ${PARALLEL_SEQ:-0} "${color}" "${status//\//\\/}" "${endcolor}" "${task}" "${pkg}" - [ -n "${msg}" ] && line+=" ${msg//\//\\/}" - sed -e "1s/.*/${preamble}/;${sedline}s/.*/${line}/" -i "${THREAD_CONTROL}/status" + case "${status}" in + IDLE) color="${white}";; + STALLED) color="${boldyellow}";; + MUTEX/W) color="${boldyellow}";; + FAILED ) color="${boldred}";; + *) color="${boldgreen}";; + esac fi + + printf -v line "[%02d\/%0*d] %b%-7s%b %-7s %-35s" ${MTJOBID} ${#MTMAXJOBS} ${PARALLEL_SEQ:-0} "${color}" "${status//\//\\/}" "${endcolor}" "${task}" "${pkg}" + [ -n "${msg}" ] && line+=" ${msg//\//\\/}" + + sed -e "1s/.*/${preamble}/;${sedline}s/.*/${line}/" -i "${THREAD_CONTROL}/status" } # Thread concurrency helpers to avoid concurrency issues with some code,