From a7b8f8914e5c03c1461b37e8afcc3fed52a7fedb Mon Sep 17 00:00:00 2001 From: Pavel Shirshov Date: Tue, 24 Nov 2020 00:45:34 +0000 Subject: [PATCH] Patch libyang1.0.184 so version and let frr 7.5 use the patched version --- rules/docker-fpm-frr.mk | 4 ++-- rules/libyang1.dep | 6 +++--- rules/libyang1.mk | 18 +++++++++++++---- src/libyang1/Makefile | 45 +++++++++++++++++++++++------------------ 4 files changed, 44 insertions(+), 29 deletions(-) diff --git a/rules/docker-fpm-frr.mk b/rules/docker-fpm-frr.mk index 833d510245..e6473ef5ee 100644 --- a/rules/docker-fpm-frr.mk +++ b/rules/docker-fpm-frr.mk @@ -7,10 +7,10 @@ DOCKER_FPM_FRR_DBG = $(DOCKER_FPM_FRR_STEM)-$(DBG_IMAGE_MARK).gz $(DOCKER_FPM_FRR)_PATH = $(DOCKERS_PATH)/$(DOCKER_FPM_FRR_STEM) $(DOCKER_FPM_FRR)_PYTHON_WHEELS += $(SONIC_BGPCFGD) -$(DOCKER_FPM_FRR)_DEPENDS += $(FRR) $(FRR_SNMP) $(SWSS) $(LIBYANG) +$(DOCKER_FPM_FRR)_DEPENDS += $(FRR) $(FRR_SNMP) $(SWSS) $(LIBYANG1) $(DOCKER_FPM_FRR)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_DEPENDS) $(DOCKER_FPM_FRR)_DBG_DEPENDS += $(SWSS_DBG) $(LIBSWSSCOMMON_DBG) \ - $(FRR_DBG) $(FRR_SNMP_DBG) $(LIBYANG_DBG) + $(FRR_DBG) $(FRR_SNMP_DBG) $(LIBYANG1_DBG) $(DOCKER_FPM_FRR)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_PACKAGES) diff --git a/rules/libyang1.dep b/rules/libyang1.dep index c15eb12067..343b06cf96 100644 --- a/rules/libyang1.dep +++ b/rules/libyang1.dep @@ -4,7 +4,7 @@ DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/libyang1.mk rules/libyang1.dep DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) DEP_FILES += $(shell git ls-files $(SPATH)) -$(LIBYANG)_CACHE_MODE := GIT_CONTENT_SHA -$(LIBYANG)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) -$(LIBYANG)_DEP_FILES := $(DEP_FILES) +$(LIBYANG1)_CACHE_MODE := GIT_CONTENT_SHA +$(LIBYANG1)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(LIBYANG1)_DEP_FILES := $(DEP_FILES) diff --git a/rules/libyang1.mk b/rules/libyang1.mk index e7facba088..6d24e3fc5a 100644 --- a/rules/libyang1.mk +++ b/rules/libyang1.mk @@ -1,7 +1,7 @@ # libyang1 LIBYANG1_VERSION_BASE = 1.0 -LIBYANG1_VERSION = $(LIBYANG_VERSION_BASE).184 +LIBYANG1_VERSION = $(LIBYANG1_VERSION_BASE).184 LIBYANG1_SUBVERSION = 2 LIBYANG1_FULLVERSION = $(LIBYANG1_VERSION)-$(LIBYANG1_SUBVERSION) @@ -25,9 +25,19 @@ $(LIBYANG1_CPP)_DEPENDS += $(LIBYANG1) $(eval $(call add_derived_package,$(LIBYANG1),$(LIBYANG1_CPP))) LIBYANG1_CPP_DEV = libyang-cpp-dev_$(LIBYANG1_FULLVERSION)_$(CONFIGURED_ARCH).deb -$(eval $(call add_derived_package,$(LIBYANG1_CPP),$(LIBYANG1_CPP_DEV))) +$(eval $(call add_derived_package,$(LIBYANG1),$(LIBYANG1_CPP_DEV))) LIBYANG1_CPP_DBG = libyang-cpp1-dbgsym_$(LIBYANG1_FULLVERSION)_$(CONFIGURED_ARCH).deb -$(eval $(call add_derived_package,$(LIBYANG1_CPP),$(LIBYANG1_CPP_DBG))) +$(eval $(call add_derived_package,$(LIBYANG1),$(LIBYANG1_CPP_DBG))) -export LIBYANG1 LIBYANG1_DBG LIBYANG1_DEV LIBYANG1_CPP LIBYANG1_CPP_DEV LIBYANG1_CPP_DBG +YANG_TOOLS = yang-tools_$(LIBYANG1_FULLVERSION)_all.deb +$(YANG_TOOLS)_DEPENDS += $(LIBYANG1) +$(eval $(call add_derived_package,$(LIBYANG1),$(YANG_TOOLS))) + +LIBYANG1_TOOLS = libyang-tools_$(LIBYANG1_FULLVERSION)_$(CONFIGURED_ARCH).deb +$(eval $(call add_derived_package,$(LIBYANG1),$(LIBYANG1_TOOLS))) + +LIBYANG1_TOOLS_DBG = libyang-tools-dbgsym_$(LIBYANG1_FULLVERSION)_$(CONFIGURED_ARCH).deb +$(eval $(call add_derived_package,$(LIBYANG1),$(LIBYANG1_TOOLS_DBG))) + +export LIBYANG1 LIBYANG1_DBG LIBYANG1_DEV LIBYANG1_CPP LIBYANG1_CPP_DEV LIBYANG1_CPP_DBG YANG_TOOLS LIBYANG1_TOOLS LIBYANG1_TOOLS_DBG diff --git a/src/libyang1/Makefile b/src/libyang1/Makefile index 5ffb353af4..acdd686b79 100644 --- a/src/libyang1/Makefile +++ b/src/libyang1/Makefile @@ -2,31 +2,36 @@ SHELL = /bin/bash .SHELLFLAGS += -e -MAIN_TARGET = $(LIBYANG1) -DERIVED_TARGETS = $(LIBYANG1_DEV) $(LIBYANG1_DBG) $(LIBYANG1_CPP) $(LIBYANG1_CPP_DEV) $(LIBYANG1_CPP_DBG) +LIBYANG_URL = https://sonicstorage.blob.core.windows.net/debian/pool/main/liby/libyang +DSC_FILE = libyang_$(LIBYANG1_FULLVERSION).dsc +ORIG_FILE = libyang_$(LIBYANG1_VERSION).orig.tar.gz +DEBIAN_FILE = libyang_$(LIBYANG1_FULLVERSION).debian.tar.xz + +DSC_FILE_URL = $(LIBYANG_URL)/$(DSC_FILE) +ORIG_FILE_URL = $(LIBYANG_URL)/$(ORIG_FILE) +DEBIAN_FILE_URL = $(LIBYANG_URL)/$(DEBIAN_FILE) + +MAIN_TARGET = $(LIBYANG1) +DERIVED_TARGETS = $(LIBYANG1_DEV) $(LIBYANG1_DBG) $(LIBYANG1_CPP) $(LIBYANG1_CPP_DEV) $(LIBYANG1_CPP_DBG) $(YANG_TOOLS) $(LIBYANG1_TOOLS) $(LIBYANG1_TOOLS_DBG) $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Obtaining the libyang -# rm -fr ./libyang-$(LIBYANG1_VERSION) -# git clone https://github.com/CESNET/libyang.git libyang-$(LIBYANG1_VERSION) -# pushd libyang-$(LIBYANG1_VERSION) -# git checkout tags/v1.0.184 -b libyang -# git cherry-pick 1054200178d0277010e832f270841a586a62b31b -# git cherry-pick aab48f14db4d8d21b22c50bdc6b29d0198f21996 -# mkdir build -# pushd build -# cmake -DENABLE_STATIC=ON -DENABLE_LYD_PRIV=ON -DCMAKE_INSTALL_PREFIX:PATH=/usr -D CMAKE_BUILD_TYPE:String="Package" .. -# make build-deb - rm -fr ./libyang-1.0.184 - wget -NO libyang_1.0.184-2.dsc http://deb.debian.org/debian/pool/main/liby/libyang/libyang_1.0.184-2.dsc - wget -NO libyang_1.0.184.orig.tar.gz http://deb.debian.org/debian/pool/main/liby/libyang/libyang_1.0.184.orig.tar.gz - wget -NO libyang_1.0.184-2.debian.tar.xz http://deb.debian.org/debian/pool/main/liby/libyang/libyang_1.0.184-2.debian.tar.xz - dpkg-source -x libyang_1.0.184-2.dsc - pushd libyang-1.0.184 + rm -fr ./libyang-$(LIBYANG1_VERSION) + + # download debian libyang + wget -NO "$(DSC_FILE)" $(DSC_FILE_URL) + wget -NO "$(ORIG_FILE)" $(ORIG_FILE_URL) + wget -NO "$(DEBIAN_FILE)" $(DEBIAN_FILE_URL) + dpkg-source -x libyang_$(LIBYANG1_FULLVERSION).dsc + + pushd libyang-$(LIBYANG1_VERSION) + sed -i 's/set(LIBYANG_MAJOR_SOVERSION 1)/set(LIBYANG_MAJOR_SOVERSION 2)/' CMakeLists.txt + sed -i 's/libyang1/libyang2/' debian/libyang1.install dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) popd - mv $* $(DEST)/ - mv $(DERIVED_TARGETS) $(DEST)/ + + # Move the newly-built .deb packages to the destination directory + mv $* $(DERIVED_TARGETS) $(DEST)/ $(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET)