Add libbpf-tools subpackage

Adding libbpf-tools subpackage. It was discussed and agreed
to package libbpf-tools under 'libbpf-tool' name and add 'bpf-'
prefix to binaries, please check in here:
  https://github.com/iovisor/bcc/pull/3263

At the moment the package has following binaries:

  $ rpm -ql libbpf-tools
  /usr/sbin/bpf-biolatency
  /usr/sbin/bpf-biopattern
  /usr/sbin/bpf-biosnoop
  /usr/sbin/bpf-biostacks
  /usr/sbin/bpf-bitesize
  /usr/sbin/bpf-cachestat
  /usr/sbin/bpf-cpudist
  /usr/sbin/bpf-cpufreq
  /usr/sbin/bpf-drsnoop
  /usr/sbin/bpf-execsnoop
  /usr/sbin/bpf-filelife
  /usr/sbin/bpf-funclatency
  /usr/sbin/bpf-hardirqs
  /usr/sbin/bpf-llcstat
  /usr/sbin/bpf-numamove
  /usr/sbin/bpf-opensnoop
  /usr/sbin/bpf-readahead
  /usr/sbin/bpf-runqlat
  /usr/sbin/bpf-runqlen
  /usr/sbin/bpf-runqslower
  /usr/sbin/bpf-softirqs
  /usr/sbin/bpf-syscount
  /usr/sbin/bpf-tcpconnect
  /usr/sbin/bpf-tcpconnlat
  /usr/sbin/bpf-vfsstat
  /usr/sbin/bpf-xfsslower
  ...

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
This commit is contained in:
Jiri Olsa 2021-03-22 00:03:22 +01:00
parent d551d2b517
commit 77fb46b8dd

View File

@ -10,6 +10,12 @@
%endif %endif
%endif %endif
%ifarch x86_64 ppc64 ppc64le aarch64
%bcond_without libbpf_tools
%else
%bcond_with libbpf_tools
%endif
%bcond_with llvm_static %bcond_with llvm_static
%if %{without llvm_static} %if %{without llvm_static}
@ -28,7 +34,7 @@
Name: bcc Name: bcc
Version: 0.19.0 Version: 0.19.0
Release: 1%{?dist} Release: 2%{?dist}
Summary: BPF Compiler Collection (BCC) Summary: BPF Compiler Collection (BCC)
License: ASL 2.0 License: ASL 2.0
URL: https://github.com/iovisor/bcc URL: https://github.com/iovisor/bcc
@ -120,6 +126,15 @@ Requires: kernel-devel
%description tools %description tools
Command line tools for BPF Compiler Collection (BCC) Command line tools for BPF Compiler Collection (BCC)
%if %{with libbpf_tools}
%package -n libbpf-tools
Summary: Command line libbpf tools for BPF Compiler Collection (BCC)
BuildRequires: libbpf-devel >= 0.0.5-3, libbpf-static >= 0.0.5-3
BuildRequires: bpftool
%description -n libbpf-tools
Command line libbpf tools for BPF Compiler Collection (BCC)
%endif
%prep %prep
%autosetup -p1 -n %{name} %autosetup -p1 -n %{name}
@ -133,6 +148,18 @@ Command line tools for BPF Compiler Collection (BCC)
%{?with_llvm_shared:-DENABLE_LLVM_SHARED=1} %{?with_llvm_shared:-DENABLE_LLVM_SHARED=1}
%cmake_build %cmake_build
# It was discussed and agreed to package libbpf-tools with
# 'bpf-' prefix (https://github.com/iovisor/bcc/pull/3263)
# Installing libbpf-tools binaries in temp directory and
# renaming them in there and the install code will just
# take them.
%if %{with libbpf_tools}
pushd libbpf-tools;
make BPFTOOL=bpftool
make DESTDIR=./tmp-install prefix= install
(cd tmp-install/bin; for file in *; do mv $file bpf-$file; done;)
popd
%endif
%install %install
%cmake_install %cmake_install
@ -162,6 +189,11 @@ rm -rf %{buildroot}%{_datadir}/%{name}/tools/old/
# the machine (e.g, IP address) # the machine (e.g, IP address)
#%check #%check
%if %{with libbpf_tools}
mkdir -p %{buildroot}/%{_sbindir}
install libbpf-tools/tmp-install/bin/* %{buildroot}/%{_sbindir}
%endif
%ldconfig_scriptlets %ldconfig_scriptlets
%files %files
@ -196,8 +228,15 @@ rm -rf %{buildroot}%{_datadir}/%{name}/tools/old/
%{_bindir}/bcc-lua %{_bindir}/bcc-lua
%endif %endif
%if %{with libbpf_tools}
%files -n libbpf-tools
%{_sbindir}/bpf-*
%endif
%changelog %changelog
* Wed Mar 29 2021 Jiri Olsa <jolsa@redhat.com> - 0.19.0-2
- add libbpf-tools package
* Mon Mar 29 2021 Jiri Olsa <jolsa@redhat.com> - 0.19.0-1 * Mon Mar 29 2021 Jiri Olsa <jolsa@redhat.com> - 0.19.0-1
- Rebase to latest upstream - Rebase to latest upstream