From ee81cdbe654cff859c61729cfa2ecc84883e1ad7 Mon Sep 17 00:00:00 2001 From: xiaochuannan Date: Thu, 7 Nov 2024 14:12:40 +0800 Subject: [PATCH] fix build error when custom vendor (cherry picked from commit 332b7997da777fc71f37dc76a48d61c6fc1d35e5) --- 0004-add-custom-platform.patch | 38 ++++++++++++++++++++++++++++++++++ opengauss-server.spec | 14 ++++++++++++- 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 0004-add-custom-platform.patch diff --git a/0004-add-custom-platform.patch b/0004-add-custom-platform.patch new file mode 100644 index 0000000..fda6142 --- /dev/null +++ b/0004-add-custom-platform.patch @@ -0,0 +1,38 @@ +diff -Naur a/openGauss-server-2.1.0/build/script/package_opengauss.sh b/openGauss-server-2.1.0/build/script/package_opengauss.sh +--- a/openGauss-server-2.1.0/build/script/package_opengauss.sh 2024-11-06 09:45:40.281917930 +0800 ++++ b/openGauss-server-2.1.0/build/script/package_opengauss.sh 2024-11-06 15:13:03.650408634 +0800 +@@ -66,6 +66,9 @@ + dist_version="KylinSec" + elif [ X"$kernel" = X"ubuntu" ]; then + dist_version="Ubuntu" ++# as the last judgement condition, the CUSTOM_VENDOR_PLACEHOLDER will be replace by vendor macro in spec file ++elif [ X"$kernel" = X"CUSTOM_VENDOR_PLACEHOLDER_LOWERCASE" ]; then ++ dist_version="CUSTOM_VENDOR_PLACEHOLDER" + else + echo "We only support openEuler(aarch64), EulerOS(aarch64), CentOS, Kylin(aarch64), KylinSec(aarch64) and Ubuntu(x86) platform." + echo "Kernel is $kernel" +@@ -124,7 +127,7 @@ + ##add platform architecture information + PLATFORM_ARCH=$(uname -p) + if [ "$PLATFORM_ARCH"X == "aarch64"X ] ; then +- if [ "$dist_version" != "openEuler" ] && [ "$dist_version" != "EulerOS" ] && [ "$dist_version" != "Kylin" ] && [ "$dist_version" != "KylinSec" ] ; then ++ if [ "$dist_version" != "openEuler" ] && [ "$dist_version" != "EulerOS" ] && [ "$dist_version" != "Kylin" ] && [ "$dist_version" != "KylinSec" ] && [ "$dist_version" != "CUSTOM_VENDOR_PLACEHOLDER" ]; then + echo "We only support NUMA on openEuler(aarch64), EulerOS(aarch64), Kylin(aarch64), KylinSec(aarch64) platform." + exit 1 + fi +diff -Naur a/openGauss-server-2.1.0/src/get_PlatForm_str.sh b/openGauss-server-2.1.0/src/get_PlatForm_str.sh +--- a/openGauss-server-2.1.0/src/get_PlatForm_str.sh 2024-11-06 09:45:40.281917930 +0800 ++++ b/openGauss-server-2.1.0/src/get_PlatForm_str.sh 2024-11-06 14:40:31.071558697 +0800 +@@ -163,6 +163,12 @@ + # other platform + # + ################################################################################## ++# as the last judgement condition, the CUSTOM_VENDOR_PLACEHOLDER will be replace by vendor macro in spec file ++if [ -z "$plat_form_str" ] && [ "$kernel"x = "CUSTOM_VENDOR_PLACEHOLDER_LOWERCASE"x ] ++then ++ plat_form_str=CUSTOM_VENDOR_PLACEHOLDER_"$cpu_bit" ++fi ++ + if [ -z "$plat_form_str" ] + then + echo "Failed" diff --git a/opengauss-server.spec b/opengauss-server.spec index 9ceced9..4facec2 100644 --- a/opengauss-server.spec +++ b/opengauss-server.spec @@ -9,10 +9,11 @@ %define port 7654 %define datapath /var/lib/opengauss %define apppath %{_prefix}/local/opengauss +%define vendor_lowercase %{?_vendor:%(echo %{_vendor} | tr '[:upper:]' '[:lower:]')}%{!?_vendor:openeuler} Name: opengauss Version: 2.1.0 -Release: 10 +Release: 11 Summary: openGauss is an open source relational database management system License: MulanPSL-2.0 and MIT and BSD and zlib and TCL and Apache-2.0 and BSL-1.0 URL: https://gitee.com/opengauss/openGauss-server @@ -33,6 +34,7 @@ Patch22: 0003-zlib.patch Patch23: makefile-miniunz.patch Patch40: 0001-orc.patch Patch41: 0002-add-kylinsec-platform.patch +Patch42: 0004-add-custom-platform.patch Patch3000: 3000-add-sw_64-support.patch BuildRequires: cmake gcc gcc-c++ openssl-devel python @@ -91,6 +93,13 @@ pushd %{orc_name}-%{orc_version} popd %patch41 -p1 +# custom vendor +%if "%{_vendor}" != "openEuler" + sed -i 's/CUSTOM_VENDOR_PLACEHOLDER_LOWERCASE/%{vendor_lowercase}/g' %{PATCH42} + sed -i 's/CUSTOM_VENDOR_PLACEHOLDER/%{_vendor}/g' %{PATCH42} +%endif +%patch42 -p1 + %ifarch sw_64 %patch3000 -p1 %endif @@ -320,6 +329,9 @@ fi %changelog +* Thu Nov 7 2024 xiaochn - 2.1.0-11 +- fix build error when custom vendor + * Thu May 23 2024 panchenbo - 2.1.0-10 - add BuildRequires:lsb -- Gitee