commit: 7aa2e188d6732088ae2a2926cc465988e4f117f9 Author: Sam James <sam <AT> gentoo <DOT> org> AuthorDate: Wed Feb 23 01:26:11 2022 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Tue Apr 12 01:59:54 2022 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=7aa2e188
install-qa-check.d/60pkgconfig: check for mismatched version We want to try catch cases where we're installing a pkg-config (.pc) file with an obviously incorrect version (here, we're testing for ${PV} != any version in all of the installed .pc files) because: 1. it's bad; 2. it has a large blast radius (breaking consumers). Bug: https://bugs.gentoo.org/833895 Bug: https://bugs.gentoo.org/833887 Bug: https://bugs.gentoo.org/833907 Bug: https://bugs.gentoo.org/833884 Bug: https://bugs.gentoo.org/833888 Signed-off-by: Sam James <sam <AT> gentoo.org> bin/install-qa-check.d/60pkgconfig | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/bin/install-qa-check.d/60pkgconfig b/bin/install-qa-check.d/60pkgconfig index cb6660bcb..78c5b5a3c 100644 --- a/bin/install-qa-check.d/60pkgconfig +++ b/bin/install-qa-check.d/60pkgconfig @@ -78,6 +78,32 @@ pkgconfig_check() { 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. + local all_bad=yes + # Record the last bad file matched + local bad_file + for f in "${files[@]}" ; do + if [[ ${PV} == $(pkg-config --modversion "${f}") ]] ; then + all_bad=no + break + fi + + bad_file=f + 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 [[ ${all_bad} == "yes" && ${PV} != *_p* ]] && ! has live ${PROPERTIES} ; then + eqawarn "QA Notice: pkg-config files with mismatched Version found!" + eqawarn "At least ${bad_file}'s Version field does not match ${PV}" + eqawarn "Please check all .pc files installed by this package." + fi } pkgconfig_check