From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1295777-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 076771382C5
	for <garchives@archives.gentoo.org>; Mon, 21 Jun 2021 16:03:56 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id DB208E085B;
	Mon, 21 Jun 2021 16:03:54 +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 51F98E085B
	for <gentoo-commits@lists.gentoo.org>; Mon, 21 Jun 2021 16:03:53 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(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 ACBFE3406C2
	for <gentoo-commits@lists.gentoo.org>; Mon, 21 Jun 2021 16:03:51 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 9476678F
	for <gentoo-commits@lists.gentoo.org>; Mon, 21 Jun 2021 16:03:49 +0000 (UTC)
From: "Marek Szuba" <marecki@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, "Marek Szuba" <marecki@gentoo.org>
Message-ID: <1624291418.7a2e9ee518178d40409d8d27384ac0c84b2b3ae9.marecki@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: net-analyzer/suricata/
X-VCS-Repository: repo/gentoo
X-VCS-Files: net-analyzer/suricata/suricata-6.0.2.ebuild
X-VCS-Directories: net-analyzer/suricata/
X-VCS-Committer: marecki
X-VCS-Committer-Name: Marek Szuba
X-VCS-Revision: 7a2e9ee518178d40409d8d27384ac0c84b2b3ae9
X-VCS-Branch: master
Date: Mon, 21 Jun 2021 16:03:49 +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: 73836312-9085-4617-bf72-559daa42edff
X-Archives-Hash: 0b24e696f4392e8aee1e909c3fbf289d

commit:     7a2e9ee518178d40409d8d27384ac0c84b2b3ae9
Author:     Marek Szuba <marecki <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 21 15:59:50 2021 +0000
Commit:     Marek Szuba <marecki <AT> gentoo <DOT> org>
CommitDate: Mon Jun 21 16:03:38 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7a2e9ee5

net-analyzer/suricata: limit version of currently selected rust

While simply limiting the version of virtual/rust in dependencies is
likely enough for most users at present, if someone has got both rust
and rust-bin emerged the virtual will only affect the version of one of
them - and it is possible that the version currently set as active
by "eselect rust" is not a supported one.

Closes: https://bugs.gentoo.org/797370
Signed-off-by: Marek Szuba <marecki <AT> gentoo.org>

 net-analyzer/suricata/suricata-6.0.2.ebuild | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/net-analyzer/suricata/suricata-6.0.2.ebuild b/net-analyzer/suricata/suricata-6.0.2.ebuild
index 739d881823d..5a9b9a7ab1a 100644
--- a/net-analyzer/suricata/suricata-6.0.2.ebuild
+++ b/net-analyzer/suricata/suricata-6.0.2.ebuild
@@ -51,7 +51,7 @@ RDEPEND="${PYTHON_DEPS}
 	redis?      ( dev-libs/hiredis )"
 DEPEND="${RDEPEND}
 	>=sys-devel/autoconf-2.69-r5
-	<virtual/rust-1.53.0"  # Bug #797370. Hopefully to be fixed come next release.
+	<virtual/rust-1.53.0"  # Bug #797370 part one. Hopefully to be fixed come next release.
 
 PATCHES=(
 	"${FILESDIR}/${PN}-5.0.1_configure-no-lz4-automagic.patch"
@@ -60,6 +60,18 @@ PATCHES=(
 )
 
 pkg_pretend() {
+	# Bug #797370 part deux, needed to address the edge case of both rust and rust-bin being present
+	#  - in which case the version limit set on virtual/rust only affects one of them.
+	# Version-checking code shamelessly stolen from www-client/firefox.
+	local version_rust=$(rustc -Vv 2>/dev/null | grep -F -- 'release:' | awk '{ print $2 }')
+	[[ -z ${version_rust} ]] && die "Failed to read version from rustc!"
+	if ver_test "${version_rust}" -ge "1.53.0"; then
+		eerror "This version of ${PN} does not support Rust 1.53.0+. Please switch to an older version using"
+		eerror "    eselect rust"
+		eerror "before emerging ${PN}."
+		die "Unsupported version of Rust selected"
+	fi
+
 	if use bpf && use kernel_linux; then
 		if kernel_is -lt 4 15; then
 			ewarn "Kernel 4.15 or newer is necessary to use all XDP features like the CPU redirect map"