From f042307154e02cac6623268f3d19e098d95aadf3 Mon Sep 17 00:00:00 2001 From: jumao Date: Mon, 10 Jun 2024 22:02:34 -0400 Subject: [PATCH 1/3] To fix the issue: show_techsupport & saidump errors during testbed testing https://github.com/sonic-net/sonic-sairedis/issues/1387 --- dockers/docker-base-bullseye/Dockerfile.j2 | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) mode change 100644 => 100755 dockers/docker-base-bullseye/Dockerfile.j2 diff --git a/dockers/docker-base-bullseye/Dockerfile.j2 b/dockers/docker-base-bullseye/Dockerfile.j2 old mode 100644 new mode 100755 index b31e986e770d..14ee284da94f --- a/dockers/docker-base-bullseye/Dockerfile.j2 +++ b/dockers/docker-base-bullseye/Dockerfile.j2 @@ -83,17 +83,23 @@ RUN pip3 install supervisord-dependent-startup==1.4.0 RUN mkdir -p /var/log/supervisor /etc/supervisor/conf.d -# Install gcc, libc6-dev and python3-dev for compiling python-lzf -RUN apt-get -y install build-essential libc6-dev python3-dev +# Install gcc, libc6-dev and git for compiling librdb +RUN apt-get -y install build-essential libc6-dev git -# Install python-lzf -RUN pip3 install 'python-lzf==0.2.4' +# Obtain librdb source codes +RUN git -C /tmp/ clone https://github.com/redis/librdb.git -# Install rdbtools -RUN pip3 install 'rdbtools==0.1.15' +# Build librdb +RUN cd /tmp/librdb/;git submodule update --init --recursive;make -j4 -# Uninstall gcc, libc6-dev and python3-dev for compiling python-lzf -RUN apt-get -y purge build-essential libc6-dev python3-dev +# Install rdb-cli +RUN install -p -D -m 0775 /tmp/librdb/bin/rdb-cli /usr/bin/rdb-cli + +# Clear librdb source codes +RUN rm -rf /tmp/librdb + +# Uninstall gcc, libc6-dev and git for compiling librdb +RUN apt-get -y purge build-essential libc6-dev git # Uninstall unused dependencies RUN apt autoremove -y --purge From 6b5dbc5772825c34818c5b22bd4dbcc7a4109c14 Mon Sep 17 00:00:00 2001 From: Junhong Mao Date: Thu, 1 Aug 2024 20:13:52 -0400 Subject: [PATCH 2/3] According to the review comments, update the rdb-cli installation location --- dockers/docker-base-bookworm/Dockerfile.j2 | 12 ------------ dockers/docker-base-bullseye/Dockerfile.j2 | 18 ------------------ .../broadcom/docker-syncd-brcm/Dockerfile.j2 | 18 ++++++++++++++++++ 3 files changed, 18 insertions(+), 30 deletions(-) mode change 100644 => 100755 dockers/docker-base-bookworm/Dockerfile.j2 diff --git a/dockers/docker-base-bookworm/Dockerfile.j2 b/dockers/docker-base-bookworm/Dockerfile.j2 old mode 100644 new mode 100755 index 2a3388d770d5..14032ed308f3 --- a/dockers/docker-base-bookworm/Dockerfile.j2 +++ b/dockers/docker-base-bookworm/Dockerfile.j2 @@ -81,18 +81,6 @@ RUN pip3 install supervisord-dependent-startup==1.4.0 RUN mkdir -p /var/log/supervisor /etc/supervisor/conf.d -# Install gcc, libc6-dev and python3-dev for compiling python-lzf -RUN apt-get -y install build-essential libc6-dev python3-dev - -# Install python-lzf -RUN pip3 install 'python-lzf==0.2.4' - -# Install rdbtools -RUN pip3 install 'rdbtools==0.1.15' - -# Uninstall gcc, libc6-dev and python3-dev for compiling python-lzf -RUN apt-get -y purge build-essential libc6-dev python3-dev - # Uninstall unused dependencies RUN apt autoremove -y --purge diff --git a/dockers/docker-base-bullseye/Dockerfile.j2 b/dockers/docker-base-bullseye/Dockerfile.j2 index 14ee284da94f..0ec093c90164 100755 --- a/dockers/docker-base-bullseye/Dockerfile.j2 +++ b/dockers/docker-base-bullseye/Dockerfile.j2 @@ -83,24 +83,6 @@ RUN pip3 install supervisord-dependent-startup==1.4.0 RUN mkdir -p /var/log/supervisor /etc/supervisor/conf.d -# Install gcc, libc6-dev and git for compiling librdb -RUN apt-get -y install build-essential libc6-dev git - -# Obtain librdb source codes -RUN git -C /tmp/ clone https://github.com/redis/librdb.git - -# Build librdb -RUN cd /tmp/librdb/;git submodule update --init --recursive;make -j4 - -# Install rdb-cli -RUN install -p -D -m 0775 /tmp/librdb/bin/rdb-cli /usr/bin/rdb-cli - -# Clear librdb source codes -RUN rm -rf /tmp/librdb - -# Uninstall gcc, libc6-dev and git for compiling librdb -RUN apt-get -y purge build-essential libc6-dev git - # Uninstall unused dependencies RUN apt autoremove -y --purge diff --git a/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 b/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 index 4037ddc6af1a..5875969cb4f7 100755 --- a/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 +++ b/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 @@ -30,6 +30,24 @@ COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] COPY ["critical_processes", "/etc/supervisor/"] +# Install make and git for compiling librdb +RUN apt-get -y install build-essential git + +# Obtain librdb source codes +RUN git clone https://github.com/redis/librdb.git + +# Build librdb +RUN cd ./librdb/;git checkout b401df1e7025501c24f0c852aa32f6900fd888f7;git submodule update --init --recursive;make;cd .. + +# Install rdb-cli +RUN install -p -D -m 0775 ./librdb/bin/rdb-cli /usr/bin/rdb-cli + +# Clear librdb source codes +RUN rm -rf ./librdb + +# Uninstall make and git for compiling librdb +RUN apt-get -y purge build-essential git + ## Clean up RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs From 5dc10e6d24ed4e35dc6803eb165ab399d3c66f8b Mon Sep 17 00:00:00 2001 From: Junhong Mao Date: Wed, 16 Oct 2024 12:32:49 -0400 Subject: [PATCH 3/3] According to reivew comments, build librdb just like any other regular application. --- dockers/docker-base-bookworm/Dockerfile.j2 | 0 dockers/docker-base-bullseye/Dockerfile.j2 | 0 platform/broadcom/docker-syncd-brcm.mk | 2 +- .../broadcom/docker-syncd-brcm/Dockerfile.j2 | 22 ++----------------- rules/rdb-cli.dep | 9 ++++++++ rules/rdb-cli.mk | 14 ++++++++++++ src/rdb-cli/Makefile | 14 ++++++++++++ 7 files changed, 40 insertions(+), 21 deletions(-) mode change 100755 => 100644 dockers/docker-base-bookworm/Dockerfile.j2 mode change 100755 => 100644 dockers/docker-base-bullseye/Dockerfile.j2 create mode 100644 rules/rdb-cli.dep create mode 100644 rules/rdb-cli.mk create mode 100644 src/rdb-cli/Makefile diff --git a/dockers/docker-base-bookworm/Dockerfile.j2 b/dockers/docker-base-bookworm/Dockerfile.j2 old mode 100755 new mode 100644 diff --git a/dockers/docker-base-bullseye/Dockerfile.j2 b/dockers/docker-base-bullseye/Dockerfile.j2 old mode 100755 new mode 100644 diff --git a/platform/broadcom/docker-syncd-brcm.mk b/platform/broadcom/docker-syncd-brcm.mk index 315c27a416d8..691a7250b550 100644 --- a/platform/broadcom/docker-syncd-brcm.mk +++ b/platform/broadcom/docker-syncd-brcm.mk @@ -5,7 +5,7 @@ include $(PLATFORM_PATH)/../template/docker-syncd-bullseye.mk $(DOCKER_SYNCD_BASE)_DEPENDS += $(SYNCD) $(DOCKER_SYNCD_BASE)_DEPENDS += $(BRCM_XGS_SAI) -$(DOCKER_SYNCD_BASE)_FILES += $(DSSERVE) $(BCMCMD) +$(DOCKER_SYNCD_BASE)_FILES += $(DSSERVE) $(BCMCMD) $(RDB-CLI) $(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(SYNCD_DBG) \ $(LIBSWSSCOMMON_DBG) \ diff --git a/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 b/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 index 5875969cb4f7..f930cc40e075 100755 --- a/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 +++ b/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 @@ -23,31 +23,13 @@ RUN apt-get install -yf kmod ## BRCM uses ethtool to set host interface speed RUN apt-get install -y ethtool -COPY ["files/dsserve", "files/bcmcmd", "start.sh", "start_led.sh", "bcmsh", "/usr/bin/"] -RUN chmod +x /usr/bin/dsserve /usr/bin/bcmcmd +COPY ["files/dsserve", "files/bcmcmd", "start.sh", "start_led.sh", "bcmsh", "files/rdb-cli", "/usr/bin/"] +RUN chmod +x /usr/bin/dsserve /usr/bin/bcmcmd /usr/bin/rdb-cli COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] COPY ["critical_processes", "/etc/supervisor/"] -# Install make and git for compiling librdb -RUN apt-get -y install build-essential git - -# Obtain librdb source codes -RUN git clone https://github.com/redis/librdb.git - -# Build librdb -RUN cd ./librdb/;git checkout b401df1e7025501c24f0c852aa32f6900fd888f7;git submodule update --init --recursive;make;cd .. - -# Install rdb-cli -RUN install -p -D -m 0775 ./librdb/bin/rdb-cli /usr/bin/rdb-cli - -# Clear librdb source codes -RUN rm -rf ./librdb - -# Uninstall make and git for compiling librdb -RUN apt-get -y purge build-essential git - ## Clean up RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs diff --git a/rules/rdb-cli.dep b/rules/rdb-cli.dep new file mode 100644 index 000000000000..4b24cf258ac9 --- /dev/null +++ b/rules/rdb-cli.dep @@ -0,0 +1,9 @@ + +SPATH := $($(RDB-CLI)_SRC_PATH) +DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/rdb-cli.mk rules/rdb-cli.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +DEP_FILES += $(shell git ls-files $(SPATH)) + +$(RDB-CLI)_CACHE_MODE := GIT_CONTENT_SHA +$(RDB-CLI)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(RDB-CLI)_DEP_FILES := $(DEP_FILES) diff --git a/rules/rdb-cli.mk b/rules/rdb-cli.mk new file mode 100644 index 000000000000..fe9dc4e732e1 --- /dev/null +++ b/rules/rdb-cli.mk @@ -0,0 +1,14 @@ +# librdb package +# + + +RDB_CLI_VERSION_FULL = 0.1 + +export RDB_CLI_VERSION_FULL + +RDB-CLI = rdb-cli + +export RDB-CLI + +$(RDB-CLI)_SRC_PATH = $(SRC_PATH)/rdb-cli +SONIC_MAKE_FILES += rdb-cli diff --git a/src/rdb-cli/Makefile b/src/rdb-cli/Makefile new file mode 100644 index 000000000000..b9aedad6f657 --- /dev/null +++ b/src/rdb-cli/Makefile @@ -0,0 +1,14 @@ +.ONESHELL: +SHELL = /bin/bash +.SHELLFLAGS += -e + +MAIN_TARGET = rdb-cli + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + rm -rf ./librdb + git clone https://github.com/redis/librdb.git + pushd ./librdb/ + git checkout 2fdfc0c2bc914d643fe3f86e6715aeb843d8966e + git submodule update --init --recursive + make -j$(SONIC_CONFIG_MAKE_JOBS) + mv bin/rdb-cli $(DEST)/