From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1400376-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id A8658158090
	for <garchives@archives.gentoo.org>; Tue, 24 May 2022 21:06:10 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id A4513E041F;
	Tue, 24 May 2022 21:06:09 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 85C04E041F
	for <gentoo-commits@lists.gentoo.org>; Tue, 24 May 2022 21:06:09 +0000 (UTC)
Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 95C63341808
	for <gentoo-commits@lists.gentoo.org>; Tue, 24 May 2022 21:06:07 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 32C5047E
	for <gentoo-commits@lists.gentoo.org>; Tue, 24 May 2022 21:06:06 +0000 (UTC)
From: "Sam James" <sam@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, "Sam James" <sam@gentoo.org>
Message-ID: <1653426358.3d4a4be10e3d21bf996d9cda8dc5a4b0d5a5299b.sam@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-apps/pciutils/
X-VCS-Repository: repo/gentoo
X-VCS-Files: sys-apps/pciutils/pciutils-3.8.0.ebuild
X-VCS-Directories: sys-apps/pciutils/
X-VCS-Committer: sam
X-VCS-Committer-Name: Sam James
X-VCS-Revision: 3d4a4be10e3d21bf996d9cda8dc5a4b0d5a5299b
X-VCS-Branch: master
Date: Tue, 24 May 2022 21:06:06 +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: fb44db7e-1860-4bce-8a84-cecd3761eedb
X-Archives-Hash: 8ef9945afb0b67cbada51b42946dd04c

commit:     3d4a4be10e3d21bf996d9cda8dc5a4b0d5a5299b
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue May 24 21:04:02 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue May 24 21:05:58 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3d4a4be1

sys-apps/pciutils: bail out on too stale binutils for 3.8.0+

Bug: https://bugs.gentoo.org/847133
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-apps/pciutils/pciutils-3.8.0.ebuild | 44 +++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/sys-apps/pciutils/pciutils-3.8.0.ebuild b/sys-apps/pciutils/pciutils-3.8.0.ebuild
index 33df18d07893..94b7ab8f4246 100644
--- a/sys-apps/pciutils/pciutils-3.8.0.ebuild
+++ b/sys-apps/pciutils/pciutils-3.8.0.ebuild
@@ -37,6 +37,50 @@ switch_config() {
 	return 0
 }
 
+check_binutils_version() {
+	if ! tc-ld-is-gold && ! tc-ld-is-lld ; then
+		# Okay, hopefully it's Binutils' bfd.
+		# bug #847133
+
+		# Convert this:
+		# ```
+		# GNU ld (Gentoo 2.38 p4) 2.38
+		# Copyright (C) 2022 Free Software Foundation, Inc.
+		# This program is free software; you may redistribute it under the terms of
+		# the GNU General Public License version 3 or (at your option) a later version.
+		# This program has absolutely no warranty.
+		# ```
+		#
+		# into...
+		# ```
+		# 2.38
+		# ```
+		local ver=$($(tc-getLD) --version 2>&1 | head -1 | rev | cut -d' ' -f1 | rev)
+		ver_major=$(ver_cut 1 "${ver}")
+		ver_minor=$(ver_cut 2 "${ver}")
+
+		if [[ ${ver_major} -eq 2 && ${ver_minor} -lt 37 ]] ; then
+			eerror "Old version of binutils activated! ${P} cannot be built with an old version."
+			eerror "Please follow these steps:"
+			eerror "1. Select a newer binutils (>= 2.37) using binutils-config"
+			eerror "2. Run: . /etc/profile"
+			eerror "3. Try emerging again with: emerge -v1 ${CATEGORY}/${P}"
+			eerror "4. Complete your world upgrade if you were performing one."
+			eerror "4. Perform a depclean (emerge -acv)"
+			eerror "\tYou MUST depclean after every world upgrade in future!"
+			die "Old binutils found! Change to a newer ld using binutils-config (bug #847133)."
+		fi
+	fi
+}
+
+pkg_pretend() {
+	[[ ${MERGE_TYPE} != binary ]] && check_binutils_version
+}
+
+pkg_setup() {
+	[[ ${MERGE_TYPE} != binary ]] && check_binutils_version
+}
+
 src_prepare() {
 	default