From 81e7942f52b0481eecfe1650575b35a2b4d0b0fc Mon Sep 17 00:00:00 2001 From: Myron Sosyak Date: Wed, 1 Sep 2021 06:10:14 -0700 Subject: [PATCH] Add thrift 0.13.0 (#8307) #### Why I did it To bump thrift version to 0.13.0, to fix some dependencies issues. #### How I did it As there are dependencies between thrift and saithrinft server (https://github.com/opencomputeproject/SAI/tree/bf3630316cbef484e1015478b5746067bac4e2b8/test/saithrift) which is used by syncd-rpc to update thrift version, I also need to make changes in saithrinft server, and then SAI ref point should be updated in sairedis, and then sairedis ref point should be updated too. It is too many change, so I decided to add thrift 0.13.0 as separeate target to be able to work and test father changes in saithrinft and one when appropriate changes will be merged to SAI and ref points will be updated I will squash this and the old thrift target. I was not able to build thrift deb pkg by original rules, so I copied `debian `folder from the old version and tune it for newer one. #### How to verify it ``` make init make configure PLATFORM=vs make target/debs/buster/libthrift_0.13.0_amd64.deb ``` ``` --- rules/thrift_0_13_0.dep | 8 ++ rules/thrift_0_13_0.mk | 17 ++++ src/thrift_0_13_0/.gitignore | 1 + src/thrift_0_13_0/Makefile | 32 +++++++ .../patch/0001-Remove-unneeded-packages.patch | 85 +++++++++++++++++++ 5 files changed, 143 insertions(+) create mode 100644 rules/thrift_0_13_0.dep create mode 100644 rules/thrift_0_13_0.mk create mode 100644 src/thrift_0_13_0/.gitignore create mode 100644 src/thrift_0_13_0/Makefile create mode 100644 src/thrift_0_13_0/patch/0001-Remove-unneeded-packages.patch diff --git a/rules/thrift_0_13_0.dep b/rules/thrift_0_13_0.dep new file mode 100644 index 000000000000..52d8b6a525f9 --- /dev/null +++ b/rules/thrift_0_13_0.dep @@ -0,0 +1,8 @@ +SPATH := $($(LIBTHRIFT_0_13_0)_SRC_PATH) +DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/thrift_0_13_0.mk rules/thrift_0_13_0.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +DEP_FILES += $(shell git ls-files $(SPATH)) + +$(LIBTHRIFT_0_13_0)_CACHE_MODE := GIT_CONTENT_SHA +$(LIBTHRIFT_0_13_0)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(LIBTHRIFT_0_13_0)_DEP_FILES := $(DEP_FILES) diff --git a/rules/thrift_0_13_0.mk b/rules/thrift_0_13_0.mk new file mode 100644 index 000000000000..9da97849809f --- /dev/null +++ b/rules/thrift_0_13_0.mk @@ -0,0 +1,17 @@ +# thrift package + +THRIFT_VERSION_0_13_0 = 0.13.0 +THRIFT_VERSION_0_13_0_FULL = $(THRIFT_VERSION_0_13_0)-6 + +LIBTHRIFT_0_13_0 = libthrift-$(THRIFT_VERSION_0_13_0)_$(THRIFT_VERSION_0_13_0_FULL)_$(CONFIGURED_ARCH).deb +$(LIBTHRIFT_0_13_0)_SRC_PATH = $(SRC_PATH)/thrift_0_13_0 +SONIC_MAKE_DEBS += $(LIBTHRIFT_0_13_0) + +LIBTHRIFT_DEV_0_13_0 = libthrift-dev_$(THRIFT_VERSION_0_13_0_FULL)_$(CONFIGURED_ARCH).deb +$(eval $(call add_derived_package,$(LIBTHRIFT_0_13_0),$(LIBTHRIFT_DEV_0_13_0))) + +PYTHON3_THRIFT_0_13_0 = python3-thrift_$(THRIFT_VERSION_0_13_0_FULL)_$(CONFIGURED_ARCH).deb +$(eval $(call add_derived_package,$(LIBTHRIFT_0_13_0),$(PYTHON_THRIFT_0_13_0))) + +THRIFT_COMPILER_0_13_0 = thrift-compiler_$(THRIFT_VERSION_0_13_0_FULL)_$(CONFIGURED_ARCH).deb +$(eval $(call add_derived_package,$(LIBTHRIFT_0_13_0),$(THRIFT_COMPILER_0_13_0))) diff --git a/src/thrift_0_13_0/.gitignore b/src/thrift_0_13_0/.gitignore new file mode 100644 index 000000000000..dc29c1367931 --- /dev/null +++ b/src/thrift_0_13_0/.gitignore @@ -0,0 +1 @@ +thrift* \ No newline at end of file diff --git a/src/thrift_0_13_0/Makefile b/src/thrift_0_13_0/Makefile new file mode 100644 index 000000000000..55cb4d9212ef --- /dev/null +++ b/src/thrift_0_13_0/Makefile @@ -0,0 +1,32 @@ +SHELL = /bin/bash +.ONESHELL: +.SHELLFLAGS += -e -x + +THRIFT_VERSION = 0.13.0 +THRIFT_VERSION_FULL = $(THRIFT_VERSION)-6 + +MAIN_TARGET = libthrift-$(THRIFT_VERSION)_$(THRIFT_VERSION_FULL)_$(CONFIGURED_ARCH).deb +DERIVED_TARGETS = libthrift-dev_$(THRIFT_VERSION_FULL)_$(CONFIGURED_ARCH).deb \ + python3-thrift_$(THRIFT_VERSION_FULL)_$(CONFIGURED_ARCH).deb \ + thrift-compiler_$(THRIFT_VERSION_FULL)_$(CONFIGURED_ARCH).deb + +THRIFT_LINK_PRE = http://deb.debian.org/debian/pool/main/t/thrift/ + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + rm -rf thrift-$(THRIFT_VERSION) + + wget -O "thrift_$(THRIFT_VERSION_FULL).debian.tar.xz" "$(THRIFT_LINK_PRE)/thrift_$(THRIFT_VERSION_FULL).debian.tar.xz" + wget -O "thrift_$(THRIFT_VERSION).orig.tar.gz" "$(THRIFT_LINK_PRE)/thrift_$(THRIFT_VERSION).orig.tar.gz" + wget -O "thrift_$(THRIFT_VERSION_FULL).dsc" "$(THRIFT_LINK_PRE)/thrift_$(THRIFT_VERSION_FULL).dsc" + + dpkg-source -x thrift_$(THRIFT_VERSION_FULL).dsc + pushd thrift-$(THRIFT_VERSION) + + # Disable php perl and few other packages as they need additional packages to be installed + patch -p1 < ../patch/0001-Remove-unneeded-packages.patch + DEB_BUILD_OPTIONS=nocheck dpkg-buildpackage -d -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $(SONIC_DPKG_ADMINDIR) + popd + + mv $(DERIVED_TARGETS) $* $(DEST)/ + +$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET) diff --git a/src/thrift_0_13_0/patch/0001-Remove-unneeded-packages.patch b/src/thrift_0_13_0/patch/0001-Remove-unneeded-packages.patch new file mode 100644 index 000000000000..f1565408a722 --- /dev/null +++ b/src/thrift_0_13_0/patch/0001-Remove-unneeded-packages.patch @@ -0,0 +1,85 @@ +From 7a8d588fa0425550cfd42c3300c8c0a643137190 Mon Sep 17 00:00:00 2001 +From: Myron Sosyak +Date: Fri, 13 Aug 2021 11:26:13 +0000 +Subject: [PATCH] Remove-unneeded-packages + +--- + debian/control | 28 ---------------------------- + debian/rules | 7 +++---- + 2 files changed, 3 insertions(+), 32 deletions(-) + +diff --git a/debian/control b/debian/control +index 5126e47..3f3028c 100644 +--- a/debian/control ++++ b/debian/control +@@ -13,8 +13,6 @@ Build-Depends: debhelper-compat (= 11), dh-python, + python3-all-dev, + python3-six, + golang-go, golang-github-golang-mock-dev, +- pkg-php-tools (>= 1.14~), php-dev, phpunit, php-codesniffer, +- perl (>= 5.22), libbit-vector-perl, libclass-accessor-perl, + # openjdk-11-jdk, javahelper, maven-debian-helper (>= 1.5), ant (>= 1.7), ant-optional, + # libhttpclient-java, libslf4j-java, libservlet3.1-java (>= 8), + # nodejs, npm, +@@ -175,32 +173,6 @@ Description: Python library for Thrift (debug symbols) + # . + # This package contains Javadoc HTML documentation for libthrift-java . + # +-Package: php-thrift +-Architecture: any +-Section: php +-Depends: ${phpcomposer:Debian-require}, ${shlibs:Depends}, ${misc:Depends} +-Provides: ${php:Provides} +-Conflicts: php7.0-thrift, php7.2-thrift +-Replaces: php7.0-thrift, php7.2-thrift +-Description: PHP language support for Thrift +- Thrift is a software framework for the development of reliable and +- performant communication and data serialization. It combines a software +- stack with code generation to build services that operate seamlessly +- across a number of different development languages. +- . +- This package provides the PHP5 language support for Thrift. +- +-Package: libthrift-perl +-Section: perl +-Architecture: all +-Depends: ${perl:Depends}, ${misc:Depends} +-Description: Perl language support for Thrift +- Thrift is a software framework for the development of reliable and +- performant communication and data serialization. It combines a software +- stack with code generation to build services that operate seamlessly +- across a number of different development languages. +- . +- This package provides the Perl language support for Thrift. + + Package: golang-thrift-dev + Architecture: amd64 arm64 armel armhf i386 ppc64el +diff --git a/debian/rules b/debian/rules +index ba63e6f..8217796 100755 +--- a/debian/rules ++++ b/debian/rules +@@ -47,7 +47,6 @@ override_dh_auto_clean: + $(CURDIR)/lib/go/test/gopath/src/golang.org/x/net \ + $(CURDIR)/lib/go/test/gopath/src/github.com/golang/mock + [ ! -f Makefile ] || $(MAKE) clean +- cd $(CURDIR)/lib/php/src/ext/thrift_protocol/ && phpize --clean + find $(CURDIR) \( -name Makefile -o -name Makefile.in \) -exec rm {} \; + find $(CURDIR) -name .dirstamp -exec rm {} \; + $(RM) aclocal.m4 config.h config.log config.status configure \ +@@ -65,10 +64,10 @@ override_dh_auto_clean: + + override_dh_auto_configure: + dh_auto_configure -- \ +- --with-cpp --with-c_glib --with-php --with-php_extension \ +- --with-perl --without-python --with-py3 --without-java \ ++ --with-cpp --with-c_glib --without-php --without-php_extension \ ++ --without-perl --without-python --with-py3 --without-java \ + --without-nodejs --without-erlang --without-lua \ +- --with-go --with-ruby \ ++ --without-go --without-ruby \ + --with-qt4=no --with-qt5=yes \ + --without-rust \ + --disable-tutorial +-- +2.17.1 +