Skip to content

Commit

Permalink
[sflow]: Upgrade sflow container to be based on Bookworm (#18543)
Browse files Browse the repository at this point in the history
Microsoft ADO (number only): 27475035

Signed-off-by: Saikrishna Arcot <[email protected]>
  • Loading branch information
saiarcot895 authored May 12, 2024
1 parent 7319409 commit f2f9a76
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 64 deletions.
4 changes: 2 additions & 2 deletions dockers/docker-sflow/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %}
FROM docker-swss-layer-bullseye-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}}
FROM docker-swss-layer-bookworm-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}}

ARG docker_container_name

Expand All @@ -9,7 +9,7 @@ ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -f -y \
dmidecode \
libmnl0=1.0.4-3
libmnl0

{% if docker_sflow_debs.strip() -%}
# Copy locally-built Debian package dependencies
Expand Down
10 changes: 5 additions & 5 deletions rules/docker-sflow.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ DOCKER_SFLOW_DBG = $(DOCKER_SFLOW_STEM)-$(DBG_IMAGE_MARK).gz
$(DOCKER_SFLOW)_PATH = $(DOCKERS_PATH)/$(DOCKER_SFLOW_STEM)

$(DOCKER_SFLOW)_DEPENDS += $(SWSS) $(HSFLOWD) $(SFLOWTOOL) $(PSAMPLE)
$(DOCKER_SFLOW)_DBG_DEPENDS = $($(DOCKER_SWSS_LAYER_BULLSEYE)_DBG_DEPENDS)
$(DOCKER_SFLOW)_DBG_DEPENDS = $($(DOCKER_SWSS_LAYER_BOOKWORM)_DBG_DEPENDS)
$(DOCKER_SFLOW)_DBG_DEPENDS += $(HSFLOWD_DBG)
$(DOCKER_TEAMD)_DBG_DEPENDS += $(SWSS_DBG) $(LIBSWSSCOMMON_DBG)
$(DOCKER_SFLOW)_DBG_IMAGE_PACKAGES = $($(DOCKER_SWSS_LAYER_BULLSEYE)_DBG_IMAGE_PACKAGES)
$(DOCKER_SFLOW)_DBG_IMAGE_PACKAGES = $($(DOCKER_SWSS_LAYER_BOOKWORM)_DBG_IMAGE_PACKAGES)

$(DOCKER_SFLOW)_LOAD_DOCKERS += $(DOCKER_SWSS_LAYER_BULLSEYE)
$(DOCKER_SFLOW)_LOAD_DOCKERS += $(DOCKER_SWSS_LAYER_BOOKWORM)

$(DOCKER_SFLOW)_VERSION = 1.0.0
$(DOCKER_SFLOW)_PACKAGE_NAME = sflow
Expand All @@ -39,5 +39,5 @@ $(DOCKER_SFLOW)_BASE_IMAGE_FILES += psample:/usr/bin/psample
$(DOCKER_SFLOW)_BASE_IMAGE_FILES += sflowtool:/usr/bin/sflowtool
$(DOCKER_SFLOW)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT)

SONIC_BULLSEYE_DOCKERS += $(DOCKER_SFLOW)
SONIC_BULLSEYE_DBG_DOCKERS += $(DOCKER_SFLOW_DBG)
SONIC_BOOKWORM_DOCKERS += $(DOCKER_SFLOW)
SONIC_BOOKWORM_DBG_DOCKERS += $(DOCKER_SFLOW_DBG)
2 changes: 1 addition & 1 deletion rules/sflow.mk
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ $(HSFLOWD)_SRC_PATH = $(SRC_PATH)/sflow/hsflowd

SONIC_MAKE_DEBS += $(HSFLOWD)

HSFLOWD_DBG = hsflowd-dbg_$(HSFLOWD_VERSION)-$(HSFLOWD_SUBVERSION)_$(CONFIGURED_ARCH).deb
HSFLOWD_DBG = hsflowd-dbgsym_$(HSFLOWD_VERSION)-$(HSFLOWD_SUBVERSION)_$(CONFIGURED_ARCH).deb
$(HSFLOWD_DBG)_DEPENDS += $(HSFLOWD)
$(HSFLOWD_DBG)_RDEPENDS += $(HSFLOWD)
$(eval $(call add_derived_package,$(HSFLOWD),$(HSFLOWD_DBG)))
Expand Down
6 changes: 3 additions & 3 deletions src/sflow/hsflowd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
sed -i -e s/_VERSION_/$(HSFLOWD_VERSION)-$(HSFLOWD_SUBVERSION)/g debian/changelog

ifeq ($(CROSS_BUILD_ENVIRON), y)
dpkg-buildpackage -rfakeroot -b -us -uc -a$(CONFIGURED_ARCH) -Pcross,nocheck -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $(SONIC_DPKG_ADMINDIR) --buildinfo-option=-u. --changes-option=-u.
dpkg-buildpackage -rfakeroot -b -us -uc -a$(CONFIGURED_ARCH) -Pcross,nocheck -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $(SONIC_DPKG_ADMINDIR)
else
dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $(SONIC_DPKG_ADMINDIR) --buildinfo-option=-u. --changes-option=-u.
dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $(SONIC_DPKG_ADMINDIR)
endif
popd

