Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sonic-sdk] add sonic sdk and sonic sdk buildenv #6712

Merged
merged 11 commits into from
May 28, 2021
19 changes: 9 additions & 10 deletions build_debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -474,16 +474,15 @@ fi

## Version file
sudo mkdir -p $FILESYSTEM_ROOT/etc/sonic
sudo tee $FILESYSTEM_ROOT/etc/sonic/sonic_version.yml > /dev/null <<EOF
build_version: '${SONIC_IMAGE_VERSION}'
debian_version: '$(cat $FILESYSTEM_ROOT/etc/debian_version)'
kernel_version: '$kversion'
asic_type: $sonic_asic_platform
commit_id: '$(git rev-parse --short HEAD)'
build_date: $(date -u)
build_number: ${BUILD_NUMBER:-0}
built_by: $USER@$BUILD_HOSTNAME
EOF
export build_version="${SONIC_IMAGE_VERSION}"
export debian_version="$(cat $FILESYSTEM_ROOT/etc/debian_version)"
export kernel_version="${kversion}"
export asic_type="${sonic_asic_platform}"
export commit_id="$(git rev-parse --short HEAD)"
export build_date="$(date -u)"
export build_number="${BUILD_NUMBER:-0}"
export built_by="$USER@$BUILD_HOSTNAME"
j2 files/build_templates/sonic_version.yml.j2 | sudo tee $FILESYSTEM_ROOT/etc/sonic/sonic_version.yml

## Copy over clean-up script
sudo cp ./files/scripts/core_cleanup.py $FILESYSTEM_ROOT/usr/bin/core_cleanup.py
Expand Down
43 changes: 43 additions & 0 deletions dockers/docker-sonic-sdk-buildenv/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %}
FROM sonic-sdk

ARG base_os_version
ARG docker_database_version
ARG docker_swss_version
ARG docker_syncd_version
ARG image_version

# Make apt-get non-interactive
ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && \
apt-get install -f -y \
build-essential

{% if docker_sonic_sdk_buildenv_debs.strip() -%}
# Copy locally-built Debian package dependencies
{{ copy_files("debs/", docker_sonic_sdk_buildenv_debs.split(' '), "/debs/") }}

# Install locally-built Debian packages and implicitly install their dependencies
{{ install_debian_packages(docker_sonic_sdk_buildenv_debs.split(' ')) }}
{%- endif %}

{% if docker_sonic_sdk_buildenv_whls.strip() %}
# Copy locally-built Python wheel dependencies
{{ copy_files("python-wheels/", docker_sonic_sdk_buildenv_whls.split(' '), "/python-wheels/") }}

# Install locally-built Python wheel dependencies
{{ install_python_wheels(docker_sonic_sdk_buildenv_whls.split(' ')) }}
{% endif %}

# Clean up
RUN apt-get clean -y && \
apt-get autoclean -y && \
apt-get autoremove -y && \
rm -rf /debs /python-wheels/

LABEL com.azure.sonic.sdk.versions.base-os=$base_os_version
LABEL com.azure.sonic.sdk.versions.database=$docker_database_version
LABEL com.azure.sonic.sdk.versions.swss=$docker_swss_version
LABEL com.azure.sonic.sdk.versions.syncd=$docker_syncd_version
LABEL com.azure.sonic.sdk.version.image_hash=$image_version
29 changes: 29 additions & 0 deletions dockers/docker-sonic-sdk/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %}
FROM docker-config-engine-buster

# Make apt-get non-interactive
ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update

{% if docker_sonic_sdk_debs.strip() -%}
# Copy locally-built Debian package dependencies
{{ copy_files("debs/", docker_sonic_sdk_debs.split(' '), "/debs/") }}

# Install locally-built Debian packages and implicitly install their dependencies
{{ install_debian_packages(docker_sonic_sdk_debs.split(' ')) }}
{%- endif %}

{% if docker_sonic_sdk_whls.strip() %}
# Copy locally-built Python wheel dependencies
{{ copy_files("python-wheels/", docker_sonic_sdk_whls.split(' '), "/python-wheels/") }}

# Install locally-built Python wheel dependencies
{{ install_python_wheels(docker_sonic_sdk_whls.split(' ')) }}
{% endif %}

