commit:     6bce6ac4dc87872c112e9f5c5a847acb78ec3d26
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 28 00:37:41 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Apr 12 01:59:52 2022 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=6bce6ac4

install-qa-check.d/60pkgconfig: check if paths within .pc respect EPREFIX

Seen this problem a few times and it's easy to miss.

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

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

diff --git a/bin/install-qa-check.d/60pkgconfig 
b/bin/install-qa-check.d/60pkgconfig
index 9c4768a95..9e09a1053 100644
--- a/bin/install-qa-check.d/60pkgconfig
+++ b/bin/install-qa-check.d/60pkgconfig
@@ -26,6 +26,23 @@ pkgconfig_check() {
                eqawarn "QA Notice: pkg-config files which fail validation 
found!"
                eqawarn "Run 'pkg-config --validate ...' for more information"
        fi
+
+       # Check for unexpected paths
+       # e.g. 
https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c90ab38e3577aae61fac2341b34ad593948de1cd
+       if [[ -n ${EPREFIX} ]] ; then
+               for f in "${files[@]}" ; do
+                       local key
+                       for key in prefix exec_prefix libdir includedir ; do
+                               local value=$(pkg-config --variable="${key}" 
"${f}")
+
+                               if [[ ${value} != "${EPREFIX}"* ]] ; then
+                                       eqawarn "QA Notice: pkg-config files 
not respecting EPREFIX found"
+                                       eqawarn "${f}'s key=${key} does not 
respect EPREFIX:"
+                                       eqawarn "${key}=${value}"
+                               fi
+                       done
+               done
+       fi
 }
 
 pkgconfig_check

Reply via email to