From 047c7c891593e66e8f6cf7b0d14893a090135957 Mon Sep 17 00:00:00 2001 From: Sangita Maity Date: Wed, 17 Apr 2019 10:59:58 -0700 Subject: [PATCH] [dockers]: Upgrade LLDP docker to stretch build (#2633) * [dockers]: Upgrade LLDP docker to stretch build --- dockers/docker-lldp-sv2/Dockerfile.j2 | 4 +--- rules/docker-lldp-sv2.mk | 3 ++- rules/lldpd.mk | 7 +++++-- sonic-slave-stretch/Dockerfile | 7 +++++++ src/lldpd/Makefile | 26 +++++++++++++++++++------- 5 files changed, 34 insertions(+), 13 deletions(-) diff --git a/dockers/docker-lldp-sv2/Dockerfile.j2 b/dockers/docker-lldp-sv2/Dockerfile.j2 index f08a70c013..5f44d32cdd 100644 --- a/dockers/docker-lldp-sv2/Dockerfile.j2 +++ b/dockers/docker-lldp-sv2/Dockerfile.j2 @@ -1,4 +1,4 @@ -FROM docker-config-engine +FROM docker-config-engine-stretch ARG docker_container_name RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf @@ -9,8 +9,6 @@ ENV DEBIAN_FRONTEND=noninteractive # Update apt's cache of available packages RUN apt-get update -# Install dependencies -RUN apt-get install -y python-pip libbsd0 libevent-2.0-5 libjansson4 libwrap0 libxml2 libpci3 libperl5.20 libpython2.7 {% if docker_lldp_sv2_debs.strip() -%} # Copy locally-built Debian package dependencies diff --git a/rules/docker-lldp-sv2.mk b/rules/docker-lldp-sv2.mk index 93f08a5412..bb331917d6 100644 --- a/rules/docker-lldp-sv2.mk +++ b/rules/docker-lldp-sv2.mk @@ -4,9 +4,10 @@ DOCKER_LLDP_SV2 = docker-lldp-sv2.gz $(DOCKER_LLDP_SV2)_PATH = $(DOCKERS_PATH)/docker-lldp-sv2 $(DOCKER_LLDP_SV2)_DEPENDS += $(LLDPD) $(LIBSWSSCOMMON) $(PYTHON_SWSSCOMMON) $(DOCKER_LLDP_SV2)_PYTHON_WHEELS += $(DBSYNCD_PY2) -$(DOCKER_LLDP_SV2)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) +$(DOCKER_LLDP_SV2)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_STRETCH) SONIC_DOCKER_IMAGES += $(DOCKER_LLDP_SV2) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_LLDP_SV2) +SONIC_STRETCH_DOCKERS += $(DOCKER_LLDP_SV2) $(DOCKER_LLDP_SV2)_CONTAINER_NAME = lldp $(DOCKER_LLDP_SV2)_RUN_OPT += --net=host --privileged -t diff --git a/rules/lldpd.mk b/rules/lldpd.mk index 0e0d13721f..ff7f8889ad 100644 --- a/rules/lldpd.mk +++ b/rules/lldpd.mk @@ -1,17 +1,20 @@ # lldpd package LLDPD_VERSION = 0.9.6 +LLDPD_VERSION_SUFFIX = 1 +LLDPD_VERSION_FULL = $(LLDPD_VERSION)-$(LLDPD_VERSION_SUFFIX) -LLDPD = lldpd_$(LLDPD_VERSION)-0_amd64.deb +LLDPD = lldpd_$(LLDPD_VERSION_FULL)_amd64.deb $(LLDPD)_DEPENDS += $(LIBSNMP_DEV) $(LLDPD)_RDEPENDS += $(LIBSNMP) $(LLDPD)_SRC_PATH = $(SRC_PATH)/lldpd SONIC_MAKE_DEBS += $(LLDPD) -LIBLLDPCTL = liblldpctl-dev_$(LLDPD_VERSION)-0_amd64.deb +LIBLLDPCTL = liblldpctl-dev_$(LLDPD_VERSION_FULL)_amd64.deb $(eval $(call add_derived_package,$(LLDPD),$(LIBLLDPCTL))) # Export these variables so they can be used in a sub-make export LLDPD_VERSION +export LLDPD_VERSION_FULL export LLDPD export LIBLLDPCTL diff --git a/sonic-slave-stretch/Dockerfile b/sonic-slave-stretch/Dockerfile index 77746e2e77..7a1762dfd1 100644 --- a/sonic-slave-stretch/Dockerfile +++ b/sonic-slave-stretch/Dockerfile @@ -184,6 +184,12 @@ RUN apt-get update && apt-get install -y \ libsensors4 \ libsensors4-dev \ libwrap0-dev \ +# For lldpd + debhelper \ + autotools-dev \ + libbsd-dev \ + pkg-config \ + check \ # For mpdecimal docutils-common \ libjs-sphinxdoc \ @@ -261,6 +267,7 @@ RUN pip install click-default-group click natsort tabulate netifaces==0.10.7 fas # For sonic snmpagent mock testing RUN pip3 install mockredispy==2.9.3 + RUN pip3 install PyYAML>=5.1 # For sonic-platform-common testing diff --git a/src/lldpd/Makefile b/src/lldpd/Makefile index 5f502b8686..ca0f83aa6d 100644 --- a/src/lldpd/Makefile +++ b/src/lldpd/Makefile @@ -5,18 +5,30 @@ SHELL = /bin/bash MAIN_TARGET = $(LLDPD) DERIVED_TARGETS = $(LIBLLDPCTL) +LLDP_URL = http://ftp.debian.org/debian/pool/main/l/lldpd + +DSC_FILE = lldpd_$(LLDPD_VERSION_FULL).dsc +ORIG_FILE = lldpd_$(LLDPD_VERSION).orig.tar.gz +DEBIAN_FILE = lldpd_$(LLDPD_VERSION_FULL).debian.tar.xz + +DSC_FILE_URL = $(LLDP_URL)/$(DSC_FILE) +ORIG_FILE_URL = $(LLDP_URL)/$(ORIG_FILE) +DEBIAN_FILE_URL = $(LLDP_URL)/$(DEBIAN_FILE) + $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Remove any stale files rm -rf ./lldpd - # Clone lldpd repo - git clone https://github.com/vincentbernat/lldpd.git - pushd ./lldpd + # download debian LLDPDD + wget -NO "$(DSC_FILE)" $(DSC_FILE_URL) + wget -NO "$(ORIG_FILE)" $(ORIG_FILE_URL) + wget -NO "$(DEBIAN_FILE)" $(DEBIAN_FILE_URL) + dpkg-source -x lldpd_$(LLDPD_VERSION_FULL).dsc - # Reset HEAD to the commit of the proper tag - # NOTE: Using "git checkout " here detaches our HEAD, - # which stg doesn't like, so we use this method instead - git reset --hard $(LLDPD_VERSION) + pushd lldpd-$(LLDPD_VERSION) + git init + git add -f * + git commit -m "unmodified lldp source" # Apply patches stg init