33c334
# luajit is not available RHEL 8
33c334
%bcond_with lua
33c334
61e0c9
%bcond_with llvm_static
61e0c9
61e0c9
%if %{without llvm_static}
61e0c9
%global with_llvm_shared 1
61e0c9
%endif
33c334
33c334
Name:           bcc
6fc629
Version:        0.25.0
20d482
Release:        2%{?dist}
33c334
Summary:        BPF Compiler Collection (BCC)
33c334
License:        ASL 2.0
33c334
URL:            https://github.com/iovisor/bcc
a142d7
Source0:        %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
0e54f6
Patch0:         %{name}-%{version}-Manpages-remove-unstable-statement.patch
20d482
Patch1:         %{name}-%{version}-RHEL-libbpf-version-fixes.patch
20d482
Patch2:         %{name}-%{version}-libbpf-Allow-kernel_struct_has_field-to-reach-field-.patch
6fc629
Patch3:         %{name}-%{version}-Fix-bpf_pseudo_fd-type-conversion-error.patch
6fc629
Patch4:         %{name}-%{version}-Fix-clang-15-int-to-pointer-conversion-errors.patch
6fc629
Patch5:         %{name}-%{version}-Revert-tools-tcpaccept-Fix-support-for-v5.6-kernels.patch
6fc629
Patch6:         %{name}-%{version}-Fix-get_kprobe_functions.patch
33c334
33c334
# Arches will be included as upstream support is added and dependencies are
33c334
# satisfied in the respective arches
33c334
ExcludeArch: i686
33c334
61e0c9
BuildRequires:  bison
61e0c9
BuildRequires:  cmake >= 2.8.7
61e0c9
BuildRequires:  flex
61e0c9
BuildRequires:  libxml2-devel
33c334
BuildRequires:  python3-devel
33c334
BuildRequires:  elfutils-libelf-devel
33c334
BuildRequires:  llvm-devel
33c334
BuildRequires:  clang-devel
33c334
%if %{with llvm_static}
33c334
BuildRequires:  llvm-static
33c334
%endif
61e0c9
BuildRequires:  ncurses-devel
61e0c9
%if %{with lua}
61e0c9
BuildRequires:  pkgconfig(luajit)
61e0c9
%endif
20d482
BuildRequires:  libbpf-devel >= 0.5.0, libbpf-static >= 0.5.0
33c334
20d482
Requires:       libbpf >= 0.5.0
a142d7
Requires:       tar
a142d7
Recommends:     kernel-devel
a142d7
Recommends:     %{name}-tools = %{version}-%{release}
33c334
33c334
%description
33c334
BCC is a toolkit for creating efficient kernel tracing and manipulation
33c334
programs, and includes several useful tools and examples. It makes use of
33c334
extended BPF (Berkeley Packet Filters), formally known as eBPF, a new feature
33c334
that was first added to Linux 3.15. BCC makes BPF programs easier to write,
33c334
with kernel instrumentation in C (and includes a C wrapper around LLVM), and
33c334
front-ends in Python and lua. It is suited for many tasks, including
33c334
performance analysis and network traffic control.
33c334
33c334
33c334
%package devel
33c334
Summary:        Shared library for BPF Compiler Collection (BCC)
33c334
Requires:       %{name}%{?_isa} = %{version}-%{release}
33c334
33c334
%description devel
33c334
The %{name}-devel package contains libraries and header files for developing
33c334
application that use BPF Compiler Collection (BCC).
33c334
33c334
33c334
%package doc
33c334
Summary:        Examples for BPF Compiler Collection (BCC)
33c334
Recommends:     python3-%{name} = %{version}-%{release}
33c334
%if %{with lua}
33c334
Recommends:     %{name}-lua = %{version}-%{release}
33c334
%endif
33c334
BuildArch:      noarch
33c334
33c334
%description doc
33c334
Examples for BPF Compiler Collection (BCC)
33c334
33c334
33c334
%package -n python3-%{name}
33c334
Summary:        Python3 bindings for BPF Compiler Collection (BCC)
33c334
Requires:       %{name}%{?_isa} = %{version}-%{release}
0e54f6
%{?python_provide:%python_provide python3-%{name}}
33c334
33c334
%description -n python3-%{name}
33c334
Python3 bindings for BPF Compiler Collection (BCC)
33c334
33c334
33c334
%if %{with lua}
33c334
%package lua
33c334
Summary:        Standalone tool to run BCC tracers written in Lua
33c334
Requires:       %{name}%{?_isa} = %{version}-%{release}
33c334
33c334
%description lua
33c334
Standalone tool to run BCC tracers written in Lua
33c334
%endif
33c334
33c334
33c334
%package tools
33c334
Summary:        Command line tools for BPF Compiler Collection (BCC)
20d482
Requires:       bcc = %{version}-%{release}
33c334
Requires:       python3-%{name} = %{version}-%{release}
33c334
Requires:       python3-netaddr
33c334
33c334
%description tools
33c334
Command line tools for BPF Compiler Collection (BCC)
33c334
33c334
%prep
a142d7
%autosetup -p1
33c334
33c334
%build
33c334
%cmake . \
33c334
        -DCMAKE_BUILD_TYPE=RelWithDebInfo \
