Skip to content

Commit 4155157

Browse files
authored
Toolchain: Avoid flooding container logs with download progress (#7618)
* Toolchain: Avoid flooding container logs with download progress * Drop unused DOWNLOADER_FLAGS config cache from config_manager.sh * Use "nproc" instead of "nproc --all" to respect the cgroup limit of Docker container
1 parent 5282500 commit 4155157

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

toolchain/scripts/lib/config_manager.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,6 @@ config_set_defaults() {
390390
CONFIG_CACHE["TARGET_CPU"]="native"
391391
CONFIG_CACHE["LOG_LINES"]="200"
392392
CONFIG_CACHE["show_help"]="false"
393-
CONFIG_CACHE["DOWNLOADER_FLAGS"]=""
394393

395394
# Version strategy defaults (NEW)
396395
CONFIG_CACHE["VERSION_STRATEGY"]="main"

toolchain/scripts/tool_kit.sh

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ get_nprocs() {
233233
if [ -n "${NPROCS_OVERWRITE}" ]; then
234234
echo ${NPROCS_OVERWRITE} | sed 's/^0*//'
235235
elif $(command -v nproc > /dev/null 2>&1); then
236-
echo $(nproc --all)
236+
echo $(nproc)
237237
elif $(command -v sysctl > /dev/null 2>&1); then
238238
echo $(sysctl -n hw.ncpu)
239239
else
@@ -922,12 +922,20 @@ download_pkg_from_url() {
922922
local __sha256="$1" # if set to "--no-checksum", do not check checksum
923923
local __filename="$2"
924924
local __url="$3"
925+
926+
# Hide the progress bar in containers to prevent flooding output
927+
local DOWNLOADER_FLAGS
928+
if [ -f /.dockerenv ] || [ -f /run/.containerenv ]; then
929+
DOWNLOADER_FLAGS="--quiet"
930+
else
931+
DOWNLOADER_FLAGS="--quiet --show-progress"
932+
fi
925933

926934
# Smart certificate validation strategy
927935
case "${DOWNLOAD_CERT_POLICY:-smart}" in
928936
"strict")
929937
echo "Downloading with strict certificate validation: $__url"
930-
if ! wget --quiet --show-progress ${DOWNLOADER_FLAGS} "$__url" -O "$__filename"; then
938+
if ! wget ${DOWNLOADER_FLAGS} "$__url" -O "$__filename"; then
931939
rm -f "$__filename"
932940
report_error "failed to download $__url (strict certificate validation)"
933941
recommend_offline_installation "$__filename" "$__url"
@@ -938,7 +946,7 @@ download_pkg_from_url() {
938946
;;
939947
"skip")
940948
echo "Downloading with certificate validation disabled: $__url"
941-
if ! wget --quiet --show-progress ${DOWNLOADER_FLAGS} "$__url" -O "$__filename" --no-check-certificate; then
949+
if ! wget ${DOWNLOADER_FLAGS} "$__url" -O "$__filename" --no-check-certificate; then
942950
rm -f "$__filename"
943951
report_error "failed to download $__url"
944952
recommend_offline_installation "$__filename" "$__url"
@@ -950,7 +958,7 @@ download_pkg_from_url() {
950958
"smart"|*)
951959
# Smart fallback: try with certificate validation first, then without
952960
echo "Attempting secure download: $__url"
953-
if wget --quiet --show-progress ${DOWNLOADER_FLAGS} "$__url" -O "$__filename"; then
961+
if wget ${DOWNLOADER_FLAGS} "$__url" -O "$__filename"; then
954962
echo "Download successful with certificate validation"
955963
else
956964
echo "Certificate validation failed, retrying without certificate check..."

0 commit comments

Comments
 (0)