diff options
author | V3n3RiX <venerix@koprulu.sector> | 2025-04-19 08:46:18 +0100 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2025-04-19 08:46:18 +0100 |
commit | 9e65a38a260a44292ceb8a0bf4fea5f0b5666826 (patch) | |
tree | 40c907f5d72cda463e42d2ee5d5434b3790e06df /metadata/install-qa-check.d | |
parent | cf1a411e806b434c96329401a6ff0901ec7f0d5c (diff) |
gentoo auto-resync : 19:04:2025 - 08:46:17edge
Diffstat (limited to 'metadata/install-qa-check.d')
-rw-r--r-- | metadata/install-qa-check.d/60cargo-eclass | 36 | ||||
-rw-r--r-- | metadata/install-qa-check.d/60python-site | 17 |
2 files changed, 48 insertions, 5 deletions
diff --git a/metadata/install-qa-check.d/60cargo-eclass b/metadata/install-qa-check.d/60cargo-eclass new file mode 100644 index 000000000000..a80d53449a9d --- /dev/null +++ b/metadata/install-qa-check.d/60cargo-eclass @@ -0,0 +1,36 @@ +# Copyright 2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# QA check: ensure cargo based ebuilds define correct RUST_MIN_VER +# Maintainer: Rust Project <rust@gentoo.org> + +cargo_ver_check() { + has cargo ${INHERITED} || return + + # First version of Rust to support that edition + declare -A RUST_EDITIONS=( + [2024]="1.85.0" + #[2021]="1.56.0" # our oldest rust version is 1.74.0 + ) + + # Maximum value for "edition" across Cargo.toml files + local cargo_toml_edition=$( + find "${S}" -name Cargo.toml -exec sed -n -e 's/^\s*edition\s*=\s*"\([0-9]*\)"\s*$/\1/p' {} \+ | + sort -n | + tail -n 1 + ) + if [[ -n ${cargo_toml_edition} ]]; then + local min_rust_ver="${RUST_EDITIONS[${cargo_toml_edition}]}" + if [[ -n ${min_rust_ver} ]] && ver_test "${RUST_MIN_VER:-0}" -lt "${min_rust_ver}"; then + eqawarn + eqawarn "QA Notice: found Cargo.toml file which specifies edition=\"${cargo_toml_edition}\"" + eqawarn "which requires RUST_MIN_VER=\"${min_rust_ver}\"" + eqawarn + fi + fi +} + +cargo_ver_check +: # guarantee successful exit + +# vim:ft=sh diff --git a/metadata/install-qa-check.d/60python-site b/metadata/install-qa-check.d/60python-site index e4c2c875ca0f..49d4b3a1a830 100644 --- a/metadata/install-qa-check.d/60python-site +++ b/metadata/install-qa-check.d/60python-site @@ -54,8 +54,8 @@ python_site_check() { local impl=${prog%/*} impl=${impl##*/} - # NB: using ${impl}* to catch pypy3.* for pypy3 - local pydir=( "${ED}"/usr/lib/${impl}* ) + local pydir="${ED}"/usr/lib/${impl} + [[ ${impl} == pypy3 ]] && pydir="${ED}"/usr/lib/pypy3.10 [[ -d ${pydir} ]] || continue # check for packages installing outside site-packages @@ -75,6 +75,13 @@ python_site_check() { local sitedir=( "${pydir}"/site-packages ) [[ -d ${sitedir} ]] || continue + local modname=$( + "${impl}" - <<-EOF + import sysconfig + print(sysconfig.get_config_var("SHLIB_SUFFIX")) + EOF + ) + # check for bad package versions while IFS= read -d $'\0' -r f; do bad_versions+=( "${f#${ED}}" ) @@ -107,7 +114,7 @@ python_site_check() { -name '*.pth' -o \ -name '*.py' -o \ -name '*.pyi' -o \ - -name "*$(get_modname)" -o \ + -name "*${modname}" -o \ -name 'README.txt' \ ')' -print0 ) @@ -130,8 +137,8 @@ python_site_check() { wrong_ext+=( "${f#${ED}}" ) done < <( find "${sitedir}" '(' \ - -name "*.pypy*$(get_modname)" -o \ - -name "*.cpython*$(get_modname)" \ + -name "*.pypy*${modname}" -o \ + -name "*.cpython*${modname}" \ ')' -a '!' -name "*${ext_suffix}" -print0 ) |