From 4ce33aad758babf219a6292c928e30fe85e9dd85 Mon Sep 17 00:00:00 2001 From: xumia <59720581+xumia@users.noreply.github.com> Date: Wed, 12 Apr 2023 15:00:48 +0800 Subject: [PATCH] [Build] Optimize the version control for Debian packages (#14557) (#14610) Why I did it Optimize the version control for Debian packages. Fix sonic-slave-buster/sources.list.amd64 not found display issue, need to generate the file before running the shell command to evaluate the sonic image tag. When using the snapshot mirror, it is not necessary to update the version file based on the base image. It will reduce the version dependency issue, when an image is not run when freezing the version. How I did it Not to update the version file when snapshot mirror enabled. How to verify it --- Makefile.work | 1 + scripts/prepare_docker_buildinfo.sh | 2 +- src/sonic-build-hooks/scripts/buildinfo_base.sh | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile.work b/Makefile.work index d51d5f5bfb73..83bf926d8ec3 100644 --- a/Makefile.work +++ b/Makefile.work @@ -203,6 +203,7 @@ $(shell CONFIGURED_ARCH=$(CONFIGURED_ARCH) \ PREPARE_DOCKER=BUILD_SLAVE=y \ DEFAULT_CONTAINER_REGISTRY=$(DEFAULT_CONTAINER_REGISTRY) \ + MIRROR_SNAPSHOT=$(MIRROR_SNAPSHOT) \ scripts/prepare_docker_buildinfo.sh \ $(SLAVE_BASE_IMAGE) \ $(SLAVE_DIR)/Dockerfile \ diff --git a/scripts/prepare_docker_buildinfo.sh b/scripts/prepare_docker_buildinfo.sh index 9aaea076ad88..ea4ce079bdd3 100755 --- a/scripts/prepare_docker_buildinfo.sh +++ b/scripts/prepare_docker_buildinfo.sh @@ -23,7 +23,7 @@ if [ -z "$DISTRO" ]; then [ -z "$DISTRO" ] && DISTRO=jessie fi -if [[ "$IMAGENAME" == docker-base-* ]] || [[ "$IMAGENAME" == docker-ptf ]]; then +if [[ "$IMAGENAME" == sonic-slave-* ]] || [[ "$IMAGENAME" == docker-base-* ]] || [[ "$IMAGENAME" == docker-ptf ]]; then scripts/build_mirror_config.sh ${DOCKERFILE_PATH} $ARCH $DISTRO fi diff --git a/src/sonic-build-hooks/scripts/buildinfo_base.sh b/src/sonic-build-hooks/scripts/buildinfo_base.sh index b702a2dbc101..965edb4055e6 100755 --- a/src/sonic-build-hooks/scripts/buildinfo_base.sh +++ b/src/sonic-build-hooks/scripts/buildinfo_base.sh @@ -351,6 +351,9 @@ update_version_file() update_version_files() { local version_names="versions-deb versions-py2 versions-py3" + if [ "$MIRROR_SNAPSHOT" == y ]; then + version_names="versions-py2 versions-py3" + fi for version_name in $version_names; do update_version_file $version_name done