# Clean up
RUN apt-get clean -y && \
apt-get autoclean -y && \
apt-get autoremove -y && \
rm -rf /debs /python-wheels/
20 changes: 20 additions & 0 deletions files/build_templates/sonic_version.yml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
build_version: '{{ build_version }}'
{% if debian_version is defined -%}
debian_version: '{{ debian_version }}'
{% endif -%}
{% if kernel_version is defined -%}
kernel_version: '{{ kernel_version }}'
{% endif -%}
asic_type: {{ asic_type }}
commit_id: '{{ commit_id }}'
build_date: {{ build_date }}
build_number: {{ build_number }}
built_by: {{ built_by }}
{% if components is defined -%}
{% for component in components.split() | unique -%}
{% set name, version = component.split('==') -%}
{{ name }}: {{ version }}
{% endfor -%}
{% endif -%}

15 changes: 7 additions & 8 deletions platform/vs/sonic-version/build_sonic_version.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
tee $1 > /dev/null <<EOF
build_version: '$sonic_version'
asic_type: $sonic_asic_platform
commit_id: '$(git rev-parse --short HEAD)'
build_date: $(date -u)
build_number: ${BUILD_NUMBER:-0}
built_by: $USER@$BUILD_HOSTNAME
EOF
export build_version="${sonic_version}"
export asic_type="${sonic_asic_platform}"
export commit_id="$(git rev-parse --short HEAD)"
export build_date="$(date -u)"
export build_number="${BUILD_NUMBER:-0}"
export built_by="$USER@$BUILD_HOSTNAME"
j2 sonic_version.yml.j2 > $1
1 change: 1 addition & 0 deletions platform/vs/sonic-version/sonic_version.yml.j2
4 changes: 3 additions & 1 deletion rules/docker-config-engine-buster.mk
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ $(DOCKER_CONFIG_ENGINE_BUSTER)_LOAD_DOCKERS += $(DOCKER_BASE_BUSTER)
$(DOCKER_CONFIG_ENGINE_BUSTER)_FILES += $(SWSS_VARS_TEMPLATE)
$(DOCKER_CONFIG_ENGINE_BUSTER)_FILES += $($(SONIC_CTRMGRD)_CONTAINER_SCRIPT)

$(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_DEPENDS = $($(DOCKER_BASE_BUSTER)_DBG_DEPENDS)
$(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_DEPENDS = $($(DOCKER_BASE_BUSTER)_DBG_DEPENDS) \
$(LIBSWSSCOMMON_DBG) \
stepanblyschak marked this conversation as resolved.
Show resolved Hide resolved
$(LIBHIREDIS_DBG)
$(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_PACKAGES = $($(DOCKER_BASE_BUSTER)_DBG_IMAGE_PACKAGES)

SONIC_DOCKER_IMAGES += $(DOCKER_CONFIG_ENGINE_BUSTER)
12 changes: 12 additions & 0 deletions rules/docker-sonic-sdk-buildenv.dep
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

DPATH := $($(DOCKER_SONIC_SDK_BUILDENV)_PATH)
DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/docker-sonic-sdk-buildenv.mk rules/docker-sonic-sdk-buildenv.dep
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST)
DEP_FILES += $(shell git ls-files $(DPATH))

$(DOCKER_SONIC_SDK_BUILDENV)_CACHE_MODE := GIT_CONTENT_SHA
$(DOCKER_SONIC_SDK_BUILDENV)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST)
$(DOCKER_SONIC_SDK_BUILDENV)_DEP_FILES := $(DEP_FILES)

$(eval $(call add_dbg_docker,$(DOCKER_SONIC_SDK_BUILDENV),$(DOCKER_SONIC_SDK_BUILDENV_DBG)))

29 changes: 29 additions & 0 deletions rules/docker-sonic-sdk-buildenv.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# SONiC SDK Docker Image

stepanblyschak marked this conversation as resolved.
Show resolved Hide resolved
DOCKER_SONIC_SDK_BUILDENV_STEM = sonic-sdk-buildenv
DOCKER_SONIC_SDK_BUILDENV = $(DOCKER_SONIC_SDK_BUILDENV_STEM).gz
DOCKER_SONIC_SDK_BUILDENV_DBG = $(DOCKER_SONIC_SDK_BUILDENV_STEM)-$(DBG_IMAGE_MARK).gz

$(DOCKER_SONIC_SDK_BUILDENV)_PATH = $(DOCKERS_PATH)/docker-sonic-sdk-buildenv

$(DOCKER_SONIC_SDK_BUILDENV)_DEPENDS += $(LIBSAIVS) \
$(LIBSAIVS_DEV) \
$(LIBSAIREDIS_DEV) \
$(LIBSAIMETADATA_DEV) \
$(LIBSWSSCOMMON_DEV) \
$(LIBHIREDIS_DEV) \
$(LIBNL3_DEV) \
$(LIBNL_GENL3_DEV) \
$(LIBNL_ROUTE3_DEV) \
$(LIBNL_NF3_DEV) \
$(LIBNL_CLI_DEV)

$(DOCKER_SONIC_SDK_BUILDENV)_DBG_DEPENDS = $($(DOCKER_SONIC_SDK)_DBG_DEPENDS) \
$(LIBSAIVS_DBG)
$(DOCKER_SONIC_SDK_BUILDENV)_DBG_IMAGE_PACKAGES = $($(DOCKER_SONIC_SDK)_DBG_IMAGE_PACKAGES)


$(DOCKER_SONIC_SDK_BUILDENV)_LOAD_DOCKERS += $(DOCKER_SONIC_SDK)

SONIC_DOCKER_IMAGES += $(DOCKER_SONIC_SDK_BUILDENV)
SONIC_DOCKER_DBG_IMAGES += $(DOCKER_SONIC_SDK_BUILDENV_DBG)
12 changes: 12 additions & 0 deletions rules/docker-sonic-sdk.dep
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

DPATH := $($(DOCKER_SONIC_SDK)_PATH)
DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/docker-sonic-sdk.mk rules/docker-sonic-sdk.dep
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST)
DEP_FILES += $(shell git ls-files $(DPATH))

