From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1297100-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 24451139335
	for <garchives@archives.gentoo.org>; Sat, 26 Jun 2021 23:09:41 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 620AEE0839;
	Sat, 26 Jun 2021 23:09:40 +0000 (UTC)
Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4])
	(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 4E250E0839
	for <gentoo-commits@lists.gentoo.org>; Sat, 26 Jun 2021 23:09:40 +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 4328733FE26
	for <gentoo-commits@lists.gentoo.org>; Sat, 26 Jun 2021 23:09:39 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id CFD4F7AC
	for <gentoo-commits@lists.gentoo.org>; Sat, 26 Jun 2021 23:09:37 +0000 (UTC)
From: "Georgy Yakovlev" <gyakovlev@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, "Georgy Yakovlev" <gyakovlev@gentoo.org>
Message-ID: <1624748902.4cc70444a0077f9b807593ab322d05a6b3737666.gyakovlev@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: metadata/install-qa-check.d/
X-VCS-Repository: repo/gentoo
X-VCS-Files: metadata/install-qa-check.d/60libcrypt-deps
X-VCS-Directories: metadata/install-qa-check.d/
X-VCS-Committer: gyakovlev
X-VCS-Committer-Name: Georgy Yakovlev
X-VCS-Revision: 4cc70444a0077f9b807593ab322d05a6b3737666
X-VCS-Branch: master
Date: Sat, 26 Jun 2021 23:09:37 +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: b271835e-a386-4830-bd28-a33ecb3e514a
X-Archives-Hash: 2075a3103185ce49719481e6dae3b95f

commit:     4cc70444a0077f9b807593ab322d05a6b3737666
Author:     Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
AuthorDate: Fri Jun 25 05:24:12 2021 +0000
Commit:     Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
CommitDate: Sat Jun 26 23:08:22 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4cc70444

metadata/install-qa-check.d: add virtual/libcrypt dep check

Bug: https://bugs.gentoo.org/699422
Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>

 metadata/install-qa-check.d/60libcrypt-deps | 38 +++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/metadata/install-qa-check.d/60libcrypt-deps b/metadata/install-qa-check.d/60libcrypt-deps
new file mode 100644
index 00000000000..a822ed8c467
--- /dev/null
+++ b/metadata/install-qa-check.d/60libcrypt-deps
@@ -0,0 +1,38 @@
+# Copyright 2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# QA check: ensure that package specifies a dependency on virtual/libcrypt
+# Author: Georgy Yakovlev <gyakovlev@gentoo.org>
+# Maintainer Sam James <sam@gentoo.org>
+
+libcrypt_check() {
+	if ! type -P scanelf >/dev/null || has binchecks ${PORTAGE_RESTRICT}; then
+		return
+	fi	
+
+	if grep -q virtual/libcrypt <<<${RDEPEND}; then
+		# nothing to do here
+		return
+	fi
+
+	local libcrypt_consumers
+	# grep outputs newline separated list of files, so it's ok to skip specifying delimiter
+	IFS= mapfile libcrypt_consumers < <(find "${ED}" -type f -executable \
+		-print0 | xargs -0 scanelf -qyRF '%F %n' | grep 'libcrypt.so' 2>/dev/null )
+	
+	if [[ -n ${libcrypt_consumers[@]} ]]; then
+		eqawarn "Binary files linked to libcrypt.so found"
+		eqawarn "But dependency on virtual/libcrypt is not declared"
+		eqawarn
+		eqatag -v virtual-libcrypt.missing "${libcrypt_consumers[@]%% *}"
+		eqawarn
+		eqawarn "Please add virtual/libcrypt dependency"
+		eqawarn "Gentoo Bug: https://bugs.gentoo.org/699422"
+	fi
+	
+}
+
+libcrypt_check
+: # guarantee successful exit
+
+# vim:ft=sh