Skip to content

Commit

Permalink
[dockers]: Upgrade LLDP docker to stretch build (#2633)
Browse files Browse the repository at this point in the history
* [dockers]: Upgrade LLDP docker to stretch build
  • Loading branch information
samaity authored and lguohan committed Apr 17, 2019
1 parent b0b0862 commit 047c7c8
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 13 deletions.
4 changes: 1 addition & 3 deletions dockers/docker-lldp-sv2/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion rules/docker-lldp-sv2.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions rules/lldpd.mk
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions sonic-slave-stretch/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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
Expand Down
26 changes: 19 additions & 7 deletions src/lldpd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 <tag_name>" 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
Expand Down

0 comments on commit 047c7c8

Please sign in to comment.