mv $(DERIVED_TARGET) $* $(DEST)/
popd

$(addprefix $(DEST)/, $(DERIVED_TARGET)): $(DEST)/% : $(DEST)/$(MAIN_TARGET)
59 changes: 6 additions & 53 deletions src/sflow/hsflowd/patch/0002-host_sflow_debian.patch
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ diff -ruN a/DEBIAN_build/compat b/DEBIAN_build/compat
--- a/DEBIAN_build/compat 1969-12-31 19:00:00.000000000 -0500
+++ b/DEBIAN_build/compat 2019-08-16 23:28:58.020938096 -0400
@@ -0,0 +1 @@
+9
+13
diff -ruN a/DEBIAN_build/control b/DEBIAN_build/control
--- a/DEBIAN_build/control 2019-08-16 05:11:33.974949327 -0400
+++ b/DEBIAN_build/control 2019-08-19 21:28:07.155722725 -0400
@@ -1,9 +1,22 @@
@@ -1,9 +1,15 @@
-Package: _PACKAGE_
-Version: _VERSION_
-Section: admin
Expand All @@ -37,17 +37,10 @@ diff -ruN a/DEBIAN_build/control b/DEBIAN_build/control
-Maintainer: Neil McKee [[email protected]]
Description: sFlow(R) monitoring agent
Homepage: sflow.net
+
+Package: hsflowd-dbg
+Architecture: any
+Section: debug
+Priority: extra
+Depends: hsflowd
+Description: debugging symbols for hsflowd
diff -ruN a/DEBIAN_build/rules b/DEBIAN_build/rules
--- a/DEBIAN_build/rules 1969-12-31 19:00:00.000000000 -0500
+++ b/DEBIAN_build/rules 2019-08-19 22:20:42.998569601 -0400
@@ -0,0 +1,31 @@
@@ -0,0 +1,18 @@
+#!/usr/bin/make -f
+
+# See debhelper(7) (uncomment to enable)
Expand All @@ -59,50 +52,10 @@ diff -ruN a/DEBIAN_build/rules b/DEBIAN_build/rules
+include /usr/share/dpkg/default.mk
+
+%:
+ dh $@
+
+binary:
+ dh_gencontrol
+ dh_strip -phsflowd --dbg-package=hsflowd-dbg
+ dpkg-deb --build debian/hsflowd-dbg hsflowd-dbg_$(HSFLOWD_VERSION)-$(HSFLOWD_SUBVERSION)_$(CONFIGURED_ARCH).deb
+ dpkg-deb --build debian/hsflowd hsflowd_$(HSFLOWD_VERSION)-$(HSFLOWD_SUBVERSION)_$(CONFIGURED_ARCH).deb
+ dh $@ --no-parallel
+
+override_dh_auto_build:
+ make sonic-deb FEATURES="SONIC" CC=$(CC) CXX=$(CXX) LD=$(CC)
+
+override_dh_auto_configure:
+ dh_auto_build -- hsflowd MYARCH=$(shell uname -m | sed 's/x86_64/amd64/') FEATURES="SONIC"
+
+override_dh_auto_install:
+
+override_dh_auto_test:
+
+override_dh_auto_clean:
+
+override_dh_clean:
diff -ruN a/Makefile b/Makefile
--- a/Makefile 2019-08-16 21:34:25.167679297 -0400
+++ b/Makefile 2019-08-19 22:20:23.758479002 -0400
@@ -146,6 +146,23 @@
cd ..; \
dpkg-deb --build debian hsflowd_$${MYVER}-$${MYREL}_$$MYARCH.deb

+sonic-deb: $(PROG)
+ MYARCH=`uname -m|sed 's/x86_64/amd64/'`; \
+ MYVER=`./getVersion`; \
+ MYREL=`./getRelease`; \
+ PLATFORM=`uname`; \
+ mkdir -p debian/usr/sbin; \
+ mkdir -p debian/etc/init.d; \
+ mkdir -p debian/etc/hsflowd/modules; \
+ mkdir -p debian/lib/systemd/system; \
+ mkdir -p debian/etc/dbus-1/system.d; \
+ cd src/$$PLATFORM; $(MAKE) VERSION=$$MYVER RELEASE=$$MYREL INSTROOT="../../debian/hsflowd" install; cd ../..; \
+ pwd; \
+ cd debian/hsflowd; \
+ find . -type d | xargs chmod 755; \
+ md5sum `find usr etc -type f` > md5sums; \
+ cd ../..;
+
xenserver: xenrpm
cd xenserver-ddk; $(MAKE) clean; $(MAKE)

+ dh_auto_install -- INSTROOT="$(PWD)/debian/hsflowd/" FEATURES="SONIC"

0 comments on commit f2f9a76

Please sign in to comment.