$(DOCKER_SONIC_SDK)_CACHE_MODE := GIT_CONTENT_SHA
$(DOCKER_SONIC_SDK)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST)
$(DOCKER_SONIC_SDK)_DEP_FILES := $(DEP_FILES)

$(eval $(call add_dbg_docker,$(DOCKER_SONIC_SDK),$(DOCKER_SONIC_SDK_DBG)))

24 changes: 24 additions & 0 deletions rules/docker-sonic-sdk.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# SONiC SDK Docker Image

DOCKER_SONIC_SDK_STEM = sonic-sdk
DOCKER_SONIC_SDK = $(DOCKER_SONIC_SDK_STEM).gz
DOCKER_SONIC_SDK_DBG = $(DOCKER_SONIC_SDK_STEM)-$(DBG_IMAGE_MARK).gz

$(DOCKER_SONIC_SDK)_PATH = $(DOCKERS_PATH)/docker-sonic-sdk

$(DOCKER_SONIC_SDK)_DEPENDS += $(LIBSAIREDIS) \
$(LIBSAIMETADATA)
$(DOCKER_SONIC_SDK)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER)

$(DOCKER_SONIC_SDK)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_DEPENDS) \
$(LIBSAIREDIS_DBG) \
$(LIBSAIMETADATA_DBG)
$(DOCKER_SONIC_SDK)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_PACKAGES)

SONIC_DOCKER_IMAGES += $(DOCKER_SONIC_SDK)
SONIC_DOCKER_DBG_IMAGES += $(DOCKER_SONIC_SDK_DBG)

$(DOCKER_SONIC_SDK)_LABELS += com.azure.sonic.versions.libswsscommon=$(LIBSWSSCOMMON_VERSION)
$(DOCKER_SONIC_SDK)_LABELS += com.azure.sonic.versions.libsairedis=$(LIBSAIREDIS_VERSION)

$(DOCKER_SONIC_SDK)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT)
2 changes: 2 additions & 0 deletions rules/functions
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ $(2)_MAIN_DEB = $(1)
$(1)_DERIVED_DEBS += $(2)
$(2)_URL = $($(1)_URL)
$(2)_SRC_PATH = $($(1)_SRC_PATH)
$(2)_NAME = $($(1)_NAME)
$(2)_VERSION = $($(1)_VERSION)
SONIC_DERIVED_DEBS += $(2)
endef

Expand Down
23 changes: 14 additions & 9 deletions rules/sairedis.mk
Original file line number Diff line number Diff line change
@@ -1,41 +1,46 @@
# sairedis package

