mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-24 11:16:51 +00:00
buildsystem: replace $(cat file) with faster alternative
See: https://www.gnu.org/software/bash/manual/html_node/Command-Substitution.html " ... Bash performs the expansion by executing command in a subshell environment and replacing the command substitution with the standard output of the command, with any trailing newlines deleted. Embedded newlines are not deleted, but they may be removed during word splitting. The command substitution $(cat file) can be replaced by the equivalent but faster $(< file). " Testing indicates var=$(< file) is twice as fast as var=$(cat file).
This commit is contained in:
parent
0eb36d786b
commit
04b8036e32
@ -1264,7 +1264,7 @@ pkg_lock() {
|
||||
|
||||
# As we now have the lock, if .failed still exists then a previous process must have failed
|
||||
if [ -f "${THREAD_CONTROL}/locks/${pkg}.${task}.failed" ]; then
|
||||
fail_seq="$(cat "${THREAD_CONTROL}/locks/${pkg}.${task}.failed")"
|
||||
fail_seq="$(< "${THREAD_CONTROL}/locks/${pkg}.${task}.failed")"
|
||||
print_color CLR_ERROR "FAILURE: ${pkg}.${task}.failed exists, a previous dependency process has failed (seq: ${fail_seq})\n"
|
||||
if [ -d "${THREAD_CONTROL}/logs" ]; then
|
||||
cat <<EOF
|
||||
@ -1325,12 +1325,12 @@ update_dashboard() {
|
||||
num=$(cat "${THREAD_CONTROL}/status" | wc -l)
|
||||
while [ ${num} -lt ${sedline} ]; do echo "" >>"${THREAD_CONTROL}/status"; num=$((num + 1)); done
|
||||
|
||||
num=$(($(cat "${THREAD_CONTROL}/progress.prev") + 1))
|
||||
num=$(< "${THREAD_CONTROL}/progress.prev")
|
||||
projdevarch="${PROJECT}/"
|
||||
[ -n "${DEVICE}" ] && projdevarch+="${DEVICE}/"
|
||||
projdevarch+="${TARGET_ARCH}"
|
||||
TZ=UTC0 printf -v elapsed "%(%H:%M:%S)T" $(($(date +%s) - MTBUILDSTART))
|
||||
printf -v preamble "%s Dashboard (%s) - %d of %d jobs completed, %s elapsed" "${DISTRONAME}" "${projdevarch}" ${num} ${MTMAXJOBS} "${elapsed}"
|
||||
printf -v preamble "%s Dashboard (%s) - %d of %d jobs completed, %s elapsed" "${DISTRONAME}" "${projdevarch}" $((num + 1)) ${MTMAXJOBS} "${elapsed}"
|
||||
printf -v preamble "%b%-105s %s" "\e[2J\e[0;0H" "${preamble//\//\\/}" "$(date "+%Y-%m-%d %H:%M:%S")"
|
||||
|
||||
if [ "${DISABLE_COLORS}" != "yes" ]; then
|
||||
|
@ -107,8 +107,9 @@ package_worker() {
|
||||
(
|
||||
flock --exclusive 95
|
||||
[ ${result} -eq 0 ] && status="DONE" || status="FAIL"
|
||||
num=$(($(cat "${THREAD_CONTROL}/progress") + 1))
|
||||
num=$(< "${THREAD_CONTROL}/progress")
|
||||
mv "${THREAD_CONTROL}/progress" "${THREAD_CONTROL}/progress.prev"
|
||||
num=$((num + 1))
|
||||
echo ${num} >"${THREAD_CONTROL}/progress"
|
||||
printf "[%0*d/%0*d] [%-4s] %-7s %s\n" ${#jobs} ${num} ${#jobs} ${jobs} "${status}" "${task}" "${pkgname}" >&2
|
||||
) 95>"${THREAD_CONTROL}/locks/.progress"
|
||||
|
Loading…
x
Reference in New Issue
Block a user