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 C81881581D3 for ; Mon, 20 May 2024 17:02:41 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 66E8FE2A38; Mon, 20 May 2024 17:02:40 +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 4D36DE2A38 for ; Mon, 20 May 2024 17:02:40 +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) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 94D6C33BE18 for ; Mon, 20 May 2024 17:02:39 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id D92031AEA for ; Mon, 20 May 2024 17:02:37 +0000 (UTC) From: "Michał Górny" 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" Message-ID: <1716224202.a3895e6ab84b171c1470ac790b8002d9d9a820de.mgorny@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/ X-VCS-Repository: repo/gentoo X-VCS-Files: eclass/distutils-r1.eclass X-VCS-Directories: eclass/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: a3895e6ab84b171c1470ac790b8002d9d9a820de X-VCS-Branch: master Date: Mon, 20 May 2024 17:02:37 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: edfbd0ca-5512-43d7-a870-62b64b4e0815 X-Archives-Hash: 41acbc186a7e5f19a05426fe38dc2a20 commit: a3895e6ab84b171c1470ac790b8002d9d9a820de Author: Michał Górny gentoo org> AuthorDate: Tue May 14 11:13:52 2024 +0000 Commit: Michał Górny gentoo org> CommitDate: Mon May 20 16:56:42 2024 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a3895e6a distutils-r1.eclass: Add a QA warning for pure Python file mismatch If the package is creating at least one pure Python wheel, check whether the baseline package contents (i.e. everything but compiled Python modules, extensions and .dist-info) match between implementations. This is meant to ensure that we can safely optimize builds by reusing pure Python wheels from previous builds. Signed-off-by: Michał Górny gentoo.org> eclass/distutils-r1.eclass | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass index 955c41fe4e2d..29e901720e6c 100644 --- a/eclass/distutils-r1.eclass +++ b/eclass/distutils-r1.eclass @@ -2022,6 +2022,44 @@ distutils-r1_src_configure() { return ${ret} } +# @FUNCTION: _distutils-r1_compare_installed_files +# @INTERNAL +# @DESCRIPTION: +# Verify the the match between files installed between this and previous +# implementation. +_distutils-r1_compare_installed_files() { + debug-print-function ${FUNCNAME} "${@}" + + # QA check requires diff(1). + if ! type -P diff &>/dev/null; then + return + fi + + # Perform the check only if at least one potentially reusable wheel + # has been produced. Nonpure packages (e.g. NumPy) may install + # interpreter configuration details into sitedir. + if [[ ${!DISTUTILS_WHEELS[*]} != *-none-any.whl* && + ${!DISTUTILS_WHEELS[*]} != *-abi3-*.whl ]]; then + return + fi + + local sitedir=${BUILD_DIR}/install$(python_get_sitedir) + if [[ -n ${_DISTUTILS_PREVIOUS_SITE} ]]; then + diff -dur \ + --exclude=__pycache__ \ + --exclude='*.dist-info' \ + --exclude="*$(get_modname)" \ + "${_DISTUTILS_PREVIOUS_SITE}" "${sitedir}" + if [[ ${?} -ne 0 ]]; then + eqawarn "Package creating at least one pure Python wheel installs different" + eqawarn "Python files between implementations. See diff in build log, above" + eqawarn "this message." + fi + fi + + _DISTUTILS_PREVIOUS_SITE=${sitedir} +} + # @FUNCTION: _distutils-r1_post_python_compile # @INTERNAL # @DESCRIPTION: @@ -2056,6 +2094,8 @@ _distutils-r1_post_python_compile() { find "${bindir}" -type f -exec sed -i \ -e "1s@^#!\(${EPREFIX}/usr/bin/\(python\|pypy\)\)@#!${root}\1@" \ {} + || die + + _distutils-r1_compare_installed_files fi }