From: Patrick McLean Date: Thu, 30 Apr 2020 22:45:23 +0000 (-0700) Subject: net-firewall/nftlb: New package X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=aa21372a486469fc40fab5a32e618cbbcb4bae56;p=gentoo.git net-firewall/nftlb: New package Copyright: Sony Interactive Entertainment Inc. Package-Manager: Portage-2.3.99, Repoman-2.3.22 Signed-off-by: Patrick McLean --- diff --git a/net-firewall/nftlb/Manifest b/net-firewall/nftlb/Manifest new file mode 100644 index 000000000000..db2d378839cc --- /dev/null +++ b/net-firewall/nftlb/Manifest @@ -0,0 +1 @@ +DIST nftlb-0.6.tar.gz 121216 BLAKE2B 98b69c35070eb733a218ac1b1aaa7816de1e4f149c8447fee298b4cf50c57610c816fb178d4115e1e7af5cea0f5b20df36eb5b79655e0d7c69ff30e363985104 SHA512 95b879cfc187fe94cc6876f4af3fe77795c1e0228850cfb38b95206685d9065076b6905d365da7ec5f92773cf8f72f6e441d9140d9b10b02eaf9b6c862c31006 diff --git a/net-firewall/nftlb/files/nftlb-0.6-tests.patch b/net-firewall/nftlb/files/nftlb-0.6-tests.patch new file mode 100644 index 000000000000..05baa7ee03a3 --- /dev/null +++ b/net-firewall/nftlb/files/nftlb-0.6-tests.patch @@ -0,0 +1,47 @@ +diff --git a/tests/exec_tests.sh b/tests/exec_tests.sh +index d96eaa3..b7f812d 100755 +--- a/tests/exec_tests.sh ++++ b/tests/exec_tests.sh +@@ -33,6 +33,8 @@ fi + + echo "-- Executing configuration tests" + ++retval=0 ++ + for test in `ls -d ${TESTS}`; do + if [[ ! ${test} =~ ^..._ ]]; then + continue; +@@ -55,14 +57,16 @@ for test in `ls -d ${TESTS}`; do + + if [ $statusexec -ne 0 ]; then + echo -e "\e[31mNFT EXEC ERROR\e[0m" ++ retval=1 + continue; + fi + + #~ nftfile=`echo ${file} | awk -F'.' '{ print $1 }'` +- $NFTBIN list ruleset > ${reportfile} ++ $NFTBIN list ruleset > ${reportfile} || retval=1 + + if [ ! -f ${outputfile} ]; then + echo "Dump file doesn't exist" ++ retval=1 + continue; + fi + +@@ -74,6 +78,7 @@ for test in `ls -d ${TESTS}`; do + rm -f ${reportfile} + else + echo -e "\e[31mNFT DUMP ERROR\e[0m" ++ retval=1 + fi + done + +@@ -83,4 +88,7 @@ fi + + if [ "`grep 'nft command error' /var/log/syslog`" != "" ]; then + echo -e "\e[33m* command errors found, please check syslog\e[0m" ++ retval=1 + fi ++ ++exit ${retval} diff --git a/net-firewall/nftlb/metadata.xml b/net-firewall/nftlb/metadata.xml new file mode 100644 index 000000000000..56cae167d372 --- /dev/null +++ b/net-firewall/nftlb/metadata.xml @@ -0,0 +1,8 @@ + + + + + chutzpah@gentoo.org + Patrick McLean + + diff --git a/net-firewall/nftlb/nftlb-0.6.ebuild b/net-firewall/nftlb/nftlb-0.6.ebuild new file mode 100644 index 000000000000..2cb16c516014 --- /dev/null +++ b/net-firewall/nftlb/nftlb-0.6.ebuild @@ -0,0 +1,55 @@ +# Copyright 2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit linux-info autotools + +DESCRIPTION="nftables load balancer" +HOMEPAGE="https://github.com/zevenet/nftlb" +SRC_URI="https://github.com/zevenet/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="AGPL-3" +SLOT="0" +KEYWORDS="~amd64 ~x86" + +DEPEND=" + net-firewall/nftables:=[modern-kernel] + dev-libs/jansson:= + dev-libs/libev:= +" +RDEPEND="${DEPEND}" + +# tests need root access +RESTRICT="test" + +PATCHES=( + "${FILESDIR}/nftlb-0.6-tests.patch" +) + +pkg_setup() { + local CONFIG_CHECK="~NF_TABLES ~NFT_NUMGEN + ~NFT_HASH ~NF_NAT ~IP_NF_NAT" + + linux-info_pkg_setup + + if kernel_is lt 4 19; then + eerror "${PN} requires kernel version 4.19 or newer" + fi +} + +src_prepare() { + default + eautoreconf +} + +src_test() { + pushd tests >/dev/null || die + + sed -e "s:/var/log/syslog:\"${T}/tests.log\":" \ + -i exec_tests.sh || die + + ./exec_tests.sh || die "tests failed" + + popd >/dev/null || die +}