From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1169483-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id A4A13138359
	for <garchives@archives.gentoo.org>; Sat,  9 May 2020 02:55:07 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id D785DE0828;
	Sat,  9 May 2020 02:55:06 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id A9C3AE0826
	for <gentoo-commits@lists.gentoo.org>; Sat,  9 May 2020 02:55:06 +0000 (UTC)
Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 79E9B34F14C
	for <gentoo-commits@lists.gentoo.org>; Sat,  9 May 2020 02:55:04 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 2ADF9232
	for <gentoo-commits@lists.gentoo.org>; Sat,  9 May 2020 02:55:02 +0000 (UTC)
From: "Patrick McLean" <chutzpah@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Patrick McLean" <chutzpah@gentoo.org>
Message-ID: <1588992891.cfc7d9481a9002d8827cba7f4a3b247589202907.chutzpah@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: net-firewall/iptables/
X-VCS-Repository: repo/gentoo
X-VCS-Files: net-firewall/iptables/iptables-1.8.4-r1.ebuild net-firewall/iptables/iptables-1.8.4-r2.ebuild
X-VCS-Directories: net-firewall/iptables/
X-VCS-Committer: chutzpah
X-VCS-Committer-Name: Patrick McLean
X-VCS-Revision: cfc7d9481a9002d8827cba7f4a3b247589202907
X-VCS-Branch: master
Date: Sat,  9 May 2020 02:55:02 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: 7b638e35-7c7e-4def-917a-51d7cb75124b
X-Archives-Hash: 878005a930618bcb46b2a1a0231391ab

commit:     cfc7d9481a9002d8827cba7f4a3b247589202907
Author:     Patrick McLean <patrick.mclean <AT> sony <DOT> com>
AuthorDate: Sat May  9 02:52:46 2020 +0000
Commit:     Patrick McLean <chutzpah <AT> gentoo <DOT> org>
CommitDate: Sat May  9 02:54:51 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cfc7d948

net-firewall/iptables: Revbump, fix eselect bug (bug #721578)

This also supports eselect-arptables and eselect-ebtables, since the
nftables implementation of xtables can replace both these commands.

Closes: https://bugs.gentoo.org/721578
Copyright: Sony Interactive Entertainment Inc.
Package-Manager: Portage-2.3.99, Repoman-2.3.22
Signed-off-by: Patrick McLean <chutzpah <AT> gentoo.org>

 ...es-1.8.4-r1.ebuild => iptables-1.8.4-r2.ebuild} | 45 ++++++++++++++++++----
 1 file changed, 37 insertions(+), 8 deletions(-)

diff --git a/net-firewall/iptables/iptables-1.8.4-r1.ebuild b/net-firewall/iptables/iptables-1.8.4-r2.ebuild
similarity index 77%
rename from net-firewall/iptables/iptables-1.8.4-r1.ebuild
rename to net-firewall/iptables/iptables-1.8.4-r2.ebuild
index 80ef3dd2877..96799b425fb 100644
--- a/net-firewall/iptables/iptables-1.8.4-r1.ebuild
+++ b/net-firewall/iptables/iptables-1.8.4-r2.ebuild
@@ -19,8 +19,10 @@ SLOT="0/1.8.3"
 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
 IUSE="conntrack ipv6 netlink nftables pcap static-libs"
 
+BUILD_DEPEND="
+	>=app-eselect/eselect-iptables-20200508
+"
 COMMON_DEPEND="
-	app-eselect/eselect-iptables
 	conntrack? ( >=net-libs/libnetfilter_conntrack-1.0.6 )
 	netlink? ( net-libs/libnfnetlink )
 	nftables? (
@@ -33,7 +35,8 @@ DEPEND="${COMMON_DEPEND}
 	virtual/os-headers
 	>=sys-kernel/linux-headers-4.4:0
 "
-BDEPEND="
+BDEPEND="${BUILD_DEPEND}
+	app-eselect/eselect-iptables
 	virtual/pkgconfig
 	nftables? (
 		sys-devel/flex
@@ -41,7 +44,10 @@ BDEPEND="
 	)
 "
 RDEPEND="${COMMON_DEPEND}
+	${BUILD_DEPEND}
 	nftables? ( net-misc/ethertypes )
+	!<net-firewall/ebtables-2.0.11-r1
+	!<net-firewall/arptables-0.0.5-r1
 "
 
 PATCHES=(
@@ -116,11 +122,8 @@ src_install() {
 		# Bug 647458
 		rm "${ED}"/etc/ethertypes || die
 
-		# Bug 660886
-		rm "${ED}"/sbin/{arptables,ebtables} || die
-
-		# Bug 669894
-		rm "${ED}"/sbin/ebtables-{save,restore} || die
+		# Bugs 660886 and 669894
+		rm "${ED}"/sbin/{arptables,ebtables}{,-{save,restore}} || die
 	fi
 
 	systemd_dounit "${FILESDIR}"/systemd/iptables-{re,}store.service
@@ -139,8 +142,18 @@ pkg_postinst() {
 	if ! eselect iptables show &>/dev/null; then
 		elog "Current iptables implementation is unset, setting to ${default_iptables}"
 		eselect iptables set "${default_iptables}"
-		use ipv6 && eselect iptables set --ipv6 "${default_iptables}"
 	fi
+
+	if use nftables; then
+		local tables
+		for tables in {arp,eb}tables; do
+			if ! eselect ${tables} show &>/dev/null; then
+				elog "Current ${tables} implementation is unset, setting to ${default_iptables}"
+				eselect ${tables} set xtables-nft-multi
+			fi
+		done
+	fi
+
 	eselect iptables show
 }
 
@@ -148,6 +161,22 @@ pkg_prerm() {
 	elog "Unsetting iptables symlinks before removal"
 	eselect iptables unset
 
+	if ! has_version 'net-firewall/ebtables'; then
+		elog "Unsetting ebtables symlinks before removal"
+		eselect ebtables unset
+	elif [[ -z ${REPLACED_BY_VERSION} ]]; then
+		elog "Resetting ebtables symlinks to ebtables-legacy"
+		eselect ebtables set ebtables-legacy
+	fi
+
+	if ! has_version 'net-firewall/arptables'; then
+		elog "Unsetting arptables symlinks before removal"
+		eselect arptables unset
+	elif [[ -z ${REPLACED_BY_VERSION} ]]; then
+		elog "Resetting arptables symlinks to arptables-legacy"
+		eselect arptables set arptables-legacy
+	fi
+
 	# the eselect module failing should not be fatal
 	return 0
 }