From 8a4969a45eb2d51b01a25c1d5060b4bf237d2fe9 Mon Sep 17 00:00:00 2001 From: Junhong Mao Date: Wed, 16 Oct 2024 12:32:49 -0400 Subject: [PATCH] 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 | 13 +++++++++++ src/rdb-cli/Makefile | 14 ++++++++++++ 7 files changed, 39 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..1bbb95d99405 --- /dev/null +++ b/rules/rdb-cli.mk @@ -0,0 +1,13 @@ +# 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)/