public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: bin/install-qa-check.d/
Date: Fri, 17 Feb 2023 09:12:38 +0000 (UTC)	[thread overview]
Message-ID: <1676625123.7b00b5aa8c68942cdb9e751a9eeaa8b7795387f0.sam@gentoo> (raw)

commit:     7b00b5aa8c68942cdb9e751a9eeaa8b7795387f0
Author:     Florian Schmaus <flow <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 22 07:59:14 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Feb 17 09:12:03 2023 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=7b00b5aa

Revert "bin/install-qa-check.d: drop QA_PKGCONFIG_VERSION checks from 60pkgconfig"

This reverts commit 772fdceea5f148d9bb5fd6c87ffd48f87ca93bab.

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

 bin/install-qa-check.d/60pkgconfig | 60 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 60 insertions(+)

diff --git a/bin/install-qa-check.d/60pkgconfig b/bin/install-qa-check.d/60pkgconfig
index c982dbdf4..6ecbcabfd 100644
--- a/bin/install-qa-check.d/60pkgconfig
+++ b/bin/install-qa-check.d/60pkgconfig
@@ -88,6 +88,66 @@ pkgconfig_check() {
 		eqawarn "(contains reference to either lib or lib64 in wrong directory)"
 		eqatag -v pkgconfig.bad-libdir "${bad_libdir[@]}"
 	fi
+
+	# Check for mismatched Version field vs ${PV}
+	# To be safe, let's make sure _all_ installed .pcs have a bad Version
+	# before warning, as this should catch the general cases we're worried
+	# about, while avoiding any pathological cases e.g. multiple libraries
+	# with different versioning within one package.
+	# Example bugs: bug #833895, bug #833887.
+
+	# Default to PV if QA_PKGCONFIG_VERSION is unset.
+	if [[ -z ${QA_PKGCONFIG_VERSION+set} ]]; then
+		local QA_PKGCONFIG_VERSION=${PV}
+	fi
+
+	# Skip the check if QA_PKGCONFIG_VERSION is set to empty string.
+	if [[ -n ${QA_PKGCONFIG_VERSION} ]]; then
+		local pms_ver_re="^([0-9]+(\.[0-9]+)*)([a-z]?)((_(alpha|beta|pre|rc|p)[0-9]*)*)(-r[0-9]+)?$"
+		local -A bad_files
+
+		local is_pms_ver=false
+		if [[ ${QA_PKGCONFIG_VERSION} =~ ${pms_ver_re} ]] ; then
+			# Ensure that ver_test is available.
+			[[ $(type -t ver_test) == function ]] || inherit eapi7-ver
+			is_pms_ver=true
+		fi
+
+		for f in "${files[@]}" ; do
+			local file_version=$(pkg-config --modversion "${f}")
+			if [[ -n ${file_version} ]] ; then
+				if ${is_pms_ver} && [[ ${file_version} =~ ${pms_ver_re} ]]; then
+					# If both versions comply to PMS, then we can use ver_test to compare them.
+					ver_test ${QA_PKGCONFIG_VERSION} -eq ${file_version} && continue
+				else
+					# Otherwise, we resort to string comparision.
+					[[ ${QA_PKGCONFIG_VERSION} == ${file_version} ]] && continue
+				fi
+			else
+				# Record a special value if the .pc file has no version set at all.
+				file_version="<no-set>"
+			fi
+
+			bad_files["${f//${D}}"]="${file_version}"
+		done
+
+		# Skip result reporting if *_p* because for both _pN and _preN, we
+		# don't generally expect the versions to be exactly accurate, and
+		# we want to avoid false positives.
+		if [[ ${#bad_files[@]} -gt 0 && ${PV} != *_p* ]] && ! has live ${PROPERTIES} ; then
+			eqawarn "QA Notice: pkg-config files with mismatched Version found!"
+			eqawarn "The Version field of the following files does not match ${PV}"
+			local bad_file
+			for bad_file in "${!bad_files[@]}"; do
+				local bad_file_version="${bad_files[${bad_file}]}"
+				eqawarn "- ${bad_file}: ${bad_file_version}"
+			done
+			eqawarn "Please check all .pc files installed by this package."
+			eqawarn "You can use QA_PKGCONFIG_VERSION to set the expected version,"
+			eqawarn "or set to the empty string to disable this QA check."
+			eqatag pkgconfig.unexpected-version ${!bad_files[@]}
+		fi
+	fi
 }
 
 pkgconfig_check


             reply	other threads:[~2023-02-17  9:12 UTC|newest]

Thread overview: 120+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-17  9:12 Sam James [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-06-28  2:30 [gentoo-commits] proj/portage:master commit in: bin/install-qa-check.d/ Sam James
2025-06-28  2:30 Sam James
2025-06-09  2:51 Sam James
2025-06-05 11:22 Sam James
2025-06-05 11:22 Sam James
2025-06-05 11:22 Sam James
2025-06-05 11:22 Sam James
2025-06-05  3:07 Sam James
2025-05-30  7:37 Sam James
2025-05-30  7:37 Sam James
2025-05-30  7:37 Sam James
2025-05-30  7:37 Sam James
2025-05-30  7:37 Sam James
2025-05-30  7:37 Sam James
2025-05-30  7:37 Sam James
2025-05-30  7:37 Sam James
2025-05-30  7:37 Sam James
2025-05-30  7:37 Sam James
2025-05-30  7:37 Sam James
2025-05-30  7:37 Sam James
2025-05-30  7:37 Sam James
2025-05-30  7:36 Sam James
2025-05-30  7:36 Sam James
2025-05-30  7:36 Sam James
2025-05-30  7:36 Sam James
2025-05-30  7:30 Sam James
2025-04-24 22:12 Sam James
2025-01-06 10:19 Ulrich Müller
2024-09-17 14:32 Matt Turner
2024-09-17 14:32 Matt Turner
2024-09-17 14:32 Matt Turner
2024-09-17 14:32 Matt Turner
2024-09-09 23:49 Sam James
2024-05-22 16:56 Sam James
2024-05-17  6:28 Sam James
2024-04-25  2:59 Mike Gilbert
2023-07-29  3:57 Sam James
2023-06-29  8:22 Sam James
2023-05-11  1:24 Sam James
2023-05-11  1:24 Sam James
2023-05-11  1:24 Sam James
2023-05-11  1:24 Sam James
2023-05-11  1:24 Sam James
2023-05-11  1:24 Sam James
2023-04-07 10:41 Sam James
2023-02-28  3:10 Sam James
2023-02-27  4:43 Sam James
2023-02-26 20:22 Sam James
2023-02-19 12:23 Sam James
2023-02-17  9:12 Sam James
2022-11-09  2:29 Sam James
2022-11-09  2:25 Sam James
2022-11-09  2:25 Sam James
2022-11-09  2:25 Sam James
2022-11-09  2:25 Sam James
2022-11-09  2:25 Sam James
2022-11-08 23:51 Sam James
2022-10-27 23:37 Sam James
2022-10-27 23:37 Sam James
2022-10-27 23:37 Sam James
2022-10-11 19:18 Sam James
2022-10-11 19:18 Sam James
2022-10-11 19:18 Sam James
2022-08-19  0:09 Sam James
2022-08-14 20:43 Sam James
2022-08-13 17:30 Sam James
2022-08-10  4:36 Sam James
2022-08-10  4:36 Sam James
2022-08-01 22:39 Sam James
2022-08-01 22:39 Sam James
2022-08-01 22:39 Sam James
2022-07-28  6:32 Fabian Groffen
2022-07-27  8:18 Fabian Groffen
2022-07-27  8:18 Fabian Groffen
2022-05-15  1:02 Sam James
2022-05-15  1:02 Sam James
2022-05-07 17:15 Mike Gilbert
2022-04-28 15:50 Sam James
2022-04-12  2:00 Sam James
2022-04-12  2:00 Sam James
2022-04-12  2:00 Sam James
2022-04-12  2:00 Sam James
2022-04-12  2:00 Sam James
2022-04-12  2:00 Sam James
2022-04-12  2:00 Sam James
2022-04-12  2:00 Sam James
2022-04-10 17:20 Sam James
2022-04-05  4:33 Sam James
2019-11-03 20:15 Zac Medico
2019-11-03 20:15 Zac Medico
2019-11-03 20:02 Zac Medico
2019-11-03 19:45 Zac Medico
2019-05-20  5:01 Zac Medico
2019-05-20  4:41 Zac Medico
2018-10-06  1:15 Zac Medico
2018-09-04 21:16 Michał Górny
2018-08-07 18:49 Zac Medico
2018-08-07 18:49 Zac Medico
2018-08-04 19:36 Zac Medico
2018-07-28  6:41 Zac Medico
2018-01-26  6:40 Michał Górny
2017-10-16 17:21 Zac Medico
2017-08-02  7:24 Zac Medico
2016-06-02  6:12 Zac Medico
2016-06-02  1:40 Zac Medico
2016-05-12 22:09 Mike Frysinger
2016-05-12 21:36 Mike Frysinger
2016-05-11 17:55 Mike Frysinger
2015-11-11  0:56 Mike Frysinger
2015-05-26  3:46 Mike Frysinger
2015-05-04  5:09 Zac Medico
2015-04-20  5:36 Michał Górny
2014-12-02 18:44 Brian Dolbec
2014-11-19 23:26 Michał Górny
2014-10-27 19:28 Zac Medico
2014-10-27 19:28 Zac Medico
2014-10-19 21:11 Brian Dolbec
2014-09-26  2:17 Brian Dolbec
2014-09-26  2:17 Brian Dolbec

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1676625123.7b00b5aa8c68942cdb9e751a9eeaa8b7795387f0.sam@gentoo \
    --to=sam@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox