!1 gala-gopher-1.0.0: Package init

From: @Vchanger 
Reviewed-by: @dowzyx 
Signed-off-by: @dowzyx
This commit is contained in:
openeuler-ci-bot 2022-11-14 08:55:11 +00:00 committed by Gitee
commit a30811aa1f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 203 additions and 0 deletions

BIN
gala-gopher-1.0.0.tar.gz Normal file

Binary file not shown.

73
gala-gopher.spec Normal file
View File

@ -0,0 +1,73 @@
%define debug_package %{nil}
Summary: Intelligent ops toolkit for openEuler
Name: gala-gopher
Version: 1.0.0
Release: 1
License: Mulan PSL v2
URL: https://gitee.com/openeuler/gala-gopher
Source: %{name}-%{version}.tar.gz
BuildRoot: %{_builddir}/%{name}-%{version}
BuildRequires: cmake gcc-c++ yum elfutils-devel
BuildRequires: clang >= 10.0.1 llvm
BuildRequires: libconfig-devel librdkafka-devel libmicrohttpd-devel
BuildRequires: uthash-devel libbpf libbpf-devel log4cplus-devel
Requires: bash glibc elfutils zlib elfutils-devel bpftool
Requires: dmidecode python3-psycopg2 python3-yaml erlang-eflame
%ifarch x86_64
patch1: modify-to-adapt-to-oe2203-LTS-SP1-x86.patch
%endif
%ifarch aarch64
patch1: modify-to-adapt-to-oe2203-LTS-SP1-arm.patch
%endif
%description
gala-gopher is a low-overhead eBPF-based probes framework
%prep
%setup -q
%patch1 -p1
%build
pushd build
sh build.sh --release
popd
%install
install -d %{buildroot}/opt/gala-gopher
install -d %{buildroot}%{_bindir}
mkdir -p %{buildroot}/usr/lib/systemd/system
install -m 0600 service/gala-gopher.service %{buildroot}/usr/lib/systemd/system/gala-gopher.service
pushd build
sh install.sh %{buildroot}%{_bindir} %{buildroot}/opt/gala-gopher
popd
%post
%systemd_post gala-gopher.service
%preun
%systemd_preun gala-gopher.service
%postun
%systemd_postun_with_restart gala-gopher.service
%files
%defattr(-,root,root)
%dir /opt/gala-gopher
%dir /opt/gala-gopher/extend_probes
%dir /opt/gala-gopher/meta
%dir /opt/gala-gopher/lib
%{_bindir}/*
%config(noreplace) /opt/gala-gopher/*.conf
/opt/gala-gopher/extend_probes/*
%exclude /opt/gala-gopher/extend_probes/*.pyc
%exclude /opt/gala-gopher/extend_probes/*.pyo
/opt/gala-gopher/meta/*
/opt/gala-gopher/lib/*
/usr/lib/systemd/system/gala-gopher.service
%changelog
* Mon Nov 14 2022 Zhen Chen <chenzhen126@huawei.com> - 1.0.0-1
- Package init

View File

@ -0,0 +1,65 @@
From 82974fc559451d52897053314ffa66e2c9ed7cd6 Mon Sep 17 00:00:00 2001
From: zhaoyuxing <zhaoyuxing2@huawei.com>
Date: Wed, 10 Aug 2022 17:12:16 +0800
Subject: [PATCH] modify vmlinux.h and version infos of oe-22.03 LTS SP1 arm
---
src/probes/extends/ebpf.probe/build.sh | 20 +++----------------
src/probes/extends/ebpf.probe/src/mk/var.mk | 10 ++++------
2 files changed, 7 insertions(+), 23 deletions(-)
diff --git a/src/probes/extends/ebpf.probe/build.sh b/src/probes/extends/ebpf.probe/build.sh
index ab4aa3e..6a33a1b 100755
--- a/src/probes/extends/ebpf.probe/build.sh
+++ b/src/probes/extends/ebpf.probe/build.sh
@@ -82,23 +82,9 @@ function compile_probe()
MATCH_VMLINUX=linux_${LINUX_VER}.h
cd ${VMLINUX_DIR}
- if [ -f ${MATCH_VMLINUX} ];then
- rm -f vmlinux.h
- ln -s ${MATCH_VMLINUX} vmlinux.h
- echo "debug: match vmlinux :" ${MATCH_VMLINUX}
- elif [ -f "vmlinux.h" ];then
- echo "debug: vmlinux.h is already here, continue compile."
- else
- echo "======================================ERROR==============================================="
- echo "there no match vmlinux :" ${MATCH_VMLINUX}
- echo "please create vmlinux.h manually."
- echo "methods:"
- echo " 1. generate linux_xxx.h by compile the kernel, refer to gen_vmlinux_h.sh;"
- echo " 2. ln -s vmlinux.h linux_xxx.h, (there are some include files in directory src/include)"
- echo " if your kernel version is similar to the include files provided, you can use method 2"
- echo "=========================================================================================="
- exit
- fi
+ rm -rf vmlinux.h
+ ln -s linux_5.10.0-126.0.0.66.oe2203.aarch64.h vmlinux.h
+ echo "debug: openEuler 22.03 LTS SP1 vmlinux :" ${MATCH_VMLINUX}
cd ${SRC_DIR}
echo "=======Begin to compile ebpf-based probes======:" ${EBPF_PROBES}
diff --git a/src/probes/extends/ebpf.probe/src/mk/var.mk b/src/probes/extends/ebpf.probe/src/mk/var.mk
index 1a1e8db..d61b124 100644
--- a/src/probes/extends/ebpf.probe/src/mk/var.mk
+++ b/src/probes/extends/ebpf.probe/src/mk/var.mk
@@ -23,12 +23,10 @@ else ifeq ($(ARCH), aarch64)
ARCH = arm64
endif
-KER_VER = $(shell uname -r | awk -F'-' '{print $$1}')
-KER_VER_MAJOR = $(shell echo $(KER_VER) | awk -F'.' '{print $$1}')
-KER_VER_MINOR = $(shell echo $(KER_VER) | awk -F'.' '{print $$2}')
-KER_VER_PATCH = $(shell echo $(KER_VER) | awk -F'.' '{print $$3}')
-RELEASE_INFOS = $(shell uname -r | awk -F'-' '{print $$2}')
-KER_RELEASE = $(shell echo $(RELEASE_INFOS) | awk -F'.' '{print $$1}')
+KER_VER_MAJOR = 5
+KER_VER_MINOR = 10
+KER_VER_PATCH = 0
+KER_RELEASE = 126
LINK_TARGET ?= -lpthread -lbpf -lelf -llog4cplus -lz -lconfig
EXTRA_CFLAGS ?= -g -O2 -Wall -fPIC
--
2.36.1

View File

@ -0,0 +1,65 @@
From 82974fc559451d52897053314ffa66e2c9ed7cd6 Mon Sep 17 00:00:00 2001
From: zhaoyuxing <zhaoyuxing2@huawei.com>
Date: Wed, 10 Aug 2022 17:12:16 +0800
Subject: [PATCH] modify vmlinux.h and version infos of oe-22.03 LTS SP1 x86
---
src/probes/extends/ebpf.probe/build.sh | 20 +++----------------
src/probes/extends/ebpf.probe/src/mk/var.mk | 10 ++++------
2 files changed, 7 insertions(+), 23 deletions(-)
diff --git a/src/probes/extends/ebpf.probe/build.sh b/src/probes/extends/ebpf.probe/build.sh
index ab4aa3e..6a33a1b 100755
--- a/src/probes/extends/ebpf.probe/build.sh
+++ b/src/probes/extends/ebpf.probe/build.sh
@@ -82,23 +82,9 @@ function compile_probe()
MATCH_VMLINUX=linux_${LINUX_VER}.h
cd ${VMLINUX_DIR}
- if [ -f ${MATCH_VMLINUX} ];then
- rm -f vmlinux.h
- ln -s ${MATCH_VMLINUX} vmlinux.h
- echo "debug: match vmlinux :" ${MATCH_VMLINUX}
- elif [ -f "vmlinux.h" ];then
- echo "debug: vmlinux.h is already here, continue compile."
- else
- echo "======================================ERROR==============================================="
- echo "there no match vmlinux :" ${MATCH_VMLINUX}
- echo "please create vmlinux.h manually."
- echo "methods:"
- echo " 1. generate linux_xxx.h by compile the kernel, refer to gen_vmlinux_h.sh;"
- echo " 2. ln -s vmlinux.h linux_xxx.h, (there are some include files in directory src/include)"
- echo " if your kernel version is similar to the include files provided, you can use method 2"
- echo "=========================================================================================="
- exit
- fi
+ rm -rf vmlinux.h
+ ln -s linux_5.10.0-126.0.0.66.oe2203.x86_64.h vmlinux.h
+ echo "debug: openEuler 22.03 LTS SP1 match vmlinux :" ${MATCH_VMLINUX}
cd ${SRC_DIR}
echo "=======Begin to compile ebpf-based probes======:" ${EBPF_PROBES}
diff --git a/src/probes/extends/ebpf.probe/src/mk/var.mk b/src/probes/extends/ebpf.probe/src/mk/var.mk
index 1a1e8db..d61b124 100644
--- a/src/probes/extends/ebpf.probe/src/mk/var.mk
+++ b/src/probes/extends/ebpf.probe/src/mk/var.mk
@@ -23,12 +23,10 @@ else ifeq ($(ARCH), aarch64)
ARCH = arm64
endif
-KER_VER = $(shell uname -r | awk -F'-' '{print $$1}')
-KER_VER_MAJOR = $(shell echo $(KER_VER) | awk -F'.' '{print $$1}')
-KER_VER_MINOR = $(shell echo $(KER_VER) | awk -F'.' '{print $$2}')
-KER_VER_PATCH = $(shell echo $(KER_VER) | awk -F'.' '{print $$3}')
-RELEASE_INFOS = $(shell uname -r | awk -F'-' '{print $$2}')
-KER_RELEASE = $(shell echo $(RELEASE_INFOS) | awk -F'.' '{print $$1}')
+KER_VER_MAJOR = 5
+KER_VER_MINOR = 10
+KER_VER_PATCH = 0
+KER_RELEASE = 126
LINK_TARGET ?= -lpthread -lbpf -lelf -llog4cplus -lz -lconfig
EXTRA_CFLAGS ?= -g -O2 -Wall -fPIC
--
2.36.1