Gentoo Archives: gentoo-commits

From: Lars Wendler <polynomial-c@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-firewall/nftables/
Date: Thu, 02 Apr 2020 07:47:59
Message-Id: 1585813669.76027cc4939f1c5aa1d6ddc72aa1ee951dd5de3d.polynomial-c@gentoo
1 commit: 76027cc4939f1c5aa1d6ddc72aa1ee951dd5de3d
2 Author: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
3 AuthorDate: Thu Apr 2 07:44:59 2020 +0000
4 Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
5 CommitDate: Thu Apr 2 07:47:49 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=76027cc4
7
8 net-firewall/nftables: Bump to version 0.9.4
9
10 Package-Manager: Portage-2.3.96, Repoman-2.3.22
11 Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>
12
13 net-firewall/nftables/Manifest | 1 +
14 net-firewall/nftables/nftables-0.9.4.ebuild | 144 ++++++++++++++++++++++++++++
15 2 files changed, 145 insertions(+)
16
17 diff --git a/net-firewall/nftables/Manifest b/net-firewall/nftables/Manifest
18 index f1c16ddeff7..38d6eefb1dd 100644
19 --- a/net-firewall/nftables/Manifest
20 +++ b/net-firewall/nftables/Manifest
21 @@ -2,3 +2,4 @@ DIST nftables-0.9.0.tar.gz 417981 BLAKE2B 4dfba4d71928f1694ffeb4871353fc373d88e2
22 DIST nftables-0.9.1.tar.bz2 764066 BLAKE2B 26b194d6b3b970c05348c32a3ab21e8c25fcdb0d09d3d6b467198ba23a5bb44e7b6450d3efb86c39a488df4a837885c4a1ab96c197d5449f7de49b7b18ff5f90 SHA512 e14b75197ba3fea2a46c090450bf8b45b39fdc20db67bab1d6919c90128dee8ea8bbe9508e070f86b22ec70bcad8ab584fb89630a2240f09683137471c77d242
23 DIST nftables-0.9.2.tar.bz2 779850 BLAKE2B 40bf9ed956a126048f27b343afc7aa4f6e34f35dc91127402cb127903f8150d212c80491fef2b54c18a63ca065608521062b3f6a2dd78969bdbf4d7d8a5a751d SHA512 2d83b104af0d70f99a16c2e40afdb9bf89bd984323810e2895976c5e2e346bf09dd88850a391f295e335279adfdd39d34c13610cf8e6b801499dc0df2a5cecf6
24 DIST nftables-0.9.3.tar.bz2 786759 BLAKE2B 578276d861fdb2b843223aca1276bbc1dda9627d0058259a966e324e30ee64d8c102d1e2cceb82d29143caa9dcd1a4492df168f1c87b136fc7b3a1a7dc8568a8 SHA512 d264f6fc75c95510e29fe7d5b82ae418d502f40437b098ba6117ffb1374d9989d70a7296e2e58c5fb25142145a987bb9c160902637899f892589809f9541db43
25 +DIST nftables-0.9.4.tar.bz2 792788 BLAKE2B 3f2d8ff3bcfe3ab815ee369c4937adef5e5730edee8ea59b32031732802e608bcb47ddd3e55303ad6c295158aff51b2f2c069d98600db83d732ff78836c7abb5 SHA512 cef5b5f26f3a2893a3eb1323f1f0ecfd6e2865e0eb040e9b7da5824e5be2274b888e661abe96e828add9e951f47303e30cb7c9238d267a031c0f99b5f3b6e2c0
26
27 diff --git a/net-firewall/nftables/nftables-0.9.4.ebuild b/net-firewall/nftables/nftables-0.9.4.ebuild
28 new file mode 100644
29 index 00000000000..1858322697d
30 --- /dev/null
31 +++ b/net-firewall/nftables/nftables-0.9.4.ebuild
32 @@ -0,0 +1,144 @@
33 +# Copyright 1999-2020 Gentoo Authors
34 +# Distributed under the terms of the GNU General Public License v2
35 +
36 +EAPI=7
37 +
38 +PYTHON_COMPAT=( python3_{6,7,8} )
39 +
40 +inherit autotools linux-info python-r1 systemd
41 +
42 +DESCRIPTION="Linux kernel (3.13+) firewall, NAT and packet mangling tools"
43 +HOMEPAGE="https://netfilter.org/projects/nftables/"
44 +#SRC_URI="https://git.netfilter.org/nftables/snapshot/v${PV}.tar.gz -> ${P}.tar.gz"
45 +SRC_URI="https://netfilter.org/projects/nftables/files/${P}.tar.bz2"
46 +
47 +LICENSE="GPL-2"
48 +SLOT="0"
49 +KEYWORDS="~amd64 ~arm ~arm64 ~ia64 ~ppc64 ~sparc ~x86"
50 +IUSE="debug +doc +gmp json +modern-kernel python +readline static-libs xtables"
51 +
52 +RDEPEND="
53 + >=net-libs/libmnl-1.0.3:0=
54 + gmp? ( dev-libs/gmp:0= )
55 + json? ( dev-libs/jansson )
56 + python? ( ${PYTHON_DEPS} )
57 + readline? ( sys-libs/readline:0= )
58 + >=net-libs/libnftnl-1.1.6:0=
59 + xtables? ( >=net-firewall/iptables-1.6.1 )
60 +"
61 +
62 +DEPEND="${RDEPEND}"
63 +
64 +BDEPEND="
65 + doc? ( app-text/asciidoc )
66 + >=app-text/docbook2X-0.8.8-r4
67 + sys-devel/bison
68 + sys-devel/flex
69 + virtual/pkgconfig
70 +"
71 +
72 +REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
73 +
74 +#S="${WORKDIR}/v${PV}"
75 +
76 +python_make() {
77 + emake \
78 + -C py \
79 + abs_builddir="${S}" \
80 + DESTDIR="${D}" \
81 + PYTHON_BIN="${PYTHON}" \
82 + ${@}
83 +}
84 +
85 +pkg_setup() {
86 + if kernel_is ge 3 13; then
87 + if use modern-kernel && kernel_is lt 3 18; then
88 + eerror "The modern-kernel USE flag requires kernel version 3.18 or newer to work properly."
89 + fi
90 + CONFIG_CHECK="~NF_TABLES"
91 + linux-info_pkg_setup
92 + else
93 + eerror "This package requires kernel version 3.13 or newer to work properly."
94 + fi
95 +}
96 +
97 +src_prepare() {
98 + default
99 +
100 + # fix installation path for doc stuff
101 + sed '/^pkgsysconfdir/s@${sysconfdir}.*$@${docdir}/skels@' \
102 + -i files/nftables/Makefile.am || die
103 + sed '/^pkgsysconfdir/s@${sysconfdir}.*$@${docdir}/skels/osf@' \
104 + -i files/osf/Makefile.am || die
105 +
106 + eautoreconf
107 +}
108 +
109 +src_configure() {
110 + local myeconfargs=(
111 + # We handle python separately
112 + --disable-python
113 + --sbindir="${EPREFIX}"/sbin
114 + $(use_enable debug)
115 + $(use_enable doc man-doc)
116 + $(use_with !gmp mini_gmp)
117 + $(use_with json)
118 + $(use_with readline cli readline)
119 + $(use_enable static-libs static)
120 + $(use_with xtables)
121 + )
122 + econf "${myeconfargs[@]}"
123 +}
124 +
125 +src_compile() {
126 + default
127 +
128 + if use python ; then
129 + python_foreach_impl python_make
130 + fi
131 +}
132 +
133 +src_install() {
134 + default
135 +
136 + local mksuffix="$(usex modern-kernel '-mk' '')"
137 +
138 + exeinto /usr/libexec/${PN}
139 + newexe "${FILESDIR}"/libexec/${PN}${mksuffix}.sh ${PN}.sh
140 + newconfd "${FILESDIR}"/${PN}${mksuffix}.confd ${PN}
141 + newinitd "${FILESDIR}"/${PN}${mksuffix}.init ${PN}
142 + keepdir /var/lib/nftables
143 +
144 + systemd_dounit "${FILESDIR}"/systemd/${PN}-restore.service
145 +
146 + if use python ; then
147 + python_foreach_impl python_make install
148 + fi
149 +
150 + find "${ED}" -type f -name "*.la" -delete || die
151 +}
152 +
153 +pkg_postinst() {
154 + local save_file
155 + save_file="${EROOT}/var/lib/nftables/rules-save"
156 +
157 + # In order for the nftables-restore systemd service to start
158 + # the save_file must exist.
159 + if [[ ! -f "${save_file}" ]]; then
160 + ( umask 177; touch "${save_file}" )
161 + elif [[ $(( "$( stat --printf '%05a' "${save_file}" )" & 07177 )) -ne 0 ]]; then
162 + ewarn "Your system has dangerous permissions for ${save_file}"
163 + ewarn "It is probably affected by bug #691326."
164 + ewarn "You may need to fix the permissions of the file. To do so,"
165 + ewarn "you can run the command in the line below as root."
166 + ewarn " 'chmod 600 \"${save_file}\"'"
167 + fi
168 +
169 + elog "If you wish to enable the firewall rules on boot (on systemd) you"
170 + elog "will need to enable the nftables-restore service."
171 + elog " 'systemd_enable_service basic.target ${PN}-restore.service'"
172 + elog
173 + elog "If you are creating firewall rules before the next system restart "
174 + elog "the nftables-restore service must be manually started in order to "
175 + elog "save those rules on shutdown."
176 +}