61e0c9
        -DREVISION_LAST=%{version} -DREVISION=%{version} -DPYTHON_CMD=python3 \
61e0c9
        -DCMAKE_USE_LIBBPF_PACKAGE:BOOL=TRUE \
61e0c9
        %{?with_llvm_shared:-DENABLE_LLVM_SHARED=1}
33c334
%make_build
33c334
61e0c9
33c334
%install
33c334
%make_install
33c334
33c334
# Fix python shebangs
33c334
# This messes the timestamp and rpmdiff complains about it
33c334
# Let's set the all thing according to a reference file
33c334
touch -r %{buildroot}%{_datadir}/%{name}/examples/hello_world.py %{_tmppath}/timestamp
33c334
33c334
find %{buildroot}%{_datadir}/%{name}/{tools,examples} -type f -exec \
33c334
  sed -i -e '1s=^#!/usr/bin/python\([0-9.]\+\)\?$=#!%{__python3}=' \
33c334
         -e '1s=^#!/usr/bin/env python\([0-9.]\+\)\?$=#!%{__python3}=' \
33c334
         -e '1s=^#!/usr/bin/env bcc-lua$=#!/usr/bin/bcc-lua=' {} \;
33c334
33c334
for i in `find %{buildroot}%{_datadir}/%{name}/examples/` ; do
33c334
    touch -h -r %{_tmppath}/timestamp $i