LIBSAIREDIS = libsairedis_1.0.0_$(CONFIGURED_ARCH).deb
LIBSAIREDIS_VERSION = 1.0.0
LIBSAIREDIS_NAME = libsairedis

LIBSAIREDIS = $(LIBSAIREDIS_NAME)_$(LIBSAIREDIS_VERSION)_$(CONFIGURED_ARCH).deb
$(LIBSAIREDIS)_DPKG_TARGET = binary-sairedis
$(LIBSAIREDIS)_SRC_PATH = $(SRC_PATH)/sonic-sairedis
$(LIBSAIREDIS)_VERSION = $(LIBSAIREDIS_VERSION)
$(LIBSAIREDIS)_NAME = $(LIBSAIREDIS_NAME)
$(LIBSAIREDIS)_DEPENDS += $(LIBSWSSCOMMON_DEV)
$(LIBSAIREDIS)_RDEPENDS += $(LIBSWSSCOMMON)
$(LIBSAIREDIS)_DEB_BUILD_OPTIONS = nocheck
SONIC_DPKG_DEBS += $(LIBSAIREDIS)

LIBSAIREDIS_DEV = libsairedis-dev_1.0.0_$(CONFIGURED_ARCH).deb
LIBSAIREDIS_DEV = $(LIBSAIREDIS_NAME)-dev_$(LIBSAIREDIS_VERSION)_$(CONFIGURED_ARCH).deb
$(eval $(call add_derived_package,$(LIBSAIREDIS),$(LIBSAIREDIS_DEV)))

LIBSAIVS = libsaivs_1.0.0_$(CONFIGURED_ARCH).deb
LIBSAIVS = libsaivs_$(LIBSAIREDIS_VERSION)_$(CONFIGURED_ARCH).deb
$(eval $(call add_derived_package,$(LIBSAIREDIS),$(LIBSAIVS)))

LIBSAIVS_DEV = libsaivs-dev_1.0.0_$(CONFIGURED_ARCH).deb
LIBSAIVS_DEV = libsaivs-dev_$(LIBSAIREDIS_VERSION)_$(CONFIGURED_ARCH).deb
$(eval $(call add_derived_package,$(LIBSAIREDIS),$(LIBSAIVS_DEV)))
$(LIBSAIVS_DEV)_DEPENDS += $(LIBSAIVS)

LIBSAIMETADATA = libsaimetadata_1.0.0_$(CONFIGURED_ARCH).deb
LIBSAIMETADATA = libsaimetadata_$(LIBSAIREDIS_VERSION)_$(CONFIGURED_ARCH).deb
$(eval $(call add_derived_package,$(LIBSAIREDIS),$(LIBSAIMETADATA)))

LIBSAIMETADATA_DEV = libsaimetadata-dev_1.0.0_$(CONFIGURED_ARCH).deb
LIBSAIMETADATA_DEV = libsaimetadata-dev_$(LIBSAIREDIS_VERSION)_$(CONFIGURED_ARCH).deb
$(LIBSAIMETADATA_DEV)_DEPENDS += $(LIBSAIMETADATA)
$(eval $(call add_derived_package,$(LIBSAIREDIS),$(LIBSAIMETADATA_DEV)))

LIBSAIREDIS_DBG = libsairedis-dbg_1.0.0_$(CONFIGURED_ARCH).deb
LIBSAIREDIS_DBG = $(LIBSAIREDIS_NAME)-dbg_$(LIBSAIREDIS_VERSION)_$(CONFIGURED_ARCH).deb
$(LIBSAIREDIS_DBG)_DEPENDS += $(LIBSAIREDIS)
$(LIBSAIREDIS_DBG)_RDEPENDS += $(LIBSAIREDIS)
$(eval $(call add_derived_package,$(LIBSAIREDIS),$(LIBSAIREDIS_DBG)))

LIBSAIVS_DBG = libsaivs-dbg_1.0.0_$(CONFIGURED_ARCH).deb
LIBSAIVS_DBG = libsaivs-dbg_$(LIBSAIREDIS_VERSION)_$(CONFIGURED_ARCH).deb
$(LIBSAIVS_DBG)_DEPENDS += $(LIBSAIVS)
$(LIBSAIVS_DBG)_RDEPENDS += $(LIBSAIVS)
$(eval $(call add_derived_package,$(LIBSAIREDIS),$(LIBSAIVS_DBG)))

