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/files/, net-firewall/nftables/
Date: Fri, 28 Jun 2019 11:49:21
Message-Id: 1561722550.7be951c308fdca589c4d7a54131bb39d841a8955.polynomial-c@gentoo
1 commit: 7be951c308fdca589c4d7a54131bb39d841a8955
2 Author: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jun 28 09:07:23 2019 +0000
4 Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
5 CommitDate: Fri Jun 28 11:49:10 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7be951c3
7
8 net-firewall/nftables: Bump to version 0.9.1
9
10 Package-Manager: Portage-2.3.67, Repoman-2.3.16
11 Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>
12
13 net-firewall/nftables/Manifest | 1 +
14 .../nftables-0.9.1-avoid_dive_into_py_subdir.patch | 49 ++++++++
15 .../files/nftables-0.9.1-python_build.patch | 45 +++++++
16 net-firewall/nftables/nftables-0.9.1.ebuild | 137 +++++++++++++++++++++
17 4 files changed, 232 insertions(+)
18
19 diff --git a/net-firewall/nftables/Manifest b/net-firewall/nftables/Manifest
20 index 528cd04345e..70378f4b869 100644
21 --- a/net-firewall/nftables/Manifest
22 +++ b/net-firewall/nftables/Manifest
23 @@ -1,3 +1,4 @@
24 DIST nftables-0.8.5.tar.gz 355403 BLAKE2B 124bc5c35f050cc591f57b39cddcd595f97d14f83aed464b42efed272a03150623667dd0ca2862833c6b86d825d264c79dd1a211b9a6913b5734c0eaa4029b13 SHA512 311ec77646e2bc7da1b46ef2aba7492a5c0fdf23d33633649a6304771c5ce5ad839353b0702e942a82508c01d1c35705b602d91e54913944e03e176dc3f855f8
25 DIST nftables-0.8.tar.gz 327629 BLAKE2B a484c22ac010f68fc7458c12cabd0c35e474a0bf81fa4edbefba12d75b424898d38adb11a7fbb4542efbbb2d14be823701b3d9ced7b9fd669338366733fa169b SHA512 90ffebc338c121334ca42822793b6fdeff48390e755c690308919de47064b53f9af735a2c2914e5255f1bddec90484599337d4cdd67f7a01a3956deefcef9fcb
26 DIST nftables-0.9.0.tar.gz 417981 BLAKE2B 4dfba4d71928f1694ffeb4871353fc373d88e23c5ba716e726e1e6aba0efb2703233528f7a408bfefe47bfe54aa3612cccab9742c2a2208ec8c7a4bcda0e1823 SHA512 78e383bad5440c9414202cf0e4b6749fc5c01071d2fa547208e61cea6e7e179933990e7e538a60696eb0a7cf510d2c4b273a91d50287bb51507d244cd2875aed
27 +DIST nftables-0.9.1.tar.bz2 764066 BLAKE2B 26b194d6b3b970c05348c32a3ab21e8c25fcdb0d09d3d6b467198ba23a5bb44e7b6450d3efb86c39a488df4a837885c4a1ab96c197d5449f7de49b7b18ff5f90 SHA512 e14b75197ba3fea2a46c090450bf8b45b39fdc20db67bab1d6919c90128dee8ea8bbe9508e070f86b22ec70bcad8ab584fb89630a2240f09683137471c77d242
28
29 diff --git a/net-firewall/nftables/files/nftables-0.9.1-avoid_dive_into_py_subdir.patch b/net-firewall/nftables/files/nftables-0.9.1-avoid_dive_into_py_subdir.patch
30 new file mode 100644
31 index 00000000000..8ff4b85d88a
32 --- /dev/null
33 +++ b/net-firewall/nftables/files/nftables-0.9.1-avoid_dive_into_py_subdir.patch
34 @@ -0,0 +1,49 @@
35 +From c5ca85848c2fe28366d286a5b000f99d927516d3 Mon Sep 17 00:00:00 2001
36 +From: Jan Engelhardt <jengelh@××××.de>
37 +Date: Tue, 25 Jun 2019 08:58:34 +0200
38 +Subject: build: avoid recursion into py/ if not selected
39 +
40 +Signed-off-by: Jan Engelhardt <jengelh@××××.de>
41 +Signed-off-by: Pablo Neira Ayuso <pablo@×××××××××.org>
42 +---
43 + Makefile.am | 6 ++++--
44 + py/Makefile.am | 3 ---
45 + 2 files changed, 4 insertions(+), 5 deletions(-)
46 +
47 +diff --git a/Makefile.am b/Makefile.am
48 +index e567d32d..4a17424d 100644
49 +--- a/Makefile.am
50 ++++ b/Makefile.am
51 +@@ -3,8 +3,10 @@ ACLOCAL_AMFLAGS = -I m4
52 + SUBDIRS = src \
53 + include \
54 + files \
55 +- doc \
56 +- py
57 ++ doc
58 ++if HAVE_PYTHON
59 ++SUBDIRS += py
60 ++endif
61 +
62 + EXTRA_DIST = tests \
63 + files
64 +diff --git a/py/Makefile.am b/py/Makefile.am
65 +index 9fce7c9e..5f4e1f6f 100644
66 +--- a/py/Makefile.am
67 ++++ b/py/Makefile.am
68 +@@ -1,7 +1,5 @@
69 + EXTRA_DIST = setup.py __init__.py nftables.py schema.json
70 +
71 +-if HAVE_PYTHON
72 +-
73 + all-local:
74 + cd $(srcdir) && \
75 + $(PYTHON_BIN) setup.py build --build-base $(abs_builddir)
76 +@@ -28,4 +26,3 @@ clean-local:
77 +
78 + distclean-local:
79 + rm -f version
80 +-endif
81 +--
82 +cgit v1.2.1
83 +
84
85 diff --git a/net-firewall/nftables/files/nftables-0.9.1-python_build.patch b/net-firewall/nftables/files/nftables-0.9.1-python_build.patch
86 new file mode 100644
87 index 00000000000..81f65524ce7
88 --- /dev/null
89 +++ b/net-firewall/nftables/files/nftables-0.9.1-python_build.patch
90 @@ -0,0 +1,45 @@
91 +From 1f7e4deb527db32c55646e6e5baedb2ff2aa205e Mon Sep 17 00:00:00 2001
92 +From: Jan Engelhardt <jengelh@××××.de>
93 +Date: Tue, 25 Jun 2019 08:58:33 +0200
94 +Subject: build: unbreak non-functionality of --disable-python
95 +
96 +Signed-off-by: Jan Engelhardt <jengelh@××××.de>
97 +Signed-off-by: Pablo Neira Ayuso <pablo@×××××××××.org>
98 +---
99 + configure.ac | 11 +++++++----
100 + 1 file changed, 7 insertions(+), 4 deletions(-)
101 +
102 +diff --git a/configure.ac b/configure.ac
103 +index 75cf9199..b71268e8 100644
104 +--- a/configure.ac
105 ++++ b/configure.ac
106 +@@ -103,11 +103,14 @@ AC_ARG_WITH([python_bin],
107 + )
108 +
109 + AS_IF([test "x$PYTHON_BIN" = "x"], [
110 +- AS_IF([test "x$enable_python" = "xyes"], [AC_MSG_ERROR([Python asked but not found])])
111 +- AS_IF([test "x$enable_python" = "xcheck"], [AC_MSG_WARN([Python not found, continuing anyway])])
112 ++ AS_IF([test "x$enable_python" = "xyes"], [AC_MSG_ERROR([Python asked but not found])],
113 ++ [test "x$enable_python" = "xcheck"], [
114 ++ AC_MSG_WARN([Python not found, continuing anyway])
115 ++ enable_python=no
116 + ])
117 ++])
118 +
119 +-AM_CONDITIONAL([HAVE_PYTHON], [test "x$PYTHON_BIN" != "x"])
120 ++AM_CONDITIONAL([HAVE_PYTHON], [test "$enable_python" != "no"])
121 +
122 + AC_CONFIG_FILES([ \
123 + Makefile \
124 +@@ -138,7 +141,7 @@ nft configuration:
125 + libxtables support: ${with_xtables}
126 + json output support: ${with_json}"
127 +
128 +-AS_IF([test "x$PYTHON_BIN" != "x"], [
129 ++AS_IF([test "$enable_python" != "no"], [
130 + echo " enable Python: yes (with $PYTHON_BIN)"
131 + ], [
132 + echo " enable Python: no"
133 +--
134 +cgit v1.2.1
135 +
136
137 diff --git a/net-firewall/nftables/nftables-0.9.1.ebuild b/net-firewall/nftables/nftables-0.9.1.ebuild
138 new file mode 100644
139 index 00000000000..832ec7e67b4
140 --- /dev/null
141 +++ b/net-firewall/nftables/nftables-0.9.1.ebuild
142 @@ -0,0 +1,137 @@
143 +# Copyright 1999-2019 Gentoo Authors
144 +# Distributed under the terms of the GNU General Public License v2
145 +
146 +EAPI=7
147 +
148 +PYTHON_COMPAT=( python3_{5,6,7} )
149 +
150 +inherit autotools linux-info python-r1 systemd
151 +
152 +DESCRIPTION="Linux kernel (3.13+) firewall, NAT and packet mangling tools"
153 +HOMEPAGE="https://netfilter.org/projects/nftables/"
154 +#SRC_URI="https://git.netfilter.org/nftables/snapshot/v${PV}.tar.gz -> ${P}.tar.gz"
155 +SRC_URI="https://netfilter.org/projects/nftables/files/${P}.tar.bz2"
156 +
157 +LICENSE="GPL-2"
158 +SLOT="0"
159 +KEYWORDS="~amd64 ~arm ~arm64 ~ia64 ~x86"
160 +IUSE="debug +gmp json +modern_kernel python +readline static-libs"
161 +
162 +RDEPEND="${PYTHON_DEPS}
163 + >=net-libs/libmnl-1.0.3:0=
164 + gmp? ( dev-libs/gmp:0= )
165 + json? ( dev-libs/jansson )
166 + readline? ( sys-libs/readline:0= )
167 + >=net-libs/libnftnl-1.1.3:0="
168 +
169 +DEPEND="${RDEPEND}"
170 +
171 +BDEPEND="
172 + >=app-text/docbook2X-0.8.8-r4
173 + sys-devel/bison
174 + sys-devel/flex
175 + virtual/pkgconfig
176 +"
177 +
178 +REQUIRED_USE="${PYTHON_REQUIRED_USE}"
179 +
180 +#S="${WORKDIR}/v${PV}"
181 +
182 +PATCHES=(
183 + "${FILESDIR}"/${P}-python_build.patch
184 + "${FILESDIR}"/${P}-avoid_dive_into_py_subdir.patch
185 +)
186 +
187 +python_make() {
188 + emake \
189 + -C py \
190 + abs_builddir="${S}" \
191 + DESTDIR="${D}" \
192 + PYTHON_BIN="${PYTHON}" \
193 + ${@}
194 +}
195 +
196 +pkg_setup() {
197 + if kernel_is ge 3 13; then
198 + if use modern_kernel && kernel_is lt 3 18; then
199 + eerror "The modern_kernel USE flag requires kernel version 3.18 or newer to work properly."
200 + fi
201 + CONFIG_CHECK="~NF_TABLES"
202 + linux-info_pkg_setup
203 + else
204 + eerror "This package requires kernel version 3.13 or newer to work properly."
205 + fi
206 +}
207 +
208 +src_prepare() {
209 + default
210 +
211 + # fix installation path for doc stuff
212 + sed '/^pkgsysconfdir/s@${sysconfdir}.*$@${docdir}@' \
213 + -i files/nftables/Makefile.am || die
214 + sed '/^pkgsysconfdir/s@${sysconfdir}.*$@${docdir}/osf@' \
215 + -i files/osf/Makefile.am || die
216 +
217 + eautoreconf
218 +}
219 +
220 +src_configure() {
221 + local myeconfargs=(
222 + # We handle python separately
223 + --disable-python
224 + --sbindir="${EPREFIX}"/sbin
225 + $(use_enable debug)
226 + $(use_with !gmp mini_gmp)
227 + $(use_with json)
228 + $(use_with readline cli)
229 + $(use_enable static-libs static)
230 + )
231 + econf "${myeconfargs[@]}"
232 +}
233 +
234 +src_compile() {
235 + default
236 +
237 + if use python ; then
238 + python_foreach_impl python_make
239 + fi
240 +}
241 +
242 +src_install() {
243 + default
244 +
245 + local mksuffix="$(usex modern_kernel '-mk' '')"
246 +
247 + exeinto /usr/libexec/${PN}
248 + newexe "${FILESDIR}"/libexec/${PN}${mksuffix}.sh ${PN}.sh
249 + newconfd "${FILESDIR}"/${PN}${mksuffix}.confd ${PN}
250 + newinitd "${FILESDIR}"/${PN}${mksuffix}.init ${PN}
251 + keepdir /var/lib/nftables
252 +
253 + systemd_dounit "${FILESDIR}"/systemd/${PN}-restore.service
254 +
255 + if use python ; then
256 + python_foreach_impl python_make install
257 + fi
258 +
259 + find "${ED}" -type f -name "*.la" -delete || die
260 +}
261 +
262 +pkg_postinst() {
263 + local save_file
264 + save_file="${EROOT}/var/lib/nftables/rules-save"
265 +
266 + # In order for the nftables-restore systemd service to start
267 + # the save_file must exist.
268 + if [[ ! -f ${save_file} ]]; then
269 + touch ${save_file}
270 + fi
271 +
272 + elog "If you wish to enable the firewall rules on boot (on systemd) you"
273 + elog "will need to enable the nftables-restore service."
274 + elog " 'systemd_enable_service basic.target ${PN}-restore.service'"
275 + elog
276 + elog "If you are creating firewall rules before the next system restart "
277 + elog "the nftables-restore service must be manually started in order to "
278 + elog "save those rules on shutdown."
279 +}