From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1588643-garchives=archives.gentoo.org@lists.gentoo.org>
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 A745B158451
	for <garchives@archives.gentoo.org>; Mon,  8 Jan 2024 14:48:39 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 717832BC05B;
	Mon,  8 Jan 2024 14:48:35 +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 4D9E52BC05B
	for <gentoo-commits@lists.gentoo.org>; Mon,  8 Jan 2024 14:48:35 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(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 smtp.gentoo.org (Postfix) with ESMTPS id 61E3F343323
	for <gentoo-commits@lists.gentoo.org>; Mon,  8 Jan 2024 14:48:33 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 664C414B4
	for <gentoo-commits@lists.gentoo.org>; Mon,  8 Jan 2024 14:48:30 +0000 (UTC)
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" <mgorny@gentoo.org>
Message-ID: <1704725297.2c6e23dbd6f73f662da1832fc993c61f8945b83e.mgorny@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: metadata/install-qa-check.d/
X-VCS-Repository: repo/gentoo
X-VCS-Files: metadata/install-qa-check.d/60python-site
X-VCS-Directories: metadata/install-qa-check.d/
X-VCS-Committer: mgorny
X-VCS-Committer-Name: Michał Górny
X-VCS-Revision: 2c6e23dbd6f73f662da1832fc993c61f8945b83e
X-VCS-Branch: master
Date: Mon,  8 Jan 2024 14:48:30 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: 814377d3-572e-4bef-a7c8-ee8fb75707cc
X-Archives-Hash: ebdbfa9fc4957c65be896a3220254733

commit:     2c6e23dbd6f73f662da1832fc993c61f8945b83e
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Jan  5 14:38:25 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Jan  8 14:48:17 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2c6e23db

install-qa-check.d/60python-site: Add bad version check

This was a case e.g. with =dev-python/pyrqlite-2.2.0.

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 metadata/install-qa-check.d/60python-site | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/metadata/install-qa-check.d/60python-site b/metadata/install-qa-check.d/60python-site
index eb59ad5cac26..d73c881d3ad1 100644
--- a/metadata/install-qa-check.d/60python-site
+++ b/metadata/install-qa-check.d/60python-site
@@ -24,6 +24,7 @@ python_site_check() {
 	local missing=()
 	local stray=()
 
+	local bad_versions=()
 	local stray_packages=()
 
 	# Avoid running the check if sufficiently new gpep517 is not installed
@@ -42,6 +43,18 @@ python_site_check() {
 		local sitedir=( "${ED}"/usr/lib/${impl}*/site-packages )
 		[[ -d ${sitedir} ]] || continue
 
+		# check for bad package versions
+		while IFS= read -d $'\0' -r f; do
+			bad_versions+=( "${f#${ED}}" )
+		done < <(
+			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
+		)
+
 		# check for stray files in site-packages
 		while IFS= read -d $'\0' -r f; do
 			stray_packages+=( "${f#${ED}}" )
@@ -148,6 +161,14 @@ python_site_check() {
 		eqawarn "  https://projects.gentoo.org/python/guide/qawarn.html#compiled-bytecode-related-warnings"
 	fi
 
+	if [[ ${bad_versions[@]} ]]; then
+		eqawarn
+		eqawarn "QA Notice: The following Python packages were installed with"
+		eqawarn "invalid/suspicious versions in the site-packages directory:"
+		eqawarn
+		eqatag -v python-site.bad_version "${bad_versions[@]}"
+	fi
+
 	if [[ ${stray_packages[@]} ]]; then
 		eqawarn
 		eqawarn "QA Notice: The following unexpected files/directories were found"