diff --git a/Makefile.work b/Makefile.work index 0fde2e3893..e98503a132 100644 --- a/Makefile.work +++ b/Makefile.work @@ -203,6 +203,7 @@ $(shell \ SONIC_VERSION_CACHE_SOURCE=$(SONIC_VERSION_CACHE_SOURCE) \ DBGOPT='$(DBGOPT)' \ MIRROR_SNAPSHOT=$(MIRROR_SNAPSHOT) \ + PIP_HTTP_TIMEOUT=$(PIP_HTTP_TIMEOUT) \ scripts/generate_buildinfo_config.sh) # Generate the slave Dockerfile, and prepare build info for it @@ -570,6 +571,7 @@ SONIC_BUILD_INSTRUCTION := $(MAKE) \ SONIC_VERSION_CONTROL_COMPONENTS=$(SONIC_VERSION_CONTROL_COMPONENTS) \ ONIE_IMAGE_PART_SIZE=$(ONIE_IMAGE_PART_SIZE) \ SONIC_OS_VERSION=$(SONIC_OS_VERSION) \ + PIP_HTTP_TIMEOUT=$(PIP_HTTP_TIMEOUT) \ $(SONIC_OVERRIDE_BUILD_VARS) .PHONY: sonic-slave-build sonic-slave-bash init reset @@ -592,6 +594,7 @@ export MIRROR_URLS export MIRROR_SECURITY_URLS export MIRROR_SNAPSHOT export SONIC_VERSION_CONTROL_COMPONENTS +export PIP_HTTP_TIMEOUT %:: | sonic-build-hooks ifneq ($(filter y, $(MULTIARCH_QEMU_ENVIRON) $(CROSS_BUILD_ENVIRON)),) diff --git a/rules/config b/rules/config index a8d749aba2..80a9cd2e01 100644 --- a/rules/config +++ b/rules/config @@ -311,3 +311,7 @@ GZ_COMPRESS_PROGRAM ?= gzip # SONIC_OS_VERSION - sonic os version SONIC_OS_VERSION ?= 11 + +# PIP timeout for http connection +PIP_HTTP_TIMEOUT ?= 60 + diff --git a/scripts/generate_buildinfo_config.sh b/scripts/generate_buildinfo_config.sh index 87eb612007..d0bfb942ec 100755 --- a/scripts/generate_buildinfo_config.sh +++ b/scripts/generate_buildinfo_config.sh @@ -12,3 +12,4 @@ echo "export SONIC_VERSION_CACHE=${SONIC_VERSION_CACHE}" >> $BUILDINFO_CONFIG echo "export SONIC_VERSION_CACHE_SOURCE=${SONIC_VERSION_CACHE_SOURCE}" >> $BUILDINFO_CONFIG echo "export DISTRO=${DISTRO}" >> $BUILDINFO_CONFIG echo "export MIRROR_SNAPSHOT=$MIRROR_SNAPSHOT" >> $BUILDINFO_CONFIG +echo "export PIP_HTTP_TIMEOUT=$PIP_HTTP_TIMEOUT" >> $BUILDINFO_CONFIG diff --git a/src/sonic-build-hooks/scripts/buildinfo_base.sh b/src/sonic-build-hooks/scripts/buildinfo_base.sh index 2c85cb665c..37a84a0c6f 100755 --- a/src/sonic-build-hooks/scripts/buildinfo_base.sh +++ b/src/sonic-build-hooks/scripts/buildinfo_base.sh @@ -288,7 +288,7 @@ download_packages() run_pip_command() { - declare -a parameters=("$@") + declare -a parameters=("--default-timeout" "$PIP_HTTP_TIMEOUT" "$@") PIP_CACHE_PATH=${PKG_CACHE_PATH}/pip PKG_CACHE_OPTION="--cache-dir=${PIP_CACHE_PATH}"