LIBSAIMETADATA_DBG = libsaimetadata-dbg_1.0.0_$(CONFIGURED_ARCH).deb
LIBSAIMETADATA_DBG = libsaimetadata-dbg_$(LIBSAIREDIS_VERSION)_$(CONFIGURED_ARCH).deb
$(LIBSAIMETADATA_DBG)_DEPENDS += $(LIBSAIMETADATA)
$(LIBSAIMETADATA_DBG)_RDEPENDS += $(LIBSAIMETADATA)
$(eval $(call add_derived_package,$(LIBSAIREDIS),$(LIBSAIMETADATA_DBG)))
Expand Down
6 changes: 5 additions & 1 deletion rules/sonic-utilities.mk
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# sonic utilities package

SONIC_UTILITIES_PY3 = sonic_utilities-1.2-py3-none-any.whl
SONIC_UTILITIES_PY3_VERSION = 1.2
SONIC_UTILITIES_PY3_NAME = sonic_utilities
SONIC_UTILITIES_PY3 = $(SONIC_UTILITIES_PY3_NAME)-$(SONIC_UTILITIES_PY3_VERSION)-py3-none-any.whl
$(SONIC_UTILITIES_PY3)_SRC_PATH = $(SRC_PATH)/sonic-utilities
$(SONIC_UTILITIES_PY3)_PYTHON_VERSION = 3
$(SONIC_UTILITIES_PY3)_NAME = $(SONIC_UTILITIES_PY3_NAME)
$(SONIC_UTILITIES_PY3)_VERSION = $(SONIC_UTILITIES_PY3_VERSION)
$(SONIC_UTILITIES_PY3)_DEPENDS += $(SONIC_PY_COMMON_PY3) \
$(SWSSSDK_PY3) \
$(SONIC_CONFIG_ENGINE_PY3) \
Expand Down
15 changes: 10 additions & 5 deletions rules/swss-common.mk
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
# libswsscommon package

LIBSWSSCOMMON = libswsscommon_1.0.0_$(CONFIGURED_ARCH).deb
LIBSWSSCOMMON_VERSION = 1.0.0
LIBSWSSCOMMON_NAME = libswsscommon

LIBSWSSCOMMON = $(LIBSWSSCOMMON_NAME)_$(LIBSWSSCOMMON_VERSION)_$(CONFIGURED_ARCH).deb
$(LIBSWSSCOMMON)_SRC_PATH = $(SRC_PATH)/sonic-swss-common
$(LIBSWSSCOMMON)_VERSION = $(LIBSWSSCOMMON_VERSION)
$(LIBSWSSCOMMON)_NAME = $(LIBSWSSCOMMON_NAME)
$(LIBSWSSCOMMON)_DEPENDS += $(LIBHIREDIS_DEV) $(LIBNL3_DEV) $(LIBNL_GENL3_DEV) \
$(LIBNL_ROUTE3_DEV) $(LIBNL_NF3_DEV) \
$(LIBNL_CLI_DEV)
$(LIBSWSSCOMMON)_RDEPENDS += $(LIBHIREDIS) $(LIBNL3) $(LIBNL_GENL3) \
$(LIBNL_ROUTE3) $(LIBNL_NF3) $(LIBNL_CLI)
SONIC_DPKG_DEBS += $(LIBSWSSCOMMON)

LIBSWSSCOMMON_DEV = libswsscommon-dev_1.0.0_$(CONFIGURED_ARCH).deb
LIBSWSSCOMMON_DEV = $(LIBSWSSCOMMON_NAME)-dev_$(LIBSWSSCOMMON_VERSION)_$(CONFIGURED_ARCH).deb
$(eval $(call add_derived_package,$(LIBSWSSCOMMON),$(LIBSWSSCOMMON_DEV)))

PYTHON_SWSSCOMMON = python-swsscommon_1.0.0_$(CONFIGURED_ARCH).deb
PYTHON_SWSSCOMMON = python-swsscommon_$(LIBSWSSCOMMON_VERSION)_$(CONFIGURED_ARCH).deb
$(eval $(call add_derived_package,$(LIBSWSSCOMMON),$(PYTHON_SWSSCOMMON)))

