backport some bugfix patches from openeuler/gala-gopher

(cherry picked from commit 07eb050f23e9e0ca7178b97c2fda9aa94d3ea9a1)
This commit is contained in:
Vchanger 2022-11-30 14:38:48 +08:00 committed by openeuler-sync-bot
parent cbb3a4a41e
commit 71ad66d12f
3 changed files with 140 additions and 3 deletions

View File

@ -0,0 +1,106 @@
From 6ca0c40764df50e82676e719724518566fba7f1b Mon Sep 17 00:00:00 2001
From: Vchanger <vchanger123456@163.com>
Date: Sat, 19 Nov 2022 17:42:58 +0800
Subject: [PATCH] Only check the installation of dep when building ebpf.probes
---
src/probes/extends/ebpf.probe/build.sh | 50 ++++++++------------------
1 file changed, 15 insertions(+), 35 deletions(-)
diff --git a/src/probes/extends/ebpf.probe/build.sh b/src/probes/extends/ebpf.probe/build.sh
index ab4aa3e..05a1547 100755
--- a/src/probes/extends/ebpf.probe/build.sh
+++ b/src/probes/extends/ebpf.probe/build.sh
@@ -7,6 +7,7 @@ TOOLS_DIR=${PRJ_DIR}/tools
SRC_DIR=${PRJ_DIR}/src
VMLINUX_DIR=${SRC_DIR}/include
LINUX_VER=$(uname -r)
+DEP_LIST=(elfutils-devel libbpf libbpf-devel clang llvm)
function gen_vmlinux_header_file()
{
@@ -17,51 +18,29 @@ function gen_vmlinux_header_file()
./gen_vmlinux_h.sh
}
-function add_bpftool() {
+function add_bpftool()
+{
cd ${TOOLS_DIR}
if [ ! -f "bpftool" ];then
ln -s bpftool_${ARCH} bpftool
fi
}
-function prepare_dep()
+function check_dep()
{
- yum install -y elfutils-devel
- if [ $? -ne 0 ];then
- echo "Error: elfutils-devel install failed"
- return 1
- fi
+ for dep in "${DEP_LIST[@]}" ; do
+ rpm -q $dep --quiet
+ if [ $? -ne 0 ];then
+ echo "Error: $dep not installed"
+ exit 1
+ fi
+ done
- yum install -y clang
- if [ $? -ne 0 ];then
- echo "Error: clang install failed"
- return 1
- fi
V=`clang --version | grep version | awk -F ' ' '{print $3}' | awk -F . '{print $1}'`
if [ "$V" -lt 10 ];then
echo "Error: clange version need >= 10.x.x"
- return 1
+ exit 1
fi
-
- yum install -y llvm
- if [ $? -ne 0 ];then
- echo "Error: llvm install failed"
- return 1
- fi
-
- yum install -y libbpf
- if [ $? -ne 0 ]; then
- echo "Error: Failed to install libbpf."
- return 1
- fi
-
- yum install -y libbpf-devel
- if [ $? -ne 0 ]; then
- echo "Error: Failed to install libbpf-devel."
- return 1
- fi
-
- return 0
}
function compile_probe_prev()
@@ -123,7 +102,7 @@ fi
if [ "$1" == "--check" ];
then
- prepare_dep
+ check_dep
exit
fi
@@ -137,7 +116,8 @@ fi
if [ "$1" == "-b" -o "$1" == "--build" ];
then
- prepare_dep
+ check_dep
+
if [ "$2" == "-d" -o "$2" == "--debug" ];
then
compile_probe_prev
--
2.23.0

View File

@ -0,0 +1,25 @@
From 69d770bce51f93eff26577642580eeeedc976afd Mon Sep 17 00:00:00 2001
From: Vchanger <vchanger123456@163.com>
Date: Tue, 29 Nov 2022 20:53:18 +0800
Subject: [PATCH] fix java.probe build error caused by a typo in build.sh
---
src/probes/extends/java.probe/build.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletion(-)
diff --git a/src/probes/extends/java.probe/build.sh b/src/probes/extends/java.probe/build.sh
index d02c5cb..0ea7782 100755
--- a/src/probes/extends/java.probe/build.sh
+++ b/src/probes/extends/java.probe/build.sh
@@ -10,7 +10,7 @@ function find_jars()
then
# find jdk
clink_path=$(echo $(ls -lrt $javac_link) | awk -F " " '{print $NF}' )
- link_path=$(echo $(ls -lrt $link_path) | awk -F " " '{print $NF}' )
+ link_path=$(echo $(ls -lrt $clink_path) | awk -F " " '{print $NF}' )
jdk_path=$(dirname $(dirname $link_path))
dir=$jdk_path
else
--
2.23.0

View File

@ -4,13 +4,13 @@
Summary: Intelligent ops toolkit for openEuler
Name: gala-gopher
Version: 1.0.0
Release: 8
Release: 9
License: Mulan PSL v2
URL: https://gitee.com/openeuler/gala-gopher
Source: %{name}-%{version}.tar.gz
BuildRoot: %{_builddir}/%{name}-%{version}
BuildRequires: systemd cmake gcc-c++ yum elfutils-devel
BuildRequires: clang >= 10.0.1 llvm
BuildRequires: systemd cmake gcc-c++ elfutils-devel
BuildRequires: clang >= 10.0.1 llvm java-1.8.0-openjdk-devel
BuildRequires: libconfig-devel librdkafka-devel libmicrohttpd-devel
BuildRequires: uthash-devel libbpf libbpf-devel log4cplus-devel
Requires: bash glibc elfutils zlib elfutils-devel bpftool
@ -30,6 +30,8 @@ patch4: fix-bugs-for-ksliprobe-pgsliprobe-stackprobe.patch
patch5: move-docs-about-creating-and-running-in-docker.patch
patch6: fix-the-problem-that-the-gopher-in-docker-doesn-t-su.patch
patch7: add-documentation-related-to-docker-images.patch
patch8: fix-java.probe-build-error-caused-by-a-typo-in-build.patch
patch9: Only-check-the-installation-of-dep-when-building-ebp.patch
%description
gala-gopher is a low-overhead eBPF-based probes framework
@ -76,6 +78,10 @@ popd
/usr/lib/systemd/system/gala-gopher.service
%changelog
* Wed Nov 30 2022 Zhen Chen <chenzhen126@huawei.com> - 1.0.0-9
- fix java.probe build error caused by a typo in build.sh
Only check the installation of dep when building ebpf.probes
Remove unused BuildRequires and add java-1.8.0-openjdk-devel
* Mon Nov 28 2022 wo_cow <niuqianqian@huawei.com> - 1.0.0-8
- fix issues raised during 22.03 test