From 4b2225bca573d7e17a07d21e9bc922ba6283ec8f Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Thu, 7 Dec 2017 13:08:23 -0800 Subject: [PATCH] [docker-snmpd]: asyncsnmp depends on sonic-utilities so it is possible to import sonic_psu (#1212) * asyncsnmp depends on sonic-utilities so it is possible to import sonic_psu Signed-off-by: Qi Luo * Ignore sonic_utilities test during build --- dockers/docker-snmp-sv2/Dockerfile.j2 | 1 + rules/asyncsnmp-py3.mk | 3 ++- rules/sonic-utilities.mk | 8 ++++++++ slave.mk | 2 +- src/sonic-utilities | 2 +- 5 files changed, 13 insertions(+), 3 deletions(-) diff --git a/dockers/docker-snmp-sv2/Dockerfile.j2 b/dockers/docker-snmp-sv2/Dockerfile.j2 index 2ab8670318..3c54739511 100644 --- a/dockers/docker-snmp-sv2/Dockerfile.j2 +++ b/dockers/docker-snmp-sv2/Dockerfile.j2 @@ -7,6 +7,7 @@ COPY [ \ "/debs/"] # Install Python SwSSSDK (SNMP subagent dependency) +COPY python-wheels/sonic_utilities-*-py3-*.whl /python-wheels/ COPY python-wheels/swsssdk-*-py3-*.whl /python-wheels/ COPY python-wheels/asyncsnmp-*-py3-*.whl /python-wheels/ diff --git a/rules/asyncsnmp-py3.mk b/rules/asyncsnmp-py3.mk index a5a078e15b..f44d7f3365 100644 --- a/rules/asyncsnmp-py3.mk +++ b/rules/asyncsnmp-py3.mk @@ -3,5 +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 -$(ASYNCSNMP_PY3)_DEPENDS += $(SWSSSDK_PY3) +# Depends on sonic-utilities so it is possible to import sonic_psu +$(ASYNCSNMP_PY3)_DEPENDS += $(SWSSSDK_PY3) $(SONIC_UTILS_PY3) SONIC_PYTHON_WHEELS += $(ASYNCSNMP_PY3) diff --git a/rules/sonic-utilities.mk b/rules/sonic-utilities.mk index 7a935ba70e..0dae94d8aa 100644 --- a/rules/sonic-utilities.mk +++ b/rules/sonic-utilities.mk @@ -4,3 +4,11 @@ SONIC_UTILS = python-sonic-utilities_1.1-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 1f00accb9e..8ec6832bd6 100644 --- a/slave.mk +++ b/slave.mk @@ -306,7 +306,7 @@ $(addprefix $(PYTHON_WHEELS_PATH)/, $(SONIC_PYTHON_WHEELS)) : $(PYTHON_WHEELS_PA pushd $($*_SRC_PATH) $(LOG) # apply series of patches if exist if [ -f ../$(notdir $($*_SRC_PATH)).patch/series ]; then QUILT_PATCHES=../$(notdir $($*_SRC_PATH)).patch quilt push -a; fi - python$($*_PYTHON_VERSION) setup.py test $(LOG) + [ "$($*_TEST)" = "n" ] || python$($*_PYTHON_VERSION) setup.py test $(LOG) python$($*_PYTHON_VERSION) setup.py bdist_wheel $(LOG) # clean up if [ -f ../$(notdir $($*_SRC_PATH)).patch/series ]; then quilt pop -a -f; fi diff --git a/src/sonic-utilities b/src/sonic-utilities index 0c0a2f02c3..ea108f3cac 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 0c0a2f02c32a8cafb3020d8248ea829bbc959d4a +Subproject commit ea108f3cac773ed8e71110c7da577fde28e9219b