From 8ec96b26600a6582bdfd524cb389efd87ef81472 Mon Sep 17 00:00:00 2001 From: Praveen Chaudhary Date: Mon, 27 Apr 2020 12:58:01 -0700 Subject: [PATCH] [docker-sonic-vs/Dockerfile.j2]: Install new YANG PKGs in VS docker. (#68) Changes: . Install new YANG PKGs in VS docker. . Install fixed version on other PY PKGs. Signed-off-by: Praveen Chaudhary pchaudhary@linkedin.com --- build_debian.sh | 4 ++-- platform/vs/docker-sonic-vs.mk | 3 ++- platform/vs/docker-sonic-vs/Dockerfile.j2 | 27 +++++++++++++---------- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/build_debian.sh b/build_debian.sh index 6cc2b585abe3..e4acdb5470a6 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -415,8 +415,8 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip install 'netifaces==0.10.7' # Get package to support Dynamic Port Breakout -sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip install xmltodict -sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip install jsondiff +sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip install xmltodict==0.12.0 +sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip install jsondiff==1.2.0 ## Create /var/run/redis folder for docker-database to mount sudo mkdir -p $FILESYSTEM_ROOT/var/run/redis diff --git a/platform/vs/docker-sonic-vs.mk b/platform/vs/docker-sonic-vs.mk index 406c422e73a8..2716237efb8b 100644 --- a/platform/vs/docker-sonic-vs.mk +++ b/platform/vs/docker-sonic-vs.mk @@ -16,7 +16,8 @@ $(DOCKER_SONIC_VS)_DEPENDS += $(SWSS) \ $(DOCKER_SONIC_VS)_PYTHON_DEBS += $(SONIC_UTILS) -$(DOCKER_SONIC_VS)_PYTHON_WHEELS += $(SONIC_YANG_MGMT_PY2) +$(DOCKER_SONIC_VS)_PYTHON_WHEELS += $(SONIC_YANG_MODELS_PY3) +$(DOCKER_SONIC_VS)_PYTHON_WHEELS += $(SONIC_YANG_MGMT_PY) ifeq ($(INSTALL_DEBUG_TOOLS), y) $(DOCKER_SONIC_VS)_DEPENDS += $(SWSS_DBG) \ diff --git a/platform/vs/docker-sonic-vs/Dockerfile.j2 b/platform/vs/docker-sonic-vs/Dockerfile.j2 index 227fb76a40e4..565c275b145e 100644 --- a/platform/vs/docker-sonic-vs/Dockerfile.j2 +++ b/platform/vs/docker-sonic-vs/Dockerfile.j2 @@ -53,7 +53,8 @@ RUN apt-get install -y net-tools \ python-scapy \ jq \ conntrack \ - iptables + iptables \ + python3-pip RUN pip install setuptools RUN pip install py2_ipaddress @@ -90,19 +91,21 @@ RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return {%- endif %} {% if docker_sonic_vs_whls.strip() %} -COPY \ +# copy all whl PKGs first, {% for whl in docker_sonic_vs_whls.split(' ') -%} -python-wheels/{{ whl }}{{' '}} -{%- endfor -%} -python-wheels/ -{%- endif -%} - -{% if docker_sonic_vs_whls.strip() %} -RUN pip install \ -{% for whl in docker_sonic_vs_whls.split(' ') -%} -python-wheels/{{ whl }}{{' '}} +COPY python-wheels/{{ whl }} python-wheels/ +{% endfor %} + +# install PKGs after copying all PKGs to avoid dependency failure +# use py3 to find python3 package, which is forced by wheel as of now +{%- for whl in docker_sonic_vs_whls.split(' ') %} +{%- if 'py3' in whl %} +RUN pip3 install python-wheels/{{ whl }} +{% else -%} +RUN pip install python-wheels/{{ whl }} +{%- endif %} {%- endfor %} -{%- endif -%} +{% endif %} # Clean up RUN apt-get clean -y