From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 F27B315808C for ; Tue, 12 Apr 2022 02:00:15 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id BD679E089A; Tue, 12 Apr 2022 02:00:12 +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 B3676E0895 for ; Tue, 12 Apr 2022 02:00:11 +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 80143341B1E for ; Tue, 12 Apr 2022 02:00:10 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id EB7763A5 for ; Tue, 12 Apr 2022 02:00:08 +0000 (UTC) From: "Sam James" 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" Message-ID: <1649728793.0ac65ddf7cff60a64730ca7c123f492fb68217a4.sam@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: bin/install-qa-check.d/ X-VCS-Repository: proj/portage X-VCS-Files: bin/install-qa-check.d/60pkgconfig X-VCS-Directories: bin/install-qa-check.d/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 0ac65ddf7cff60a64730ca7c123f492fb68217a4 X-VCS-Branch: master Date: Tue, 12 Apr 2022 02:00:08 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: ded20b71-fb20-4ad4-a4c7-85595ec82cf0 X-Archives-Hash: fe47919b797958132fb87c0dd28e56e3 commit: 0ac65ddf7cff60a64730ca7c123f492fb68217a4 Author: Sam James gentoo org> AuthorDate: Thu Oct 28 00:38:43 2021 +0000 Commit: Sam James gentoo org> CommitDate: Tue Apr 12 01:59:53 2022 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=0ac65ddf install-qa-check.d/60pkgconfig: check for not respecting libdir in pc files It's not valid to reference lib64 when installing to /usr/lib where we want 32-bit libraries. We want to make sure that if we're installing a pkgconfig file for a 32-bit variant (multilib), we make sure that the file references the right library: it should have e.g. /usr/lib, not /usr/lib64, or consumers trying to use the 32-bit library will try to link against a 64-bit library. (We also cover the opposite case: /usr/lib64 pkgconfig files referencing /usr/lib). Bug: https://bugs.gentoo.org/729642 Signed-off-by: Sam James gentoo.org> bin/install-qa-check.d/60pkgconfig | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/bin/install-qa-check.d/60pkgconfig b/bin/install-qa-check.d/60pkgconfig index 9e09a1053..cb6660bcb 100644 --- a/bin/install-qa-check.d/60pkgconfig +++ b/bin/install-qa-check.d/60pkgconfig @@ -14,7 +14,7 @@ pkgconfig_check() { f=$(egrep -zsH '^Libs.*-Wl,(-O[012]|--hash-style)' "${files[@]}") if [[ -n ${f} ]] ; then eqawarn "QA Notice: pkg-config files with wrong LDFLAGS detected:" - eqawarn "${f//${D}}" + eqatag -v pkgconfig.bad-ldlags "${f//${D}}" fi # Validate using pkgconfig @@ -39,10 +39,45 @@ pkgconfig_check() { eqawarn "QA Notice: pkg-config files not respecting EPREFIX found" eqawarn "${f}'s key=${key} does not respect EPREFIX:" eqawarn "${key}=${value}" + eqatag -v pkgconfig.bad-paths "${f}" fi done done fi + + # TODO: Generalise for non-lib64 libdir? Not that this is very common now + # that riscv chose a more standard layout. + # + # If we're installing to ${ED}/usr/lib/pkgconfig, let's make sure + # we're not referencing lib64. + # + # e.g. https://bugs.gentoo.org/729642 + local bad_libdir=() + for f in "${files[@]}" ; do + # In ${ED}/usr/lib, we shouldn't reference lib64 + if [[ ${f} == *lib/pkgconfig* ]] ; then + if [[ -d "${ED}"/usr/lib && -L "${ED}"/usr/lib ]] ; then + # (Don't bother if /usr/lib is a symlink to /usr/lib64) + continue + fi + + if egrep -q "/lib64" ${f} ; then + bad_libdir+=( ${f} ) + fi + elif [[ ${f} == *lib64/pkgconfig* ]] ; then + # We want to match /lib/, /lib/foo/, but not e.g. /lib64 or /lib64/, or libfoo + if grep -qP '/lib\b' ${f} ; then + bad_libdir+=( ${f} ) + fi + fi + done + + if [[ -n "${bad_libdir[@]}" ]] ; then + eqawarn "QA Notice: pkg-config files not respecting libdir found" + eqawarn "(contains reference to either lib or lib64 in wrong directory)" + eqatag -v pkgconfig.bad-libdir "${bad_libdir[@]}" + fi + } pkgconfig_check