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 C02CE15800A for ; Sun, 6 Aug 2023 13:08:07 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id AD1572BC01D; Sun, 6 Aug 2023 13:08:03 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (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 6C9802BC013 for ; Sun, 6 Aug 2023 13:08:03 +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] python-utils-r1.eclass: Eliminate false positives from occluded check Date: Sun, 6 Aug 2023 15:07:58 +0200 Message-ID: <20230806130758.932675-1-mgorny@gentoo.org> X-Mailer: git-send-email 2.41.0 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: 2c1a247b-28a8-40bf-8586-e00ffbacd284 X-Archives-Hash: 71cd2751088cd295a53d9b34f2079246 Modify the occluded package check to unidirectionally check for additional files in installed package directory. This eliminates false positives when the source directory contains additional files, in particular C sources. This change also eliminates the dependency on diff(1), in favor of comm(1). As a side effect, we no longer compare .py files for equality but that shouldn't be such a big deal. Signed-off-by: Michał Górny --- eclass/python-utils-r1.eclass | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index 27157a003ab2..b67cbb7db298 100644 --- a/eclass/python-utils-r1.eclass +++ b/eclass/python-utils-r1.eclass @@ -1244,14 +1244,13 @@ _python_check_occluded_packages() { # positives before filing bugs. [[ ! ${PYTHON_EXPERIMENTAL_QA} ]] && return - type -P diff &>/dev/null || return [[ -z ${BUILD_DIR} || ! -d ${BUILD_DIR}/install ]] && return local sitedir="${BUILD_DIR}/install$(python_get_sitedir)" # avoid unnecessarily checking if we are inside install dir [[ ${sitedir} -ef . ]] && return - local f fn diff + local f fn diff l for f in "${sitedir}"/*/; do f=${f%/} fn=${f##*/} @@ -1260,17 +1259,26 @@ _python_check_occluded_packages() { [[ ${fn} == *.dist-info || ${fn} == *.egg-info ]] && continue if [[ -d ${fn} ]]; then - diff=$(diff -dupr -x "__pycache__" "${fn}" "${sitedir}/${fn}") + ( + cd "${sitedir}" && find "${fn}" -type f | + grep -v /__pycache__/ | sort + ) > "${T}"/py-installed || die + ( + find "${fn}" -type f | + grep -v /__pycache__/ | sort + ) > "${T}"/py-source || die + + diff=$(comm -1 -3 "${T}"/py-source "${T}"/py-installed || die) if [[ -n ${diff} ]]; then eqawarn "The directory ${fn} occludes package installed for ${EPYTHON}." - echo - echo ">>> Diff:" - echo "${diff}" - echo "<<< End-of-diff" - echo + eqawarn "The installed package includes additional files:" + eqawarn + while IFS= read -r l; do + eqawarn " ${l}" + done <<<"${diff}" + eqawarn if [[ ! ${_PYTHON_WARNED_OCCLUDED_PACKAGES} ]]; then - eqawarn "The complete build log includes diffs." eqawarn "For more information on occluded packages, please see:" eqawarn "https://projects.gentoo.org/python/guide/test.html#importerrors-for-c-extensions" _PYTHON_WARNED_OCCLUDED_PACKAGES=1 -- 2.41.0