PYTHON3_SWSSCOMMON = python3-swsscommon_1.0.0_$(CONFIGURED_ARCH).deb
PYTHON3_SWSSCOMMON = python3-swsscommon_$(LIBSWSSCOMMON_VERSION)_$(CONFIGURED_ARCH).deb
$(eval $(call add_derived_package,$(LIBSWSSCOMMON),$(PYTHON3_SWSSCOMMON)))

LIBSWSSCOMMON_DBG = libswsscommon-dbg_1.0.0_$(CONFIGURED_ARCH).deb
LIBSWSSCOMMON_DBG = $(LIBSWSSCOMMON_NAME)-dbg_$(LIBSWSSCOMMON_VERSION)_$(CONFIGURED_ARCH).deb
$(LIBSWSSCOMMON_DBG)_DEPENDS += $(LIBSWSSCOMMON)
$(LIBSWSSCOMMON_DBG)_RDEPENDS += $(LIBSWSSCOMMON)
$(eval $(call add_derived_package,$(LIBSWSSCOMMON),$(LIBSWSSCOMMON_DBG)))
Expand Down
12 changes: 10 additions & 2 deletions slave.mk
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,10 @@ $(addprefix $(TARGET_PATH)/, $(DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform
$(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_whls=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_PYTHON_WHEELS)))\n" | awk '!a[$$0]++'))
$(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_dbgs=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_DBG_PACKAGES)))\n" | awk '!a[$$0]++'))
$(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_pkgs=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_APT_PACKAGES)))\n" | awk '!a[$$0]++'))
# Label docker image with componenets versions
$(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_labels=$(foreach component,$($*.gz_DEPENDS) $($*.gz_PYTHON_DEBS) $($*.gz_PYTHON_WHEELS),\
$(shell [[ ! -z "$($(component)_VERSION)" && ! -z "$($(component)_NAME)" ]] && \
echo "--label com.azure.sonic.versions.$($(component)_NAME)=$($(component)_VERSION)")))
j2 $($*.gz_PATH)/Dockerfile.j2 > $($*.gz_PATH)/Dockerfile
$(call generate_manifest,$*)
# Prepare docker build info
Expand All @@ -768,6 +772,7 @@ $(addprefix $(TARGET_PATH)/, $(DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform
--build-arg image_version=$(SONIC_IMAGE_VERSION) \
--label com.azure.sonic.manifest="$$(cat $($*.gz_PATH)/manifest.json)" \
--label Tag=$(SONIC_IMAGE_VERSION) \
$($(subst -,_,$(notdir $($*.gz_PATH)))_labels) \
-t $* $($*.gz_PATH) $(LOG)
scripts/collect_docker_version_files.sh $* $(TARGET_PATH)
docker save $* | gzip -c > $@
Expand Down Expand Up @@ -835,7 +840,8 @@ SONIC_TARGET_LIST += $(addprefix $(TARGET_PATH)/, $(DOCKER_DBG_IMAGES))

DOCKER_LOAD_TARGETS = $(addsuffix -load,$(addprefix $(TARGET_PATH)/, \
$(SONIC_SIMPLE_DOCKER_IMAGES) \
$(DOCKER_IMAGES)))
$(DOCKER_IMAGES) \
$(DOCKER_DBG_IMAGES)))

$(DOCKER_LOAD_TARGETS) : $(TARGET_PATH)/%.gz-load : .platform docker-start $$(TARGET_PATH)/$$*.gz
$(HEADER)
Expand Down Expand Up @@ -944,7 +950,9 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \
export python_swss_debs+=" $(addprefix $(IMAGE_DISTRO_DEBS_PATH)/,$(LIBSWSSCOMMON)) $(addprefix $(IMAGE_DISTRO_DEBS_PATH)/,$(PYTHON_SWSSCOMMON)) $(addprefix $(IMAGE_DISTRO_DEBS_PATH)/,$(PYTHON3_SWSSCOMMON))"
export sonic_utilities_py3_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_UTILITIES_PY3))"
export sonic_host_services_py3_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_HOST_SERVICES_PY3))"

export components="$(foreach component,$(notdir $^),\
$(shell [[ ! -z '$($(component)_VERSION)' && ! -z '$($(component)_NAME)' ]] && \
echo $($(component)_NAME)==$($(component)_VERSION)))"
$(foreach docker, $($*_DOCKERS),\
export docker_image="$(docker)"
export docker_image_name="$(basename $(docker))"
Expand Down