From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1386590-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 53AF715808B
	for <garchives@archives.gentoo.org>; Sun, 17 Apr 2022 14:18:38 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id E6FA9E09AB;
	Sun, 17 Apr 2022 14:18:36 +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))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 6E25DE09AB
	for <gentoo-commits@lists.gentoo.org>; Sun, 17 Apr 2022 14:18:34 +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) server-digest SHA256)
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id F3BE134177C
	for <gentoo-commits@lists.gentoo.org>; Sun, 17 Apr 2022 14:18:32 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 67C8B177
	for <gentoo-commits@lists.gentoo.org>; Sun, 17 Apr 2022 14:18:31 +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: <1650205100.e8b470885ab9d44ffe46b1078b91dcdd9714e1a1.sam@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/60libtool-la
X-VCS-Directories: metadata/install-qa-check.d/
X-VCS-Committer: sam
X-VCS-Committer-Name: Sam James
X-VCS-Revision: e8b470885ab9d44ffe46b1078b91dcdd9714e1a1
X-VCS-Branch: master
Date: Sun, 17 Apr 2022 14:18:31 +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: 90c811fa-2755-4a14-9d8f-c53c3cdcecdb
X-Archives-Hash: 11eed61878e1734fb6056259112c3d5b

commit:     e8b470885ab9d44ffe46b1078b91dcdd9714e1a1
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Mar  4 01:37:11 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Apr 17 14:18:20 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e8b47088

metadata/install-qa-check.d: add 60libtool-la (check for unnecessary .la files)

Signed-off-by: Sam James <sam <AT> gentoo.org>

 metadata/install-qa-check.d/60libtool-la | 45 ++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/metadata/install-qa-check.d/60libtool-la b/metadata/install-qa-check.d/60libtool-la
new file mode 100644
index 000000000000..fd21ec8406d3
--- /dev/null
+++ b/metadata/install-qa-check.d/60libtool-la
@@ -0,0 +1,45 @@
+# Check if we're installing .la files unnecessarily
+# https://projects.gentoo.org/qa/policy-guide/installed-files.html#pg0303
+
+libtool_la_check() {
+	if [[ ${CATEGORY}/${PN} == dev-libs/libltdl ]] ; then
+		# bug #293921
+		return
+	fi
+
+	# Bail out if there aren't any .la files being installed
+	local files=$(find "${ED}"/usr/lib* -name '*.la' -print 2>/dev/null)
+	[[ -n "${files[@]}" ]] || return
+
+	if grep -q "dev-libs/libltdl" <<<${RDEPEND}; then
+		# Nothing to do here
+		return
+	fi
+
+	# Iterate over all the .la files we are installing to verify there's
+	# a corresponding .a file - they're pointless without a corresponding
+	# static library.
+	local file
+	local dir
+	local base
+	local bad_files=()
+	for file in "${files[@]}" ; do
+		dir=$(dirname ${file})
+		base=${dir%/}
+		base=${base%.la}
+
+		if [[ ! -f ${dir}/${base}.a ]] ; then
+			bad_files+=( ${file} )
+		fi
+	done
+
+	if [[ -n "${bad_files[@]}" ]] ; then
+		eqawarn "QA Notice: Installing libtool files (.la) without corresponding libraries!"
+		eqatag -v libtool-la.unnecessary "${bad_files[@]#${D}}"
+	fi
+}
+
+libtool_la_check
+: # guarantee successful exit
+
+# vim:ft=sh