From 3ef7b560ec4266656aff4c0b2fafe9aa9c64cf6a Mon Sep 17 00:00:00 2001 From: LuiSzee Date: Sun, 4 Dec 2022 15:04:36 +0800 Subject: [PATCH] [build][arm64] fix debian source for arm64 bullseye docker image (#12778) Why I did it arm64 bullseye docker image source is set to jessie for VERSION_CODENAME is miss. shil@localhost:~/sonic-buildimage$ docker run -it multiarch/debian-debootstrap:arm64-bullseye bash root@b2e2fea86e2d:/# cat /etc/os-release | grep VERSION_CODENAME | cut -d= -f2 root@b2e2fea86e2d:/# cat /etc/os-release PRETTY_NAME="Debian GNU/Linux bullseye/sid" NAME="Debian GNU/Linux" ID=debian HOME_URL="https://www.debian.org/" SUPPORT_URL="https://www.debian.org/support" BUG_REPORT_URL="https://bugs.debian.org/" How I did it if DISTRO is NULL, find it in /etc/apt/sources.list root@b2e2fea86e2d:/# cat /etc/apt/sources.list | grep deb.debian.org | awk '{print $3}' bullseye root@b2e2fea86e2d:/# cat /etc/apt/sources.list deb http://deb.debian.org/debian bullseye main root@b2e2fea86e2d:/# --- scripts/prepare_docker_buildinfo.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/prepare_docker_buildinfo.sh b/scripts/prepare_docker_buildinfo.sh index 92fc78c9e9..84222d1c0a 100755 --- a/scripts/prepare_docker_buildinfo.sh +++ b/scripts/prepare_docker_buildinfo.sh @@ -20,7 +20,10 @@ mkdir -p $BUILDINFO_VERSION_PATH if [ -z "$DISTRO" ]; then DOCKER_BASE_IMAGE=$(grep "^FROM" $DOCKERFILE | head -n 1 | awk '{print $2}') DISTRO=$(docker run --rm --entrypoint "" $DOCKER_BASE_IMAGE cat /etc/os-release | grep VERSION_CODENAME | cut -d= -f2) - [ -z "$DISTRO" ] && DISTRO=jessie + if [ -z "$DISTRO" ]; then + DISTRO=$(docker run --rm --entrypoint "" $DOCKER_BASE_IMAGE cat /etc/apt/sources.list | grep deb.debian.org | awk '{print $3}') + [ -z "$DISTRO" ] && DISTRO=jessie + fi fi if [[ "$IMAGENAME" == docker-base-* ]]; then