diff --git a/.gitmodules b/.gitmodules index 1c7a6da0281..bcc9a8f3038 100644 --- a/.gitmodules +++ b/.gitmodules @@ -50,6 +50,9 @@ [submodule "platform/broadcom/sonic-platform-modules-ingrasys"] path = platform/broadcom/sonic-platform-modules-ingrasys url = https://github.com/Ingrasys-sonic/sonic-platform-modules-ingrasys +[submodule "src/sonic-platform-common"] + path = src/sonic-platform-common + url = https://github.com/Azure/sonic-platform-common [submodule "src/sonic-platform-daemons"] path = src/sonic-platform-daemons url = https://github.com/Azure/sonic-platform-daemons diff --git a/dockers/docker-snmp-sv2/Dockerfile.j2 b/dockers/docker-snmp-sv2/Dockerfile.j2 index 3c547395111..0e83b230746 100644 --- a/dockers/docker-snmp-sv2/Dockerfile.j2 +++ b/dockers/docker-snmp-sv2/Dockerfile.j2 @@ -7,7 +7,7 @@ COPY [ \ "/debs/"] # Install Python SwSSSDK (SNMP subagent dependency) -COPY python-wheels/sonic_utilities-*-py3-*.whl /python-wheels/ +COPY python-wheels/sonic_platform_common-*-py3-*.whl /python-wheels/ COPY python-wheels/swsssdk-*-py3-*.whl /python-wheels/ COPY python-wheels/asyncsnmp-*-py3-*.whl /python-wheels/ diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index f861543e98c..a2bea7a6baa 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -77,6 +77,12 @@ sudo cp {{swsssdk_py2_wheel_path}} $FILESYSTEM_ROOT/$SWSSSDK_PY2_WHEEL_NAME sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip install $SWSSSDK_PY2_WHEEL_NAME sudo rm -rf $FILESYSTEM_ROOT/$SWSSSDK_PY2_WHEEL_NAME +# Install sonic-platform-common Python 2 package +PLATFORM_COMMON_PY2_WHEEL_NAME=$(basename {{platform_common_py2_wheel_path}}) +sudo cp {{platform_common_py2_wheel_path}} $FILESYSTEM_ROOT/$PLATFORM_COMMON_PY2_WHEEL_NAME +sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip install $PLATFORM_COMMON_PY2_WHEEL_NAME +sudo rm -rf $FILESYSTEM_ROOT/$PLATFORM_COMMON_PY2_WHEEL_NAME + # Install SONiC Utilities (and its dependencies via 'apt-get -y install -f') sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/python-sonic-utilities_*.deb || \ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f diff --git a/platform/p4/docker-sonic-p4.mk b/platform/p4/docker-sonic-p4.mk index ebe7ceb080a..1cd15439fb7 100644 --- a/platform/p4/docker-sonic-p4.mk +++ b/platform/p4/docker-sonic-p4.mk @@ -3,11 +3,11 @@ DOCKER_SONIC_P4 = docker-sonic-p4.gz $(DOCKER_SONIC_P4)_PATH = $(PLATFORM_PATH)/docker-sonic-p4 $(DOCKER_SONIC_P4)_DEPENDS += $(SWSS) \ - $(SYNCD) \ - $(P4_SWITCH) \ - $(REDIS_SERVER) \ - $(REDIS_TOOLS) \ - $(PYTHON_SWSSCOMMON) \ + $(SYNCD) \ + $(P4_SWITCH) \ + $(REDIS_SERVER) \ + $(REDIS_TOOLS) \ + $(PYTHON_SWSSCOMMON) \ $(LIBTEAMDCT) \ $(LIBTEAM_UTILS) \ $(SONIC_DEVICE_DATA) \ diff --git a/rules/asyncsnmp-py3.mk b/rules/asyncsnmp-py3.mk index f44d7f33653..cc0af244d85 100644 --- a/rules/asyncsnmp-py3.mk +++ b/rules/asyncsnmp-py3.mk @@ -3,6 +3,6 @@ ASYNCSNMP_PY3 = asyncsnmp-2.1.0-py3-none-any.whl $(ASYNCSNMP_PY3)_SRC_PATH = $(SRC_PATH)/sonic-snmpagent $(ASYNCSNMP_PY3)_PYTHON_VERSION = 3 -# Depends on sonic-utilities so it is possible to import sonic_psu -$(ASYNCSNMP_PY3)_DEPENDS += $(SWSSSDK_PY3) $(SONIC_UTILS_PY3) +# Depends on sonic-platform-common so it is possible to import sonic_psu +$(ASYNCSNMP_PY3)_DEPENDS += $(SWSSSDK_PY3) $(SONIC_PLATFORM_COMMON_PY3) SONIC_PYTHON_WHEELS += $(ASYNCSNMP_PY3) diff --git a/rules/sonic-ledd.mk b/rules/sonic-ledd.mk index aa95b46cf47..056f0f6c9bd 100644 --- a/rules/sonic-ledd.mk +++ b/rules/sonic-ledd.mk @@ -1,5 +1,5 @@ # sonic-ledd (SONiC Front-panel LED control daemon) Debian package -SONIC_LEDD = python-sonic-ledd_1.0-1_all.deb +SONIC_LEDD = python-sonic-ledd_1.1-1_all.deb $(SONIC_LEDD)_SRC_PATH = $(SRC_PATH)/sonic-platform-daemons/sonic-ledd SONIC_PYTHON_STDEB_DEBS += $(SONIC_LEDD) diff --git a/rules/sonic-platform-common.mk b/rules/sonic-platform-common.mk new file mode 100644 index 00000000000..95789354a4d --- /dev/null +++ b/rules/sonic-platform-common.mk @@ -0,0 +1,13 @@ +# sonic-platform-common package + +SONIC_PLATFORM_COMMON_PY2 = sonic_platform_common-1.0-py2-none-any.whl +$(SONIC_PLATFORM_COMMON_PY2)_SRC_PATH = $(SRC_PATH)/sonic-platform-common +$(SONIC_PLATFORM_COMMON_PY2)_PYTHON_VERSION = 2 +SONIC_PYTHON_WHEELS += $(SONIC_PLATFORM_COMMON_PY2) + +# Als build sonic-platform-common into python3 wheel, so we can use PSU code in SNMP docker +# Note: _DEPENDS macro is not defined +SONIC_PLATFORM_COMMON_PY3 = sonic_platform_common-1.0-py3-none-any.whl +$(SONIC_PLATFORM_COMMON_PY3)_SRC_PATH = $(SRC_PATH)/sonic-platform-common +$(SONIC_PLATFORM_COMMON_PY3)_PYTHON_VERSION = 3 +SONIC_PYTHON_WHEELS += $(SONIC_PLATFORM_COMMON_PY3) diff --git a/rules/sonic-utilities.mk b/rules/sonic-utilities.mk index 0dae94d8aa7..eba618d051d 100644 --- a/rules/sonic-utilities.mk +++ b/rules/sonic-utilities.mk @@ -1,14 +1,16 @@ # sonic utilities package +# +# NOTE: sonic-config-engine is a build-time dependency of sonic-utilities +# due to unit tests which are run during the build. However, +# sonic-platform-common and swsssdk are runtime dependencies, and should be +# added here also. However, the current build system assumes all runtime +# dependencies are .deb packages. +# +# TODO: Create a way to specify both .deb and .whl runtime dependencies +# then add the aforementioned runtime dependencies here. +# -SONIC_UTILS = python-sonic-utilities_1.1-1_all.deb +SONIC_UTILS = python-sonic-utilities_1.2-1_all.deb $(SONIC_UTILS)_SRC_PATH = $(SRC_PATH)/sonic-utilities $(SONIC_UTILS)_WHEEL_DEPENDS = $(SONIC_CONFIG_ENGINE) SONIC_PYTHON_STDEB_DEBS += $(SONIC_UTILS) - -# Build sonic-utilities into python3 wheel, so we can use PSU code -# Note: _DEPENDS macro is not defined -SONIC_UTILS_PY3 = sonic_utilities-1.1-py3-none-any.whl -$(SONIC_UTILS_PY3)_SRC_PATH = $(SRC_PATH)/sonic-utilities -$(SONIC_UTILS_PY3)_PYTHON_VERSION = 3 -$(SONIC_UTILS_PY3)_TEST = n -SONIC_PYTHON_WHEELS += $(SONIC_UTILS_PY3) diff --git a/slave.mk b/slave.mk index 425ba4c41d8..34a892b7328 100644 --- a/slave.mk +++ b/slave.mk @@ -416,7 +416,8 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ $(LIBPAM_TACPLUS) \ $(LIBNSS_TACPLUS)) \ $$(addprefix $(TARGET_PATH)/,$$($$*_DOCKERS)) \ - $$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_CONFIG_ENGINE)) + $$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_CONFIG_ENGINE)) \ + $$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_PLATFORM_COMMON_PY2)) $(HEADER) # Pass initramfs and linux kernel explicitly. They are used for all platforms export initramfs_tools="$(DEBS_PATH)/$(INITRAMFS_TOOLS)" @@ -433,6 +434,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ export installer_images="$(addprefix $(TARGET_PATH)/,$($*_DOCKERS))" export config_engine_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_CONFIG_ENGINE))" export swsssdk_py2_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SWSSSDK_PY2))" + export platform_common_py2_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_PLATFORM_COMMON_PY2))" $(foreach docker, $($*_DOCKERS),\ export docker_image="$(docker)" diff --git a/src/sonic-platform-common b/src/sonic-platform-common new file mode 160000 index 00000000000..0581611b7be --- /dev/null +++ b/src/sonic-platform-common @@ -0,0 +1 @@ +Subproject commit 0581611b7be5cc52aea2877199785fe72f759a58 diff --git a/src/sonic-platform-daemons b/src/sonic-platform-daemons index d1df4717627..920f29b3918 160000 --- a/src/sonic-platform-daemons +++ b/src/sonic-platform-daemons @@ -1 +1 @@ -Subproject commit d1df4717627acf9421861545b71e411acf3c5f32 +Subproject commit 920f29b3918635cce14a1e03749ffb1e76bf9abd diff --git a/src/sonic-utilities b/src/sonic-utilities index 6823ce2f3e4..495584bd2f2 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 6823ce2f3e46d9bbf5fcfa6b371705a7368929cb +Subproject commit 495584bd2f228af81934b23e4cf19648ab387fab