33c334
done
33c334
33c334
# Move man pages to the right location
33c334
mkdir -p %{buildroot}%{_mandir}
33c334
mv %{buildroot}%{_datadir}/%{name}/man/* %{buildroot}%{_mandir}/
33c334
# Avoid conflict with other manpages
33c334
# https://bugzilla.redhat.com/show_bug.cgi?id=1517408
33c334
for i in `find %{buildroot}%{_mandir} -name "*.gz"`; do
33c334
  tname=$(basename $i)
33c334
  rename $tname %{name}-$tname $i
33c334
done
33c334
# Fix the symlink too
33c334
for i in `find %{buildroot}%{_mandir} -lname \*.gz` ; do
33c334
    target=`readlink $i`;
33c334
    ln -sf bcc-$target $i;
33c334
done
33c334
33c334
# We cannot run the test suit since it requires root and it makes changes to
33c334
# the machine (e.g, IP address)
33c334
#%check
33c334
33c334
%ldconfig_scriptlets
33c334
33c334
%files
33c334
%doc README.md
33c334
%license LICENSE.txt
33c334
%{_libdir}/lib%{name}.so.*
6eda62
%{_libdir}/libbcc_bpf.so.*
33c334
33c334
%files devel
0e54f6
%exclude %{_libdir}/lib%{name}*.a
0e54f6
%exclude %{_libdir}/lib%{name}*.la
33c334
%{_libdir}/lib%{name}.so
6eda62
%{_libdir}/libbcc_bpf.so
33c334
%{_libdir}/pkgconfig/lib%{name}.pc
33c334
%{_includedir}/%{name}/
33c334
33c334
%files -n python3-%{name}
33c334
%{python3_sitelib}/%{name}*
33c334
33c334
%files doc
33c334
# % dir % {_docdir}/% {name}
33c334
%doc %{_datadir}/%{name}/examples/
33c334
%if %{without lua}
33c334
%exclude %{_datadir}/%{name}/examples/lua
33c334
%endif
33c334
33c334
%files tools
33c334
%dir %{_datadir}/%{name}
33c334
%dir %{_datadir}/%{name}/tools
33c334
%dir %{_datadir}/%{name}/introspection
33c334
%{_datadir}/%{name}/tools/*
33c334
%{_datadir}/%{name}/introspection/*
33c334
%exclude %{_datadir}/%{name}/tools/old/
33c334
# inject relies on BPF_KPROBE_OVERRIDE which is not set on RHEL 8
33c334
%exclude %{_datadir}/%{name}/tools/inject
379855
%exclude %{_datadir}/%{name}/tools/doc/inject_example.txt
379855
%exclude %{_mandir}/man8/bcc-inject.8.gz
33c334
# Neither btrfs nor zfs are available on RHEL8
33c334
%exclude %{_datadir}/%{name}/tools/btrfs*
379855
%exclude %{_datadir}/%{name}/tools/doc/btrfs*
379855
%exclude %{_mandir}/man8/bcc-btrfs*
33c334
%exclude %{_datadir}/%{name}/tools/zfs*
379855
%exclude %{_datadir}/%{name}/tools/doc/zfs*
379855
%exclude %{_mandir}/man8/bcc-zfs*
6eda62
# criticalstat relies on CONFIG_PREEMPTIRQ_EVENTS which is disabled on RHEL 8
6eda62
%exclude %{_datadir}/%{name}/tools/criticalstat
6eda62
%exclude %{_datadir}/%{name}/tools/doc/criticalstat_example.txt
0e54f6
%exclude %{_mandir}/man8/bcc-criticalstat.8.gz
0e54f6
# compactsnoop is only supported on x86_64
0e54f6
%ifnarch x86_64
0e54f6
%exclude %{_datadir}/%{name}/tools/compactsnoop
0e54f6
%exclude %{_datadir}/%{name}/tools/doc/compactsnoop_example.txt
0e54f6
%exclude %{_mandir}/man8/bcc-compactsnoop.8.gz
0e54f6
%endif
33c334
%{_mandir}/man8/*
33c334
33c334
%if %{with lua}
33c334
%files lua
33c334
%{_bindir}/bcc-lua
33c334
%endif
33c334
33c334
33c334
%changelog
6fc629
* Tue Jan 10 2023 Jerome Marchand <jmarchan@redhat.com> - 0.25.0-2
6fc629
- Fix tcpdrop tool
6fc629
6fc629
* Wed Nov 30 2022 Jerome Marchand <jmarchan@redhat.com> - 0.25.0-1
6fc629
- Rebase to bcc-0.25.0
6fc629
- Rebuild on LLVM 15
6fc629
20d482
* Thu Jun 23 2022 Jerome Marchand <jmarchan@redhat.com> - 0.24.0-2
20d482
- Rebuild on libbpf 0.5.0
20d482
20d482
* Thu Jun 09 2022 Jerome Marchand <jmarchan@redhat.com> - 0.24.0-1
20d482
- Rebase to bcc-0.24.0
20d482
- Rebuild on LLVM 14
20d482
20d482
* Mon Dec 06 2021 Jerome Marchand <jmarchan@redhat.com> - 0.19.0-6
20d482
- Add excplicit requirement in bcc-tools for rpmdiff
20d482
fd9488
* Tue Nov 23 2021 Jerome Marchand <jmarchan@redhat.com> - 0.19.0-5
fd9488
- Handle the renaming of task_struct_>state field
fd9488
- Rebuild for LLVM 13
fd9488
a142d7
* Fri Jul 02 2021 Jerome Marchand <jmarchan@redhat.com> - 0.19.0-4
a142d7
- Build bcc from standard sources
a142d7
- Don't require bcc-tools by default
a142d7
a142d7
* Wed Jun 09 2021 Jerome Marchand <jmarchan@redhat.com> - 0.19.0-3
a142d7
- Rebuild on LLVM 12
a142d7
a142d7
* Fri Apr 30 2021 Jerome Marchand <jmarchan@redhat.com> - 0.19.0-2
a142d7
- Fix BPF src_file.
a142d7
a142d7
* Tue Apr 27 2021 Jerome Marchand <jmarchan@redhat.com> - 0.19.0-1
a142d7
- Rebased to version 0.19.0
a142d7
- Remove hard dependency on kernel-devel
61e0c9
61e0c9
* Fri Jan 22 2021 Jerome Marchand <jmarchan@redhat.com> - 0.16.0-2
61e0c9
- Build with libbpf package
61e0c9
- spec file cleanups
61e0c9
61e0c9
* Mon Oct 26 2020 Jerome Marchand <jmarchan@redhat.com> - 0.16.0-1
61e0c9
- Rebase on bcc-0.16.0
61e0c9
- Fix IPv6 ports
61e0c9
0e54f6
* Wed Sep 02 2020 Jerome Marchand <jmarchan@redhat.com> - 0.14.0-4
0e54f6
- Fix KFUNC_PROBE return value
0e54f6
- Forbid trampolines on unsupported arches
0e54f6
0e54f6
* Tue Jul 21 2020 Jerome Marchand <jmarchan@redhat.com> - 0.14.0-3
0e54f6
- Add KBUILD_MODNAME flag to default cflags
0e54f6
0e54f6
* Thu Jun 11 2020 Jerome Marchand <jmarchan@redhat.com> - 0.14.0-2
0e54f6
- Remove criticalstat manpage
0e54f6
- Remove compactsnoop on non x86_64
0e54f6
- Suggest to use --binary in deadlock
0e54f6
- Remove non-existent argument from tcpconnect man page
0e54f6
- Suggest to install the proper kernel-devel version
0e54f6
- Fix dbstat and dbslower
0e54f6
0e54f6
* Wed Apr 22 2020 Jerome Marchand <jmarchan@redhat.com> - 0.14.0-1
0e54f6
- Rebase on bcc-0.14.0
0e54f6
6eda62
* Wed Dec 04 2019 Jerome Marchand <jmarchan@redhat.com> - 0.11.0-2
6eda62
- Add -c option ton the synopsis of tcpretrans manpage
6eda62
6eda62
* Tue Nov 26 2019 Jerome Marchand <jmarchan@redhat.com> - 0.11.0-1
6eda62
- Rebase to bcc-0.11.0
6eda62
- Reinstate the unstable comment patch that has been removed by mistake
6eda62
6eda62
* Thu Oct 17 2019 Jerome Marchand <jmarchan@redhat.com> - 0.10.0-1
6eda62
- Rebase to bcc-0.10.0
6eda62
- Drop criticalstat
6eda62
- Fix regression on vfscount and runqslower
6eda62
- Rebuild on LLVM 9
6eda62
379855
* Tue Aug 06 2019 Jerome Marchand <jmarchan@redhat.com> - 0.8.0-4
379855
- remove unstable statement from the man pages
379855
379855
* Wed Jul 03 2019 Jerome Marchand <jmarchan@redhat.com> - 0.8.0-3
379855
- fix b.support_raw_tracepoint
379855
- fix runqslower warning
379855
379855
* Wed May 15 2019 Jerome Marchand <jmarchan@redhat.com> - 0.8.0-2
379855
- Rebuild for llvm 8
379855
379855
* Thu Apr 11 2019 Jerome Marchand <jmarchan@redhat.com> - 0.8.0-1
379855
- Rebase on bcc-8.0.0
379855
- Replace the temporary s390x workaround by a proper fix
379855
- Remove the doc of excluded tool from the package
379855
- Fix print_log2_hist
379855
- Fix yet a few other python3 bytes vs strings issues
379855
379855
* Mon Mar 25 2019 Jerome Marchand <jmarchan@redhat.com> - 0.7.0-6
379855
- Add CI gating
379855
33c334
* Thu Dec 13 2018 Jerome Marchand <jmarchan@redhat.com> - 0.7.0-5
33c334
- Fix biolatency -D
33c334
- Fix biotop manpage
33c334
- Rebuild for LLVM 7.0.1 (from Tom Stellard)
33c334
33c334
* Mon Dec 10 2018 Jerome Marchand <jmarchan@redhat.com> - 0.7.0-4
33c334
- Fix bio* tools
33c334
33c334
* Mon Nov 05 2018 Jerome Marchand <jmarchan@redhat.com> - 0.7.0-3
33c334
- Fix multiple bytes/string encoding issues
33c334
- Fix misc covscan warning
33c334
33c334
* Mon Oct 15 2018 Tom Stellard <tstellar@redhat.com> - 0.7.0-2
33c334
- Drop explicit dependency on clang-libs
33c334
33c334
* Fri Oct 12 2018 Jerome Marchand <jmarchan@redhat.com> - 0.7.0-1
33c334
- Rebase on bcc-7.0.0
33c334
- Remove useless tools (zfs*, btrfs* and inject) 
33c334
33c334
* Thu Sep 20 2018 Jerome Marchand <jmarchan@redhat.com> - 0.6.1-1
33c334
- Rebase on bcc-0.6.1
33c334
33c334
* Thu Sep 20 2018 Jerome Marchand <jmarchan@redhat.com> - 0.6.0-6
33c334
- llcstat: print a nicer error message on virtual machine
33c334
- Add NSS support to sslsniff
33c334
- Fixes miscellaneous error uncovered by covscan
33c334
33c334
* Wed Aug 08 2018 Tom Stellard <tstellar@redhat.com> - 0.6.0-5
33c334
- Use llvm-toolset-6.0 prefix for clang-libs dependency
33c334
33c334
* Fri Aug 03 2018 Tom Stellard <tstellar@redhat.com> - 0.6.0-4
33c334
- Rebuld for llvm-toolset-6.0
33c334
33c334
* Wed Jul 18 2018 Jerome Marchand <jmarchan@redhat.com> - 0.6.0-3
33c334
 - Disable lua on all arches
33c334
33c334
* Tue Jun 26 2018 Jerome Marchand <jmarchan@redhat.com> - 0.6.0-2
33c334
- Add clang-libs requirement
33c334
- Fix manpages symlinks
33c334
33c334
* Tue Jun 19 2018 Jerome Marchand <jmarchan@redhat.com> - 0.6.0-1
33c334
- Rebase on bcc-0.6.0
33c334
33c334
* Thu May 24 2018 Jerome Marchand <jmarchan@redhat.com> - 0.5.0-5
33c334
- Enables build on ppc64(le) and s390x arches
33c334
33c334
* Thu Apr 05 2018 Rafael Santos <rdossant@redhat.com> - 0.5.0-4
33c334
- Resolves #1555627 - fix compilation error with latest llvm/clang
33c334
33c334
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.0-3
33c334
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
33c334
33c334
* Fri Feb 02 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 0.5.0-2
33c334
- Switch to %%ldconfig_scriptlets
33c334
33c334
* Wed Jan 03 2018 Rafael Santos <rdossant@redhat.com> - 0.5.0-1
33c334
- Rebase to new released version
33c334
33c334
* Thu Nov 16 2017 Rafael Santos <rdossant@redhat.com> - 0.4.0-4
33c334
- Resolves #1517408 - avoid conflict with other manpages
33c334
33c334
* Thu Nov 02 2017 Rafael Santos <rdossant@redhat.com> - 0.4.0-3
33c334
- Use weak deps to not require lua subpkg on ppc64(le)
33c334
33c334
* Wed Nov 01 2017 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 0.4.0-2
33c334
- Rebuild for LLVM5
33c334
33c334
* Wed Nov 01 2017 Rafael Fonseca <rdossant@redhat.com> - 0.4.0-1
33c334
- Resolves #1460482 - rebase to new release
33c334
- Resolves #1505506 - add support for LLVM 5.0
33c334
- Resolves #1460482 - BPF module compilation issue
33c334
- Partially address #1479990 - location of man pages
33c334
- Enable ppc64(le) support without lua
33c334
- Soname versioning for libbpf by ignatenkobrain
33c334
33c334
* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.0-4
33c334
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
33c334
33c334
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.0-3
33c334
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
33c334
33c334
* Thu Mar 30 2017 Igor Gnatenko <ignatenko@redhat.com> - 0.3.0-2
33c334
- Rebuild for LLVM4
33c334
- Trivial fixes in spec
33c334
33c334
* Fri Mar 10 2017 Rafael Fonseca <rdossant@redhat.com> - 0.3.0-1
33c334
- Rebase to new release.
33c334
33c334
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.0-3
33c334
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
33c334
33c334
* Tue Jan 10 2017 Rafael Fonseca <rdossant@redhat.com> - 0.2.0-2
33c334
- Fix typo
33c334
33c334
* Tue Nov 29 2016 Rafael Fonseca <rdossant@redhat.com> - 0.2.0-1
33c334
- Initial import