commit: 39c5e02068d1d51f659ee847c3bb0cbb3a4608b6 Author: Patrick McLean <chutzpah <AT> gentoo <DOT> org> AuthorDate: Thu Jun 12 19:50:19 2025 +0000 Commit: Patrick McLean <chutzpah <AT> gentoo <DOT> org> CommitDate: Thu Jun 12 19:50:27 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=39c5e020
net-firewall/bpfilter: new package, add 0.4.0 Signed-off-by: Patrick McLean <chutzpah <AT> gentoo.org> net-firewall/bpfilter/Manifest | 1 + net-firewall/bpfilter/bpfilter-0.4.0.ebuild | 113 +++++++++++++++++++++ .../files/bpfilter-0.4.0-no-coverage.patch | 74 ++++++++++++++ net-firewall/bpfilter/metadata.xml | 11 ++ 4 files changed, 199 insertions(+) diff --git a/net-firewall/bpfilter/Manifest b/net-firewall/bpfilter/Manifest new file mode 100644 index 000000000000..d57a1892d350 --- /dev/null +++ b/net-firewall/bpfilter/Manifest @@ -0,0 +1 @@ +DIST bpfilter-0.4.0.tar.gz 2501443 BLAKE2B d945b08b048b88bfc96367785649b5a688e4b629f8d1533555149f8477ac6d8a2c47e4c157c3a55287fdcb2f4eb3584613cad525e773fa933dfd0a4812ffe6d1 SHA512 04b41baa3cd64a38728f051d849e70ffe430f93daca50dd2c2f6a37fcc0fc7394d36c3ff60c01cfce8ead23b582347b042c0e37a1d1cb7dc8491ee24574d88b4 diff --git a/net-firewall/bpfilter/bpfilter-0.4.0.ebuild b/net-firewall/bpfilter/bpfilter-0.4.0.ebuild new file mode 100644 index 000000000000..723f7a349001 --- /dev/null +++ b/net-firewall/bpfilter/bpfilter-0.4.0.ebuild @@ -0,0 +1,113 @@ +# Copyright 2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_1{1..3} ) +inherit python-any-r1 cmake + +DESCRIPTION="BPF-based packet filtering framework" +HOMEPAGE=" + https://bpfilter.io/ + https://github.com/facebook/bpfilter +" +SRC_URI="https://github.com/facebook/bpfilter/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="GPL-2+" +SLOT="0/0" +KEYWORDS="~amd64" +IUSE="doc test" + +RESTRICT="!test? ( test )" + +# tests need root access +RESTRICT+=" test" + +DEPEND=" + dev-libs/libbpf:= + dev-libs/libnl:3= + test? ( + dev-util/cmocka + ) +" +RDEPEND="${DEPEND}" +BDEPEND=" + sys-devel/bison + sys-devel/flex + doc? ( + app-text/doxygen + $(python_gen_any_dep ' + dev-python/sphinx[${PYTHON_USEDEP}] + dev-python/linuxdoc[${PYTHON_USEDEP}] + dev-python/breathe[${PYTHON_USEDEP}] + dev-python/furo[${PYTHON_USEDEP}] + ') + ) + test? ( + $(python_gen_any_dep ' + net-analyzer/scapy[${PYTHON_USEDEP}] + ') + ) +" + +PATCHES=( + "${FILESDIR}/bpfilter-0.4.0-no-coverage.patch" +) + +DOCS=( + CONTRIBUTING.md + README.md +) + +pkg_setup() { + (use test || use doc) && python-any-r1_pkg_setup +} + +python_check_deps() { + local -a atoms + if use doc; then + python_has_version \ + "dev-python/sphinx[${PYTHON_USEDEP}]" \ + "dev-python/breathe[${PYTHON_USEDEP}]" \ + "dev-python/linuxdoc[${PYTHON_USEDEP}]" \ + "dev-python/furo[${PYTHON_USEDEP}]" \ + || return + fi + if use test; then + python_has_version \ + "net-analyzer/scapy[${PYTHON_USEDEP}]" \ + || return + fi +} + +src_prepare() { + sed -e '/get_version_from_git/ d' -i CMakeLists.txt || die + cmake_src_prepare +} + +src_configure() { + local CMAKE_BUILD_TYPE=release + local -a mycmakeargs=( + -DNO_CHECKS=ON + -DNO_BENCHMARKS=ON + -DDEFAULT_PROJECT_VERSION="${PV}" + -DNO_DOCS=$(usex doc 'OFF' 'ON') + -DNO_TESTS=$(usex test 'OFF' 'ON') + ) + cmake_src_configure +} + +src_compile() { + cmake_src_compile + use doc && cmake_build doc +} + +src_test() { + cmake_src_test + cmake_build e2e || die "tests failed" +} + +src_install() { + cmake_src_install + use doc && dodoc -r "${BUILD_DIR}/doc/"{ht,x}ml +} diff --git a/net-firewall/bpfilter/files/bpfilter-0.4.0-no-coverage.patch b/net-firewall/bpfilter/files/bpfilter-0.4.0-no-coverage.patch new file mode 100644 index 000000000000..9322761b544d --- /dev/null +++ b/net-firewall/bpfilter/files/bpfilter-0.4.0-no-coverage.patch @@ -0,0 +1,74 @@ +diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt +index 6269787..9566e6b 100644 +--- a/doc/CMakeLists.txt ++++ b/doc/CMakeLists.txt +@@ -36,7 +36,6 @@ + #]] + + find_package(Doxygen REQUIRED) +-find_program(GENHTML_BIN genhtml REQUIRED) + find_program(SPHINX_BIN sphinx-build REQUIRED) + + file(GLOB_RECURSE bf_srcs +@@ -114,10 +113,6 @@ add_custom_command( + # Update the modification time of the documentation's index, so the + # benchmark report will be generated (as external/benchmarks/index.html is + # now out-of-date). +- COMMAND +- ${CMAKE_COMMAND} +- -E touch +- ${CMAKE_CURRENT_BINARY_DIR}/html/external/benchmarks/index.html + DEPENDS + ${CMAKE_CURRENT_BINARY_DIR}/conf.py + ${CMAKE_CURRENT_BINARY_DIR}/xml/index.xml +@@ -127,36 +122,7 @@ add_custom_command( + COMMENT "Generating the documentation" + ) + +-add_custom_command( +- COMMAND +- ${CMAKE_CURRENT_SOURCE_DIR}/benchreport +- --sources ${CMAKE_SOURCE_DIR} +- --results ${CMAKE_BINARY_DIR}/output/benchmarks +- --template ${CMAKE_CURRENT_SOURCE_DIR}/benchmarks.html.template +- --output ${CMAKE_CURRENT_BINARY_DIR}/html/external/benchmarks/index.html +- DEPENDS +- ${CMAKE_CURRENT_SOURCE_DIR}/benchreport +- ${CMAKE_CURRENT_BINARY_DIR}/html/index.html +- ${CMAKE_CURRENT_SOURCE_DIR}/benchmarks.html.template +- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/html/external/benchmarks/index.html +- COMMENT "Generate the benchmarks summary" +-) +- +-add_custom_command( +- COMMAND +- ${CMAKE_CURRENT_SOURCE_DIR}/covreport +- --genhtml ${GENHTML_BIN} +- --tracefile ${CMAKE_BINARY_DIR}/output/tests/lcov.out +- --output ${CMAKE_CURRENT_BINARY_DIR}/html/external/coverage +- DEPENDS +- ${CMAKE_CURRENT_SOURCE_DIR}/covreport +- ${CMAKE_CURRENT_BINARY_DIR}/html/index.html +- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/html/external/coverage/index.html +- COMMENT "Generate the coverage report" +-) +- + add_custom_target(doc + DEPENDS +- ${CMAKE_CURRENT_BINARY_DIR}/html/external/benchmarks/index.html +- ${CMAKE_CURRENT_BINARY_DIR}/html/external/coverage/index.html ++ ${CMAKE_CURRENT_BINARY_DIR}/html/index.html + ) +diff --git a/tests/unit/CMakeLists.txt b/tests/unit/CMakeLists.txt +index b7d38cd..505dea6 100644 +--- a/tests/unit/CMakeLists.txt ++++ b/tests/unit/CMakeLists.txt +@@ -183,7 +183,7 @@ add_custom_target(test + COMMENT "Running tests" + ) + +-if (NOT ${NO_DOCS}) ++if (FALSE) + find_program(LCOV_BIN lcov REQUIRED) + + add_custom_command(TARGET test diff --git a/net-firewall/bpfilter/metadata.xml b/net-firewall/bpfilter/metadata.xml new file mode 100644 index 000000000000..92b96df8dbb0 --- /dev/null +++ b/net-firewall/bpfilter/metadata.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person"> + <email>chutz...@gentoo.org</email> + <name>Patrick McLean</name> + </maintainer> + <upstream> + <remote-id type="github">facebook/bpfilter</remote-id> + </upstream> +</pkgmetadata>