commit:     38de354cd5f8e9216792cd084c39d688925a9ee9
Author:     Florian Schmaus <flow <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 22 08:14:38 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=38de354c

install-qa-check.d/60pkgconfig: make QA_PKGCONFIG_VERSION opt-in

Signed-off-by: Florian Schmaus <flow <AT> gentoo.org>
Closes: https://github.com/gentoo/portage/pull/889
Signed-off-by: Sam James <sam <AT> gentoo.org>

 NEWS                               |  2 ++
 bin/install-qa-check.d/60pkgconfig | 15 +++++----------
 man/ebuild.5                       |  6 ++++++
 3 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/NEWS b/NEWS
index b1f317ce3..7e2ce9f41 100644
--- a/NEWS
+++ b/NEWS
@@ -130,6 +130,8 @@ Features:
 * sync: git: run 'git clean' in git repositories if they are marked as
   non-volatile.
 
+* install-qa-check.d: 60pkgconfig: add opt-in QA_PKGCONFIG_VERSION check
+
 Bug fixes:
 * glsa: Abort if a GLSA's arch list doesn't match the expected format (bug 
#882797).
 

diff --git a/bin/install-qa-check.d/60pkgconfig 
b/bin/install-qa-check.d/60pkgconfig
index 5d5b6d611..625b22c9e 100644
--- a/bin/install-qa-check.d/60pkgconfig
+++ b/bin/install-qa-check.d/60pkgconfig
@@ -94,19 +94,16 @@ pkgconfig_check() {
                eqatag -v pkgconfig.bad-libdir "${bad_libdir[@]}"
        fi
 
-       # Check for mismatched Version field vs ${PV}
+       # Check for mismatched .pc Version field vs ${PV}. As this check
+       # initially caused false-positives, i.e., reports of a mismatch
+       # where the mismatch was intentional, it is now an opt-in check.
        # 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.
+       # Skip the check if QA_PKGCONFIG_VERSION is not set.
        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
@@ -139,15 +136,13 @@ pkgconfig_check() {
                # 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}"
+                       eqawarn "The Version field of the following files does 
not match ${QA_PKGCONFIG_VERSION}"
                        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

diff --git a/man/ebuild.5 b/man/ebuild.5
index 186a3ac3f..decef8399 100644
--- a/man/ebuild.5
+++ b/man/ebuild.5
@@ -910,6 +910,12 @@ expressions with escape\-quoted special characters.
 This should contain a list of file paths, relative to the image directory, of
 desktop files which should not be validated. The paths may contain regular
 expressions with escape\-quoted special characters.
+.TP
+.B QA_PKGCONFIG_VERSION
+If set, then portage verifies that all pkg-config .pc files have a Version 
field
+with the value of QA_PKGCONFIG_VERSION. For example, set
+\fIQA_PKGCONFIG_VERSION=${PV}\fR if your package is expected to install all
+pkg-config .pc files with a Version field containing PV.
 
 .SH "PORTAGE DECLARATIONS"
 .TP

Reply via email to