diff options
| author | Michał Górny <mgorny@gentoo.org> | 2025-04-13 16:24:21 +0200 |
|---|---|---|
| committer | Michał Górny <mgorny@gentoo.org> | 2025-04-16 02:54:30 +0200 |
| commit | f91d60f3961bc3a5f69dd629db9c299d5429f9ce (patch) | |
| tree | 493a22b65d8d3715cd62b0ed9fc2098b86a6dcb6 | |
| parent | 5ebc14eb4811aac74edc2ee322339c5da005acd6 (diff) | |
| download | gentoo-f91d60f3961bc3a5f69dd629db9c299d5429f9ce.tar.gz gentoo-f91d60f3961bc3a5f69dd629db9c299d5429f9ce.tar.bz2 gentoo-f91d60f3961bc3a5f69dd629db9c299d5429f9ce.zip | |
metadata/install-qa-check.d: Check for Python exts for wrong impl
Add a QA check for Python extensions that were compiled for the wrong
implementation. This is particularly a case when build is not properly
isolated and extensions built for earlier Python versions end up
being included in the subsequent installs.
Bug: https://bugs.gentoo.org/953558
Signed-off-by: Michał Górny <mgorny@gentoo.org>
| -rw-r--r-- | metadata/install-qa-check.d/60python-site | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/metadata/install-qa-check.d/60python-site b/metadata/install-qa-check.d/60python-site index cd58fa3a5937..e4997ae2ebd6 100644 --- a/metadata/install-qa-check.d/60python-site +++ b/metadata/install-qa-check.d/60python-site @@ -1,4 +1,4 @@ -# Copyright 2019-2024 Gentoo Authors +# Copyright 2019-2025 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # QA checks related to site-packages directory: @@ -34,6 +34,7 @@ python_site_check() { local eggs=() local outside_site=() local stray_packages=() + local wrong_ext=() # Avoid running the check if sufficiently new gpep517 is not installed # yet. It's valid to schedule (for merge order) >=gpep517-8 after @@ -104,6 +105,7 @@ python_site_check() { -name 'README.txt' \ ')' -print0 ) + # check for forbidden packages for f in "${forbidden_package_names[@]}"; do [[ -d ${sitedir}/${f} ]] && stray_packages+=( @@ -111,6 +113,22 @@ python_site_check() { ) done + # check for extensions compiled for wrong implementations + local ext_suffix=$( + "${impl}" - <<-EOF + import sysconfig + print(sysconfig.get_config_var("EXT_SUFFIX")) + EOF + ) + while IFS= read -d $'\0' -r f; do + wrong_ext+=( "${f#${ED}}" ) + done < <( + find "${sitedir}" '(' \ + -name "*.pypy*$(get_modname)" -o \ + -name "*.cpython*$(get_modname)" \ + ')' -a '!' -name "*${ext_suffix}" -print0 + ) + einfo "Verifying compiled files for ${impl}" local kind pyc py while IFS=: read -r kind pyc py extra; do @@ -244,6 +262,14 @@ python_site_check() { eqawarn eqatag -v python-site.stdlib "${outside_site[@]}" fi + + if [[ ${wrong_ext[@]} ]]; then + eqawarn + eqawarn "QA Notice: Extensions found compiled for the wrong Python version" + eqawarn "(likely broken build isolation):" + eqawarn + eqatag -v python-site.wrong-ext "${wrong_ext[@]}" + fi } python_site_check |
