From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 114B115803E for ; Thu, 4 Jan 2024 17:11:03 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 8238C2BC069; Thu, 4 Jan 2024 17:09:49 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 34B542BC063 for ; Thu, 4 Jan 2024 17:09:49 +0000 (UTC) From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= To: gentoo-dev@lists.gentoo.org Cc: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Subject: [gentoo-dev] [PATCH 5/5] distutils-r1.eclass: QA-warn about invalid package versions Date: Thu, 4 Jan 2024 18:09:34 +0100 Message-ID: <20240104170934.106565-5-mgorny@gentoo.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240104170934.106565-1-mgorny@gentoo.org> References: <20240104170934.106565-1-mgorny@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Archives-Salt: 6742be72-7b33-42c8-83de-36badd0ab9fa X-Archives-Hash: 3c27335a164901563e55ca51ed21e37e Signed-off-by: Michał Górny --- eclass/distutils-r1.eclass | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass index 014669c8c47c..e0a91001ef1f 100644 --- a/eclass/distutils-r1.eclass +++ b/eclass/distutils-r1.eclass @@ -2089,14 +2089,33 @@ _distutils-r1_post_python_install() { local sitedir=${D%/}$(python_get_sitedir) if [[ -d ${sitedir} ]]; then + local p _distutils-r1_strip_namespace_packages "${sitedir}" + local bad_versions=() + mapfile -d $'\0' -t bad_versions < <( + find "${sitedir}" -maxdepth 1 '(' \ + -name '*-0.0.0.dist-info' -o \ + -name '*-UNKNOWN.dist-info' -o \ + -name '*-0.0.0.egg-info' -o \ + -name '*-UNKNOWN.egg-info' \ + ')' -print0 + ) + + if [[ -n ${bad_versions[@]} ]]; then + eqawarn "The following Python packages were installed with invalid/suspicious" + eqawarn "versions in the site-packages directory:" + eqawarn + for p in "${bad_versions[@]}"; do + eqawarn " ${p##*/}" + done + fi + local forbidden_package_names=( examples test tests .pytest_cache .hypothesis _trial_temp ) local strays=() - local p mapfile -d $'\0' -t strays < <( find "${sitedir}" -maxdepth 1 -type f '!' '(' \ -name '*.egg-info' -o \ -- 2.43.0